Skip to main content
Invoices are Sintropix’s model for both AR (issued to customers) and AP (received from suppliers). Each Invoice can be booked to a Ledger Entry and, in Chile, linked to a Documento Tributario Electrónico (DTE) issued through the SII. This page covers listing, creating, editing, booking, and DTE-linking Invoices.
Source: apps/erp-backend/src/invoice/invoice.controller.ts. Base path: /api/entities/:entityId/invoices.

GET /invoices

List every Invoice for the Entity, filtered by direction and document kind.
  • Query: ListInvoicesQueryDto (direction, documentKind).
  • Response: array of invoiceSchema.

GET /invoices/pages

Paginated Invoice listing with richer filters. Use this instead of GET /invoices for UI-style pagination.
  • Query: ListInvoiceDocumentsQueryDto (cursor, page size, filters).
  • Response: invoiceDocumentsPageSchema ({ rows, nextCursor }).
The pages route is declared before :invoiceId in the controller so Nest does not read pages as an invoice id. Match that ordering when composing URLs.

POST /invoices

Create an Invoice.
  • Body: CreateInvoiceDto.
  • Response: createInvoiceResultSchema.

GET /invoices/:invoiceId

Return the full Invoice detail (invoiceDetailSchema) including lines, links, and the current book status.

PATCH /invoices/:invoiceId

Partial update.
  • Body: UpdateInvoiceDto.
  • Response: updateInvoiceResultSchema.

DELETE /invoices/:invoiceId

Delete the Invoice. Booked Invoices are refused; unbook first.
  • Response: deleteInvoiceResultSchema.

PUT /invoices/:invoiceId/dte

Attach or replace the linked DTE reference on an Invoice. The DTE record itself is imported through the SII feed; this endpoint only links the id.
  • Body: PutInvoiceDteDto.
  • Response: updateInvoiceResultSchema.

DELETE /invoices/:invoiceId/dte

Remove the DTE link from an Invoice. The DTE record stays; only the association is cleared.
  • Response: updateInvoiceResultSchema.

POST /invoices/:invoiceId/book

Book an existing Invoice to a Ledger Entry using the supplied booking instructions (target counter account, dimensions, partner).
  • Body: BookInvoiceDto.
  • Response: bookInvoiceResultSchema.

Status codes

Unverified: exact fields of CreateInvoiceDto, BookInvoiceDto, and PutInvoiceDteDto. Refer to the DTOs alongside the controller and @sintropix/api-contract for authoritative shapes.