Quick Start
1. Create Your Entity And Generate The Right Key
Sign up at app.spaceinvoices.com, create your first entity, then generate the API key that matches your setup from Settings → API Keys.
- use an account key if your backend manages multiple entities
- use an entity key if you want one isolated business context only
If you are unsure, start with the main Quickstart and Authentication guides first.
2. Initialize the SDK
import SpaceInvoices from "@spaceinvoices/js-sdk";
const _sdk = new SpaceInvoices({ accessToken: "YOUR_API_KEY" });If you use an account key, include the target entity context on requests that operate on entity data.
3. List Invoices
const _invoices = await sdk.invoices.list({
entity_id: "ent_123",
limit: 10,
});4. Create an Invoice
const _invoice = await sdk.invoices.create({
date: "2024-01-15",
date_due: "2024-01-30",
customer: {
name: "Acme Corp",
email: "billing@acme.com",
},
items: [
{
name: "Consulting Services",
quantity: 10,
unit: "hours",
price: 150,
},
],
});5. Download as PDF
const _pdf = await sdk.invoices.renderPdf(invoice.id);
// pdf is a Blob - save or send itTree-Shakeable Imports
For smaller bundle sizes, import individual modules:
import { customers, initSDK, invoices } from "@spaceinvoices/js-sdk";
// Initialize once at startup
initSDK({ accessToken: "YOUR_API_KEY" });
// Use individual modules
const _result = await invoices.list({ entity_id: "ent_123" });
const _customer = await customers.get("cust_123");Next Steps
- Quickstart — the full account -> entity -> key -> invoice flow
- Authentication — key types and environments
- Configuration — Advanced configuration options
- API Methods — All available methods
- Zod Schemas — Form validation with Zod