Quickstart
1. Get Your API Key
Sign up at app.spaceinvoices.com. Your account includes a default entity (business). Grab your sandbox API key from Settings → API Keys.
2. Install the SDK
npm install @space-invoices/js-sdk
# or
bun add @space-invoices/js-sdk3. Initialize
import SpaceInvoices from "@space-invoices/js-sdk";
const sdk = new SpaceInvoices("YOUR_API_KEY");4. Create Your First Invoice
const invoice = await sdk.invoices.create({
customer: {
name: "Acme Corporation",
email: "billing@acme.com",
},
items: [
{
name: "Consulting",
quantity: 10,
price: 150,
},
],
});
console.log(invoice.number); // INV-2024-0001
console.log(invoice.total_with_tax); // 15005. Download PDF or Send by Email
// title: Render PDF
const pdf = await sdk.invoices.renderPdf(invoice.id);
// Save to file
fs.writeFileSync("invoice.pdf", pdf);
// Or send as response
res.setHeader("Content-Type", "application/pdf");
res.send(pdf);Or send directly to your customer:
// title: Send invoice
await sdk.email.send(invoice.id, {
to: invoice.customer.email,
subject: "Your invoice #{document_number}",
body: "Thank you for your business!",
});Done. You’ve created an invoice and delivered it.
Next Steps
- Invoices — Full invoice guide
- Multi-Tenancy — Creating entities for platform customers
- API Reference — Complete API docs