JavaScript SDK
The @spaceinvoices/js-sdk package is the recommended default for most self-serve developers. It gives you full API coverage, strong types, and a clean path from sandbox proof-of-concept to production.
Features
- Full TypeScript Support — Complete type definitions for all API methods
- Tree-Shakeable — Import only what you need for smaller bundles
- ESM & CJS — Works everywhere
- Zod Schemas — Optional schemas for form validation
- Dynamic Tokens — Support for async token providers
Choose This Path If
- your backend owns invoice creation and business logic
- you want full UI freedom
- you are building automation, workflows, or event-driven integrations
- you want one integration surface that scales from one entity to many
Tradeoff
You own the frontend experience. If you want pre-built screens immediately, start with the Embed SDK or React UI instead.
Quick Example
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices({ accessToken: 'sk_sandbox_...' });
// List invoicesconst invoices = await sdk.invoices.list();
// Create an invoiceconst invoice = await sdk.invoices.create({ entityId: 'ent_123', body: { date: '2024-01-15', items: [{ name: 'Consulting', price: 500 }], },});Next Steps
- Quick Start — create your first entity and invoice flow
- Configuration — configure auth, tokens, and environments
- API Methods — inspect the full surface area
- Authentication — choose account vs entity keys
- Choose Your Path — compare this against other options