The Reports API generates on-demand PDF documents from live restaurant data. Each call toDocumentation 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.
POST /api/reports/generate/:tipo queries the relevant tables, renders a formatted PDF using PDFKit (including the restaurant’s name, address, phone, and NIT from the configuracion table in the header), saves the file to the server’s reports/ directory, and records metadata in the database. The generated PDF can then be downloaded by its assigned ID. All report endpoints are restricted to the admin role.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/reports/tipos | admin | List all valid report types with labels |
GET | /api/reports | admin | List previously generated reports (optional ?tipo= filter) |
GET | /api/reports/:id | admin | Get metadata for a single generated report |
POST | /api/reports/generate/:tipo | admin | Generate a new PDF report |
GET | /api/reports/download/:id | admin | Download the PDF file |
DELETE | /api/reports/:id | admin | Delete the report record and its PDF file |
GET /api/reports/tipos
Returns the list of all valid report type identifiers with their human-readable Spanish labels.Report types
| Type identifier | Label | Description |
|---|---|---|
ventas_diarias | Ventas Diarias | Orders and payment totals for a single day, broken down by payment method |
ventas_periodo | Ventas por Periodo | Day-by-day sales totals over a date range |
productos_mas_vendidos | Productos Más Vendidos | Ranked list of products by quantity sold |
ventas_por_categoria | Ventas por Categoría | Sales grouped by product category |
ocupacion_mesas | Ocupación de Mesas | Order count and revenue per table |
rendimiento_meseros | Rendimiento de Meseros | Orders attended and revenue per waiter |
historial_pedidos | Historial de Pedidos | Full order history with statuses and totals |
historial_pagos | Historial de Pagos | Payment transaction history with methods |
reservas | Reservas | Reservation history with status breakdown |
cierre_caja | Cierre de Caja | Cash-close summary: orders, payment methods, and total collected |
GET /api/reports
Returns metadata for all previously generated reports. Pass?tipo= to filter by report type.
Query parameters
Filter by report type identifier (e.g.,
ventas_diarias). Omit to return all reports.GET /api/reports/:id
Returns the stored metadata for a single report. Theparametros field contains the original generation parameters as a parsed JSON object.
Report primary key.
Report type identifier.
Filename of the stored PDF on the server (used internally).
Original generation parameters as a parsed JSON object.
Start of the report period (
YYYY-MM-DD).End of the report period (
YYYY-MM-DD).Grand total value shown in the report footer, in Bolivianos (Bs).
ISO 8601 timestamp when the report was generated.
POST /api/reports/generate/:tipo
Generates a new PDF report of the specified type. The body parameters vary by report type as described below. On success the PDF is written to disk and a metadata record is inserted; the response includes the new report’sid which can be used to download the file.
Path parameter
One of the ten valid report type identifiers. Passing an unknown type returns
400.Body parameters by report type
Target date in
YYYY-MM-DD format. Used by ventas_diarias and cierre_caja. Defaults to today if omitted.Start of the date range in
YYYY-MM-DD format. Required for ventas_periodo, productos_mas_vendidos, ventas_por_categoria, ocupacion_mesas, rendimiento_meseros, historial_pedidos, historial_pagos, and reservas.End of the date range in
YYYY-MM-DD format. Required alongside fecha_inicio for all period-based report types.Maximum number of rows to include in the
productos_mas_vendidos report. Defaults to 20 if omitted.Parameter matrix
| Report type | fecha | fecha_inicio + fecha_fin | limit |
|---|---|---|---|
ventas_diarias | optional (defaults today) | — | — |
cierre_caja | optional (defaults today) | — | — |
ventas_periodo | — | required | — |
historial_pedidos | — | required | — |
historial_pagos | — | required | — |
reservas | — | required | — |
productos_mas_vendidos | — | required | optional (default 20) |
ventas_por_categoria | — | required | — |
ocupacion_mesas | — | required | — |
rendimiento_meseros | — | required | — |
Response
ID of the newly created report record. Use this to download the PDF.
The report type that was generated.
Server-side filename of the generated PDF.
Grand total value from the report data, in Bolivianos (Bs).
Example — generate ventas_diarias
Example — generate ventas_periodo
GET /api/reports/download/:id
Downloads the PDF file for the given report ID. The response setsContent-Disposition: attachment so browsers will save the file. The downloaded filename follows the pattern <tipo>_<id>.pdf (e.g., ventas_diarias_9.pdf).
404 if either the database record or the physical PDF file cannot be found.
DELETE /api/reports/:id
Deletes the report metadata from the database and removes the PDF file from disk. This action is irreversible.200 OK:
The PDF header content (restaurant name, address, phone, NIT) is read from
GET /api/settings at generation time. Update your restaurant’s configuration before generating reports if the header information is incomplete. See the Settings API for details.