Skip to Content

Invoices API

Generate, manage, and export invoices with PDF support and configurable numbering.

List Invoices

GET /api/billing/invoices

Query Parameters

ParamTypeDescription
statusstringFilter by status
customerIdUUIDFilter by customer

Response 200 OK

[ { "id": "01JQX...", "customerId": "01JQA...", "subscriptionId": "01JQB...", "invoiceNumber": "INV-2026-0001", "status": "issued", "subtotal": "49.99", "taxAmount": "5.00", "total": "54.99", "currency": "USD", "dueDate": "2026-04-15T00:00:00Z", "paidAt": null, "lineItems": [ { "description": "Pro Plan - Monthly", "quantity": 1, "unitPrice": "49.99", "amount": "49.99" } ], "pdfUrl": "/invoices/INV-2026-0001.pdf", "createdAt": "2026-03-15T10:30:00Z" } ]

Create Invoice

POST /api/billing/invoices Content-Type: application/json

Body

FieldTypeRequiredDescription
customerIdUUIDYesCustomer to invoice
subscriptionIdUUIDNoAssociated subscription
lineItemsarrayYesInvoice line items
lineItems[].descriptionstringYesLine item description
lineItems[].quantityintegerYesQuantity
lineItems[].unitPricestringYesPrice per unit
dueDatestringNoISO 8601 date
currencystringNoDefault: USD

Update Invoice Status

PUT /api/billing/invoices/:id Content-Type: application/json
FieldTypeDescription
statusstringdraft, issued, paid, void

Generate PDF

GET /api/billing/invoices/:id/pdf

Returns the invoice as a PDF document. PDFs are generated using printpdf and cached.

Invoice Statuses

StatusDescription
draftNot yet sent to customer
issuedSent and awaiting payment
paidPayment received
overduePast due date without payment
voidCanceled / voided

Invoice Numbering

Invoice numbers follow the pattern INV-{YEAR}-{SEQUENCE} and are auto-incremented. The sequence resets yearly.

Last updated on