Docs
API Reference

Invoices

Generate invoices with deposits, balances, and discounts

Invoices are billable documents you send to customers after work is done. They share the same line-item structure as quotes (services + inventory items + discount) but add deposit and balance tracking, payment status, and due dates.

Endpoints

  • GET/organisations/{orgId}/invoices — List invoices (paginated)
  • POST/organisations/{orgId}/invoices — Create invoice
  • GET/organisations/{orgId}/invoices/{invoiceId} — Get invoice
  • PUT/organisations/{orgId}/invoices/{invoiceId} — Update invoice
  • DELETE/organisations/{orgId}/invoices/{invoiceId} — Delete invoice

List is ordered by invoiceDate descending and supports customerId, ticketId, and paid (true/false) filters.

Required scopes: invoices:read / invoices:write / invoices:delete. Reminder and share-link writes use invoices:write (including DELETE).

GET/organisations/{orgId}/invoices/{invoiceId}/reminders POST/organisations/{orgId}/invoices/{invoiceId}/reminders GET/organisations/{orgId}/invoices/{invoiceId}/reminders/{reminderId} PUT/organisations/{orgId}/invoices/{invoiceId}/reminders/{reminderId} DELETE/organisations/{orgId}/invoices/{invoiceId}/reminders/{reminderId}

Reminders are seeded from the org's defaultInvoiceReminders when remindersEnabled is true (or the org default is on). nextSendAt is computed by the app's Cloud Function trigger — do not write it. Linking an invoice to a job with outstanding invoice-gate forms returns 409 FORM_GATE_INVOICE.

POST/organisations/{orgId}/invoices/{invoiceId}/share-link

mints a public view URL (https://app.servicebay.io/view-document?token=…) and marks the invoice sent unless ?markSent=false.

DELETE/organisations/{orgId}/invoices/{invoiceId}/share-link/{tokenId}

revokes it.

Auto-incrementing index

index is assigned by the server from the org invoice counter. It is not client-settable.

paid, depositPaid, balancePaid, and paidDate are read-only. Record a payment (or delete one) and the API recomputes them. discount is { "isPercentage": boolean, "value": number }.

Machine-readable version: OpenAPI spec.