/api/v1/businesses/:businessId/invoices/batches
auth: jwt (administrator | view_invoices | submit_invoices)Paginated list of import batches for the business. Each batch row carries row counts (imported/failed) and the originating file metadata. Registered before /:invoiceId so the literal 'batches' segment never collides with the dynamic id.
handlers: InvoicesController.listBatches
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. Enforced by requireBusinessAccess (Administrator bypasses). |
offset queryinteger | no | 0 | Pagination offset. Coerced from string; min 0. |
limit queryinteger | no | 50 | Page size. Coerced from string; min 1, max 200. |
APIResponseDataList<ImportBatchDTO>/api/v1/businesses/:businessId/invoices/daily-fiscal-report
auth: jwt (administrator | view_invoices | submit_invoices)Daily fiscal report. Signed-type classification (TAXCORE-922): every figure reads what V-SDC SIGNED (InvoicePayments.WireInvoiceType / WireTransactionType, with the wire mapper's fallbacks), through one shared filter shared with /payment-records — so any figure equals the records behind it. Cancellations are identified by CancelsPaymentId; a cancelled original still counts as a sale and its cancellation as the refund it signed, netting to 0. byPaymentType is split by tender. Adds byReceiptType, byReceiptCode (per TaxCore code NS/AS/NR/AR/CS/CR/PS/PR/TS/TR with its cancellations), byPaymentTypeNet (Normal + Advance, refunds subtracting), saleRefundTotals.saleCount/refundCount and cancellations.byTransactionType; every earlier field keeps its shape. Window precedence fromDay/toDay > dateFromMs/dateToMs > legacy ISO dateFrom/dateTo. Fires DAILY_FISCAL_REPORT_GENERATED with the resolved window and scope.
handlers: InvoicesController.getDailyFiscalReport
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
fromDay queryYYYY-MM-DD | no | — | Preferred window start — a Vanuatu calendar day, resolved server-side to 00:00:00.000 UTC+11. Takes precedence over the ms and ISO pairs. Supply with toDay. |
toDay queryYYYY-MM-DD | no | — | Window end — resolved to 23:59:59.999 UTC+11 on that Vanuatu day. |
dateFromMs queryepoch ms | no | — | Inclusive window start (TAXCORE-701). Used when fromDay/toDay are absent. |
dateToMs queryepoch ms | no | — | Inclusive window end. |
dateFrom queryISO-8601 datetime | no | — | Deprecated legacy window start, kept for installed app builds (old UTC end-of-day normalisation intact). |
dateTo queryISO-8601 datetime | no | — | Deprecated legacy window end. |
provider queryCSV of Invoices.Source | no | — | Any-of connector filter. |
tillId queryCSV of uuid | no | — | Any-of till filter. |
locationId queryCSV of uuid | no | — | Any-of location filter — matches LocationId OR BusinessLocationId. |
outletId queryCSV of string | no | — | Any-of Lightspeed outlet filter. |
receiptType queryCSV of SALE|REFUND|COPY|ADVANCE|PROFORMA|TRAINING | no | — | Any-of SIGNED receipt type. |
transactionType queryCSV of SALE|REFUND | no | — | Any-of SIGNED direction. With receiptType it selects a TaxCore code — ADVANCE + REFUND is AR. |
receiptCode queryCSV of NS|NR|AS|AR|CS|CR|PS|PR|TS|TR | no | — | Any-of TaxCore receipt code — any mix (NS + AR lists exactly those two). |
status queryCSV of signed|blocked|error | no | — | Any-of status. Figures always count signed receipts; completeness blocked/error. |
search querystring | no | — | Substring over fiscal number, invoice number, buyer name and buyer TIN. |
APIResponseDataObject<DailyFiscalReportResponse>APIError/api/v1/businesses/:businessId/invoices/daily-fiscal-report/export.csv
auth: jwt (administrator | view_invoices | submit_invoices)The daily report as CSV: the window (Vanuatu time), the applied scope and completeness, then one "section, bucket, count, amount" row per bucket. Same query as the JSON report. UTF-8 BOM, every cell quoted, formula-trigger text neutralised. Fires RECEIPT_RECORDS_EXPORTED (kind: summary).
handlers: InvoicesController.exportDailyFiscalReportCsv
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
fromDay queryYYYY-MM-DD | no | — | Preferred window start — a Vanuatu calendar day, resolved server-side to 00:00:00.000 UTC+11. Takes precedence over the ms and ISO pairs. Supply with toDay. |
toDay queryYYYY-MM-DD | no | — | Window end — resolved to 23:59:59.999 UTC+11 on that Vanuatu day. |
dateFromMs queryepoch ms | no | — | Inclusive window start (TAXCORE-701). Used when fromDay/toDay are absent. |
dateToMs queryepoch ms | no | — | Inclusive window end. |
provider queryCSV of Invoices.Source | no | — | Any-of connector filter. |
tillId queryCSV of uuid | no | — | Any-of till filter. |
locationId queryCSV of uuid | no | — | Any-of location filter — matches LocationId OR BusinessLocationId. |
outletId queryCSV of string | no | — | Any-of Lightspeed outlet filter. |
receiptType queryCSV of SALE|REFUND|COPY|ADVANCE|PROFORMA|TRAINING | no | — | Any-of SIGNED receipt type. |
transactionType queryCSV of SALE|REFUND | no | — | Any-of SIGNED direction. With receiptType it selects a TaxCore code — ADVANCE + REFUND is AR. |
receiptCode queryCSV of NS|NR|AS|AR|CS|CR|PS|PR|TS|TR | no | — | Any-of TaxCore receipt code — any mix (NS + AR lists exactly those two). |
status queryCSV of signed|blocked|error | no | — | Any-of status. Figures always count signed receipts; completeness blocked/error. |
search querystring | no | — | Substring over fiscal number, invoice number, buyer name and buyer TIN. |
text/csv; charset=utf-8APIError/api/v1/businesses/:businessId/invoices/payment-records
auth: jwt (administrator | view_invoices | submit_invoices)One row per PAYMENT (signed or not) under the shared reporting filter, with each row's TaxCore receiptCode, countsByReceiptType (computed without the receiptType axis) and countsByCode (without receiptType and transactionType), countsByStatus (without status), totalRows and familyLinkedOnly. invoiceId switches on family mode: every receipt on those invoices and every invoice linked by refund / copy / adjustment, window ignored. Registered before /:invoiceId.
handlers: InvoicesController.listPaymentRecords
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
fromDay queryYYYY-MM-DD | no | — | Preferred window start — a Vanuatu calendar day, resolved server-side to 00:00:00.000 UTC+11. Takes precedence over the ms and ISO pairs. Supply with toDay. |
toDay queryYYYY-MM-DD | no | — | Window end — resolved to 23:59:59.999 UTC+11 on that Vanuatu day. |
dateFromMs queryepoch ms | no | — | Inclusive window start (TAXCORE-701). Used when fromDay/toDay are absent. |
dateToMs queryepoch ms | no | — | Inclusive window end. |
provider queryCSV of Invoices.Source | no | — | Any-of connector filter. |
tillId queryCSV of uuid | no | — | Any-of till filter. |
locationId queryCSV of uuid | no | — | Any-of location filter — matches LocationId OR BusinessLocationId. |
outletId queryCSV of string | no | — | Any-of Lightspeed outlet filter. |
receiptType queryCSV of SALE|REFUND|COPY|ADVANCE|PROFORMA|TRAINING | no | — | Any-of SIGNED receipt type. |
transactionType queryCSV of SALE|REFUND | no | — | Any-of SIGNED direction. With receiptType it selects a TaxCore code — ADVANCE + REFUND is AR. |
receiptCode queryCSV of NS|NR|AS|AR|CS|CR|PS|PR|TS|TR | no | — | Any-of TaxCore receipt code — any mix (NS + AR lists exactly those two). |
status queryCSV of signed|blocked|error | no | — | Any-of status. Figures always count signed receipts; completeness blocked/error. |
search querystring | no | — | Substring over fiscal number, invoice number, buyer name and buyer TIN. |
invoiceId queryCSV of uuid (≤ 20) | no | — | Family mode — makes the window optional and ignored. |
offset queryinteger ≥ 0 | no | — | Default 0. |
limit queryinteger 1–200 | no | — | Default 50. |
sortBy querypaymentDate | amount | no | — | Default paymentDate; InvoicePaymentId is the tie-break. |
sortDirection queryasc | desc | no | — | Default desc. |
printable querya4 | slip | no | — | Only payments the receipts bundle can render in this format, so totalRows is the bundle page count. |
APIResponseDataObject<ReceiptRecordsResponse>APIError/api/v1/businesses/:businessId/invoices/payment-records/export.csv
auth: jwt (administrator | view_invoices | submit_invoices)Every payment record the filter matches, streamed in 500-row pages. One column per payment method (a split-tender payment shows each tender under its own method) plus a method text column; payment dates in Vanuatu time. Fires RECEIPT_RECORDS_EXPORTED (kind: records, rowCount).
handlers: InvoicesController.exportPaymentRecordsCsv
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
fromDay queryYYYY-MM-DD | no | — | Preferred window start — a Vanuatu calendar day, resolved server-side to 00:00:00.000 UTC+11. Takes precedence over the ms and ISO pairs. Supply with toDay. |
toDay queryYYYY-MM-DD | no | — | Window end — resolved to 23:59:59.999 UTC+11 on that Vanuatu day. |
dateFromMs queryepoch ms | no | — | Inclusive window start (TAXCORE-701). Used when fromDay/toDay are absent. |
dateToMs queryepoch ms | no | — | Inclusive window end. |
provider queryCSV of Invoices.Source | no | — | Any-of connector filter. |
tillId queryCSV of uuid | no | — | Any-of till filter. |
locationId queryCSV of uuid | no | — | Any-of location filter — matches LocationId OR BusinessLocationId. |
outletId queryCSV of string | no | — | Any-of Lightspeed outlet filter. |
receiptType queryCSV of SALE|REFUND|COPY|ADVANCE|PROFORMA|TRAINING | no | — | Any-of SIGNED receipt type. |
transactionType queryCSV of SALE|REFUND | no | — | Any-of SIGNED direction. With receiptType it selects a TaxCore code — ADVANCE + REFUND is AR. |
receiptCode queryCSV of NS|NR|AS|AR|CS|CR|PS|PR|TS|TR | no | — | Any-of TaxCore receipt code — any mix (NS + AR lists exactly those two). |
status queryCSV of signed|blocked|error | no | — | Any-of status. Figures always count signed receipts; completeness blocked/error. |
search querystring | no | — | Substring over fiscal number, invoice number, buyer name and buyer TIN. |
invoiceId queryCSV of uuid (≤ 20) | no | — | Family mode. |
sortBy querypaymentDate | amount | no | — | Default paymentDate. |
sortDirection queryasc | desc | no | — | Default asc. |
text/csv; charset=utf-8APIError/api/v1/businesses/:businessId/invoices/receipts
auth: jwt (administrator | view_invoices | submit_invoices)One merged PDF of signed receipts. Body is exactly one of { invoiceIds (1–20), includeLinked? } | { paymentIds (1–40) } | { filter: ReceiptRecordsQuery }, plus format (slip | a4) and order (paymentDate | invoice). Capped at 40 rendered pages, counted before rendering. X-Receipts-Rendered / X-Receipts-Skipped headers carry the counts. Fires INVOICE_RECEIPTS_DOWNLOADED with variant and pages.
handlers: InvoicesController.getReceiptsBundle
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
body bodyReceiptsBundleRequest | yes | — | See summary. |
application/pdfAPIError/api/v1/businesses/:businessId/invoices
auth: jwt (administrator | view_invoices | submit_invoices)Paginated invoice list for the business. RTK infinite-query compatible. Returns invoices in the same shape as the single-invoice GET (with embedded payments[] and line-items omitted).
handlers: InvoicesController.list
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
offset queryinteger | no | 0 | Pagination offset. min 0. |
limit queryinteger | no | 50 | Page size. min 1, max 200. |
APIResponseDataList<InvoiceDTO>/api/v1/businesses/:businessId/invoices/:invoiceId
auth: jwt (administrator | view_invoices | submit_invoices)Fetch a single invoice with its line items and payments[] embedded. Cross-tenant probing returns 404 since the repo filters by businessId.
handlers: InvoicesController.getById
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Invoice UUID. |
APIResponseDataObject<InvoiceDTO>APIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments
auth: jwt (administrator | view_invoices | submit_invoices)List every payment under a single invoice. Returns the same payments[] array embedded on GET /invoices/:invoiceId plus per-payment fiscal data (FiscalInvoiceNumber, FiscalTimestamp, etc.). Ordered by PaymentDate ASC, CreatedAt ASC. Lets the FE refresh only the payments list after a per-payment action without re-fetching the parent invoice.
handlers: InvoicesController.listPayments
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Parent invoice UUID. Existence under businessId is verified before payments are listed (prevents cross-tenant probing of payment IDs). |
APIResponseDataObject<GetInvoicePaymentsResponse>APIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId
auth: jwt (administrator | view_invoices | submit_invoices)Direct drill-down for a single InvoicePayments row. Returns the same InvoicePaymentDTO shape that appears inside the parent invoice's payments[] array. Returns 404 when the payment doesn't belong to the (invoiceId, businessId) pair — protects against cross-tenant or cross-invoice probing.
handlers: InvoicesController.getPaymentById
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Parent invoice UUID. |
paymentId pathuuid | yes | — | Payment UUID. Must belong to invoiceId under businessId. |
APIResponseDataObject<GetInvoicePaymentByIdResponse>APIError/api/v1/businesses/:businessId/invoices/reprocess-unmapped
auth: jwt (administrator)Re-sync blocked invoices. Re-evaluates the business's blocked payments in sequential passes: tax mapping (MISSING_TAX_MAPPING), credit notes waiting on their original (REFERENT_NOT_FISCALISED / REFERENT_DOCUMENT_MISSING), currency (CURRENCY_MISMATCH), then each connector's location / certificate pass (http, xero, lightspeed-x, hike, amicus, sage100, eposnow, sage200evolution, atrex). Released payments are dispatched as fiscalisation jobs of at most 20. `source` limits the run to one provider's invoices; `invoiceIds` limits it to a selection; `tenantId` (with `source=xero`) to one Xero organisation. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is an `APIResponseDataObject<ReprocessSelectionResult>` (`reprocessed`, `nowEligible`, `nowEligibleInvoices`, `nowEligibleQuotes`, `stillBlocked`, `autoFiscalisationJobIds`, `notResyncable`).
handlers: InvoicesController.reprocessUnmapped
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
source queryInvoiceSource | no | — | Only this provider's blocked invoices. |
tenantId querystring | no | — | With `source=xero`: only this Xero organisation's blocked invoices. |
invoiceIds bodyuuid[] (1-20) | no | — | Only these invoices (the home dashboard selection). Body may be omitted. |
APIResponseDataObject<BackgroundRunAcceptedDTO>APIError/api/v1/businesses/:businessId/invoices/cancel-bulk
auth: jwt (administrator | submit_invoices)Bulk cancel up to MAX_PAYMENTS_PER_FISCALISATION_JOB fiscalised payments in one job. Builds a cancellation row per valid payment, then dispatches every freshly-inserted cancellation in a single FiscalisationJob so the client polls one jobId. Invalid IDs come back in blocked[]; IDs whose original already has a cancellation in flight come back in inFlight[]. Fires INVOICE_PAYMENT_CANCELLATION_REQUESTED audit per dispatched payment.
handlers: InvoicesController.cancelBulk
Request body type: CancelInvoicesBulkBody
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
paymentIds bodyuuid[] | yes | — | 1..MAX_PAYMENTS_PER_FISCALISATION_JOB payment UUIDs to cancel. Validated by CancelInvoicesBulkBodySchema. |
APIResponseDataObject<BulkCancelInvoiceResponse>APIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/cancel
auth: jwt (administrator | submit_invoices)Cancel a single fiscalised payment. Issues a cancellation row (Sale → Refund / Refund → Sale) with the same line items but BuyerTin set to the seller's TIN and ReferentDocumentNumber pointing back at the original SDC fiscal number, then dispatches it through the standard fiscalisation pipeline. Poll the returned jobId — on success the original payment is marked cancelled by the consumer. Fires INVOICE_PAYMENT_CANCELLATION_REQUESTED audit.
handlers: InvoicesController.cancel
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Parent invoice UUID. |
paymentId pathuuid | yes | — | Payment UUID to cancel. Must be fiscalised and not already in flight. |
APIResponseDataObject<CancelInvoiceResponse>APIErrorAPIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/copy
auth: jwt (administrator | submit_invoices)Per-payment Copy. Inserts a new Invoices row with InvoiceType='COPY', CopiesInvoiceId pointing at the source invoice, totals scaled to the source payment's amount, plus a synthetic InvoicePayments row carrying CopiesPaymentId. Source payment's SDC FiscalInvoiceNumber is the V-SDC referent on the new submission; TransactionType is preserved (Copy of Sale → Sale, Copy of Refund → Refund). One-time per source payment (retry of a failed copy allowed). Immediately dispatches for fiscalisation and fires INVOICE_COPY_REQUESTED audit.
handlers: InvoicesController.copy
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Source invoice UUID. |
paymentId pathuuid | yes | — | Source payment UUID. Must be a fiscalised payment under a supported invoice type. |
APIResponseDataObject<CopyInvoiceResponse>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/refund
auth: jwt (administrator | submit_invoices)Per-payment Refund. Inserts a new Invoices row with TransactionType='REFUND' and InvoiceType inherited from the source (Normal → Normal Refund, Advance → Advance Refund), RefundsInvoiceId pointing at the source invoice, totals scaled to the source payment's amount, plus a synthetic InvoicePayments row carrying RefundsPaymentId. Source payment's SDC FiscalInvoiceNumber is the V-SDC referent on the new submission. Only valid on a fiscalised SALE payment under a Normal or Advance invoice — refunding a refund is rejected. One-time per source payment (retry of a failed refund allowed). FE button is hidden on Normal/Advance (only surfaced for PROFORMA quotes); backend stays permissive so the service-layer REFUNDABLE_TYPES guard remains the source of truth. Fires INVOICE_REFUND_REQUESTED audit.
handlers: InvoicesController.refund
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Source invoice UUID. |
paymentId pathuuid | yes | — | Source SALE payment UUID. Must be fiscalised and not already refunded. |
APIResponseDataObject<RefundPaymentResponse>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/invoice-pdf
auth: jwt (administrator | view_invoices | submit_invoices)Render the fiscal receipt of one signed payment as an inline PDF. `format=a4` (default) is the branded A4 invoice rebuilt from the persisted invoice; `format=slip` renders the thermal slip from the signed fiscal journal.
handlers: InvoicesController.getInvoicePdf
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Invoice UUID. |
paymentId pathuuid | yes | — | Payment UUID under that invoice. |
format queryslip | a4 | no | a4 | Document layout. |
application/pdfAPIErrorAPIError/api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/send-receipt-email
auth: jwt (administrator | submit_invoices)Email the fiscalised receipt of one payment to the customer and/or the business. At least one address is required; addresses are not persisted. The PDF attachment uses the business's per-connector receipt email format. Delivery is fire-and-forget: responds 202 immediately and audits `RECEIPT_EMAIL_SENT` or `RECEIPT_EMAIL_FAILED` once the send settles.
handlers: InvoicesController.sendReceiptEmail
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
invoiceId pathuuid | yes | — | Invoice UUID. |
paymentId pathuuid | yes | — | Payment UUID under that invoice. |
customerEmail bodystring (email) | null | yes | — | Customer address, or null to skip. |
businessEmail bodystring (email) | null | yes | — | Business copy address, or null to skip. At least one of the two must be non-null. |
APIResponseDataObject<{ accepted: true }>APIErrorAPIError/api/v1/businesses/:businessId/invoices/reprocess-credit-notes
auth: jwt (administrator)Re-evaluate every REFUND payment blocked by REFERENT_NOT_FISCALISED or REFERENT_DOCUMENT_MISSING. Where the original invoice is now fiscalised, replaces the stored referent document number with the V-SDC fiscal invoice number and marks the payment eligible. Does not dispatch for fiscalisation itself. Idempotent.
handlers: InvoicesController.reprocessCreditNotes
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<ReprocessCreditNotesResult>APIError