Skip to content

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

Initialize SDKtypescript
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

List Invoicestypescript
const _invoices = await sdk.invoices.list({
  entity_id: "ent_123",
  limit: 10,
});

4. Create an Invoice

Create Invoicetypescript
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

Render PDFtypescript
const _pdf = await sdk.invoices.renderPdf(invoice.id);

// pdf is a Blob - save or send it

Tree-Shakeable Imports

For smaller bundle sizes, import individual modules:

Tree-Shakeable Importtypescript
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