Reporte general de ventas
POST /api/reports/general-sale
Autenticación: Bearer del usuario del tenant (Authorization: Bearer <api_token>).
Devuelve los totales de ventas del periodo (comprobantes, notas de venta y pedidos) y los datos para un gráfico, más un enlace para descargar el reporte en PDF.
Quién puede usarlo: cualquier usuario autenticado (administrador o vendedor).
Formato de respuesta: heredado {data: ...} sin campo success. Además de data trae download_report (URL del PDF).
Cuerpo (JSON):
| Campo | Tipo | Obligatorio | Descripción / valores permitidos |
|---|---|---|---|
period |
string | Sí | month, between_months, date o between_dates. |
month_start |
string | Con month / between_months |
Mes inicial YYYY-MM. |
month_end |
string | Con between_months |
Mes final YYYY-MM. |
date_start |
date | Con date / between_dates |
Fecha inicial YYYY-MM-DD. |
date_end |
date | Con between_dates |
Fecha final YYYY-MM-DD. |
establishment_id |
integer | No | Establecimiento. Por defecto el del usuario autenticado. |
totals.total incluye comprobantes, notas de venta y pedidos (total_order_notes); el gráfico no incluye pedidos.
Cuerpo
Content-Type: application/json
{
"period": "month",
"month_start": "2026-11",
"month_end": null,
"date_start": null,
"date_end": null,
"establishment_id": "1"
}
Respuestas
200 — Totales
{
"data": {
"totals": {
"total_documents": "1520.40",
"total_sale_notes": "380.00",
"total": "2050.40",
"total_order_notes": 150.0
},
"graph": {
"labels": [
"01",
"02",
"03"
],
"datasets": [
{
"label": "Total notas de venta",
"data": [
120.0,
80.0,
180.0
],
"backgroundColor": "rgba(254, 0, 108, .1)",
"borderColor": "rgb(254, 0, 108)",
"borderWidth": 2,
"fill": true,
"lineTension": 0.3,
"pointRadius": 1
}
]
}
},
"download_report": "https://empresa.dominio/report-app/pdf-general-sale?period=month&month_start=2026-11&establishment_id=1"
}
Pruébalo
Prueba este endpoint con tu empresa y tu token: elige la URL en Servers, pega el token en Authorize y haz clic en Try it out.