The Tickets and Invoices API handles two distinct document types that serve different fiscal purposes. A ticket is a simple sale receipt tied to an order: it carries a sequential daily counter (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt
Use this file to discover all available pages before exploring further.
numero_diario) and a human-readable number formatted as YYYYMMDD-NNNN. A factura is a formal tax invoice that additionally records the customer’s NIT or CI (nit_ci) and legal name (razon_social), is numbered sequentially per calendar year in the format YYYY-NNNNNN, and breaks the total into subtotal, tax, and total fields. Both documents are permanently associated with an order — each order may have at most one ticket and one factura. All endpoints for both resources require the admin or cajero role.
Tickets
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/tickets | admin, cajero | List all tickets (optional ?fecha= filter) |
GET | /api/tickets/hoy | admin, cajero | Tickets issued today |
GET | /api/tickets/pedido/:pedido_id | admin, cajero | Get the ticket for a specific order |
GET | /api/tickets/numero/:numero | admin, cajero | Get a ticket by its formatted number |
GET | /api/tickets/:id | admin, cajero | Get a ticket by database ID |
POST | /api/tickets | admin, cajero | Generate a ticket for a paid order |
GET /api/tickets
Returns all tickets joined with their parent order, table, and waiter information. Pass?fecha=YYYY-MM-DD to filter by issue date.
Query parameters
Filter tickets by issue date in
YYYY-MM-DD format. Omit to return all tickets.GET /api/tickets/hoy
Returns every ticket issued today, ordered bynumero_diario ascending. Equivalent to GET /api/tickets?fecha=<today>.
GET /api/tickets/pedido/:pedido_id
Returns the ticket for the given order, including the full line-item details (detalles array). Returns 404 if the order has no ticket.
GET /api/tickets/numero/:numero
Looks up a ticket by its formatted number (e.g.,20250115-0001). Returns full ticket details with line items.
GET /api/tickets/:id
Fetches a single ticket by its primary key, including line-item details. Returns404 if not found.
POST /api/tickets
Generates a new ticket for an order. The endpoint verifies that no ticket already exists for the order before creating one.Request body
The ID of the order for which to generate the ticket.
Response
"Ticket generado correctamente" on success.The newly created ticket.
201 Created:
Ticket number format
Ticket numbers follow the patternYYYYMMDD-NNNN:
MAX(numero_diario) for the current date, so it always starts at 0001 on the first ticket of each day.
Error responses
| Status | Condition |
|---|---|
400 | pedido_id not provided |
400 | Order already has a ticket — returns { message, ticket } with the existing ticket |
404 | Order not found |
500 | Database or internal error |
Invoices (Facturas)
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/invoices | admin, cajero | List all invoices (optional ?fecha= filter) |
GET | /api/invoices/hoy | admin, cajero | Invoices issued today |
GET | /api/invoices/resumen | admin, cajero | Today’s invoice summary totals |
GET | /api/invoices/pedido/:pedido_id | admin, cajero | Get the invoice for a specific order |
GET | /api/invoices/numero/:numero | admin, cajero | Get an invoice by formatted number |
GET | /api/invoices/:id | admin, cajero | Get an invoice by database ID |
POST | /api/invoices | admin, cajero | Generate an invoice for a paid order |
GET /api/invoices
Returns all invoices joined with their parent order and table. Pass?fecha=YYYY-MM-DD to filter by issue date.
Filter invoices by issue date in
YYYY-MM-DD format.GET /api/invoices/hoy
Returns every invoice issued today. Useful for daily billing reports.GET /api/invoices/resumen
Returns aggregate totals for today’s invoices: count, subtotal sum, tax sum, and grand total.GET /api/invoices/pedido/:pedido_id
Returns the invoice for the given order with full line-item details. Returns404 if no invoice exists for the order.
GET /api/invoices/numero/:numero
Looks up an invoice by its formatted number (e.g.,2025-000004). Returns full invoice details with line items.
GET /api/invoices/:id
Fetches a single invoice by its primary key, including thedetalles array of line items.
POST /api/invoices
Generates a new tax invoice for an order. The endpoint calculates the subtotal from the order’sdetalle_pedido rows and assigns the next sequential invoice number for the current year.
Request body
The ID of the order to invoice.
Taxpayer identification number (NIT) or national identity card number (CI) of the customer.
Legal name or business name of the customer as it should appear on the invoice.
Optional fiscal control code, if your billing system provides one. Stored on the invoice record.
Optional URL for a QR verification image to be printed on the invoice. Stored on the invoice record.
Response
"Factura generada correctamente" on success.The newly created invoice.
201 Created:
Invoice number format
Invoice numbers follow the patternYYYY-NNNNNN:
MAX(SUBSTRING_INDEX(numero_factura, '-', -1)) from existing invoices for the current year and adding 1.
Error responses
| Status | Condition |
|---|---|
400 | Missing pedido_id, nit_ci, or razon_social |
400 | Order already has an invoice — returns { message, factura } with the existing one |
404 | Order not found |
500 | Database or internal error |
Both tickets and invoices can also be auto-generated during payment processing by passing
generar_ticket: true or generar_factura: true to POST /api/payments. Documents are created only when estado_pago transitions to pagado in that same transaction.