The Reports API lets authorized users generate on-demand sales reports with rich filtering options — by date range, client, product, category, or vendor. Reports are persisted in the database so they can be retrieved, shared, and re-exported at any time. Master users can see every report ever generated; other roles see only their own. All endpoints on this API require a valid JWT in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/160906/Yakultt-App/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header, and the account must be active (activo = 1).
GET /api/reportes/opciones
Returns the reference data needed to populate report filter dropdowns — the full list of active clients, products, distinct categories, and active users.Requires:
Authorization: Bearer <token>List of active clients (
id, nombre) for use in the clienteId filter.List of products (
id, nombre, categoria) for use in the productoId filter.Distinct category strings present in the catalog. Blank categories appear as
"General".List of active users (
id, nombre, rol) for use in the vendedorId filter.| Status | Reason |
|---|---|
401 | Missing or invalid Bearer token. |
403 | Account is inactive. |
POST /api/reportes/ventas
Generates a new sales report, persists it, and returns the full report object. IffechaInicio or fechaFin are not provided, they default to the first day of the current month and today respectively.
Requires:
Authorization: Bearer <token>Start of the reporting period in
YYYY-MM-DD format. Defaults to the first day of the current month.End of the reporting period in
YYYY-MM-DD format. Must be on or after fechaInicio. Defaults to today.Optional display name for this report, e.g.
"Reporte Enero 2025". If omitted, a name is generated automatically from the date range.Filter results to orders from a specific client.
Filter results to orders containing a specific product.
Filter results to orders containing products in a specific category.
Filter results to orders created by a specific vendor.
Time-series grouping for the
estadisticas array. One of dia, semana, mes, or anio. Defaults to dia.Auto-generated ID of the stored report.
Display name of the report.
The filter parameters used when generating this report.
The user who generated the report (
id, nombre, rol).ISO 8601 timestamp of report generation.
High-level aggregates for the period.
One row per order in the period.
Up to 10 products ranked by units sold, descending.
Time-series data points grouped by the chosen
agrupacion.Up to 8 vendors ranked by revenue, descending.
| Status | Reason |
|---|---|
400 | fechaInicio or fechaFin is not in YYYY-MM-DD format. |
400 | fechaInicio is after fechaFin. |
401 | Missing or invalid Bearer token. |
403 | Account is inactive. |
GET /api/reportes/historial
Returns up to 50 previously generated reports ordered by creation date descending. Master users see all reports; all other roles see only reports they generated themselves.Requires:
Authorization: Bearer <token>Unique report ID. Use this to retrieve the full report or export it.
Display name of the report.
Start date of the reporting period (
YYYY-MM-DD).End date of the reporting period (
YYYY-MM-DD).Time grouping used:
dia, semana, mes, or anio.Number of orders captured in the report.
Total revenue captured in the report.
Timestamp of when the report was generated, formatted as
YYYY-MM-DD HH:mm.Display name of the user who generated the report.
| Status | Reason |
|---|---|
401 | Missing or invalid Bearer token. |
403 | Account is inactive. |
GET /api/reportes/:id
Retrieves the full stored report object for a given ID. Returns403 if the requesting user does not own the report and is not a Master.
Requires:
Authorization: Bearer <token>Numeric ID of the report to retrieve.
POST /api/reportes/ventas section above.
Errors
| Status | Reason |
|---|---|
401 | Missing or invalid Bearer token. |
403 | The report belongs to another user and the caller is not a Master, or account is inactive. |
404 | No report found with the given ID. |
GET /api/reportes/:id/export/pdf
Downloads the report as a binary PDF file. The response usesContent-Disposition: attachment so browsers prompt the user to save the file.
Requires:
Authorization: Bearer <token>Numeric ID of the report to export.
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="<slug>.pdf" |
| Status | Reason |
|---|---|
401 | Missing or invalid Bearer token. |
403 | The report belongs to another user and the caller is not a Master, or account is inactive. |
404 | No report found with the given ID. |
GET /api/reportes/:id/imprimir
Returns a browser-ready HTML page formatted for printing. Open in a browser tab and the system print dialog launches automatically.Requires:
Authorization: Bearer <token>Numeric ID of the report to render.
| Header | Value |
|---|---|
Content-Type | text/html; charset=utf-8 |
| Status | Reason |
|---|---|
401 | Missing or invalid Bearer token. |
403 | The report belongs to another user and the caller is not a Master, or account is inactive. |
404 | No report found with the given ID. |