Eme2App’s reporting module gives you a consolidated view of your business finances through six report types covering invoices, quotes, expenses, VAT obligations, and treasury. Every report is available as a paginated JSON response for in-app display, and can be downloaded as a formatted Excel (.xlsx) or PDF file with a single extra path segment. Reports share a common set of filter parameters — date ranges, client, status, and more — so the same query string that populates a chart in the UI can be reused directly in a download request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eme2dev/Eme2App/llms.txt
Use this file to discover all available pages before exploring further.
Authentication and authorization
All report endpoints are mounted under/api/informes and share the following requirements (applied globally in server.js):
- Valid JWT bearer token in the
Authorizationheader. - Active empresa context (
verificarEmpresaActiva). - Role
adminoruser.
Shared filter parameters
All report endpoints —
/api/informes/facturas, /presupuestos, /gastos, /iva, and /tesoreria — accept the same set of query parameters for filtering. You can combine any subset of them in a single request. Omitting a filter returns all records for the active empresa.| Parameter | Type | Description |
|---|---|---|
fecha_desde | string (date) | Start date in YYYY-MM-DD format. |
fecha_hasta | string (date) | End date in YYYY-MM-DD format. |
year | integer | Filter by calendar year (e.g. 2024). Can be combined with months. |
months | string | Comma-separated month numbers (e.g. 1,2,3 for Q1). Requires year. |
estado | string | Document status (e.g. emitida, pagada, pendiente, vencida). |
cliente_id | string (UUID) | Filter by a specific cliente. |
proveedor_id | string (UUID) | Filter by a specific proveedor (used in gastos report). |
serie | string | Invoice series code. |
iva_id | string (UUID) | Filter by a specific IVA rate ID. |
pagina | integer | Page number (1-based). Defaults to 1. |
pagina_size | integer | Records per page. Export endpoints override this to 10000 internally. |
Report endpoints
| Endpoint | Description | Excel | |
|---|---|---|---|
GET /api/informes/facturas | Invoice report with totals, subtotals by state, and chart data | ✅ | ✅ |
GET /api/informes/presupuestos | Quote/estimate report with conversion and status breakdown | ✅ | ✅ |
GET /api/informes/gastos | Purchase expense report grouped by supplier and period | ✅ | ✅ |
GET /api/informes/iva | VAT report: repercutido vs soportado by fiscal period | ✅ | ✅ |
GET /api/informes/tesoreria | Treasury report: outstanding due dates and balances | ✅ | ✅ |
GET /api/informes/tesoreria/flujo | Cash flow timeline: expected vs actual monthly collections | ❌ | ❌ |
GET /api/informes/exportar/:tipo/:formato | Download Excel or PDF for any of the five exportable report types | — | — |
GET /api/informes/facturas
Returns a paginated invoice report for the active empresa. Includes per-page records, subtotals broken down by status, an overall total, summary statistics, and chart-ready data arrays.GET /api/informes/presupuestos
Returns the quote/estimate report. Shares the same response shape as the facturas report, includingchartEstado for visualizing acceptance vs rejection ratios.
GET /api/informes/gastos
Returns the purchase expense report, filterable by supplier (proveedor_id), date range, or IVA rate. Includes chartData for a monthly expense trend visualization.
GET /api/informes/iva
Returns the IVA (VAT) report grouped by fiscal period, with a split between:- Repercutido — output VAT collected on issued invoices (facturas emitidas).
- Soportado — input VAT paid on expenses and purchase invoices (gastos / facturas de compra).
resultado field in the response represents the net VAT position (repercutido minus soportado) for the requested period, which corresponds to what is declared in the quarterly Modelo 303.
The
months parameter is especially useful for the IVA report to isolate individual tax quarters. For Q1 use months=1,2,3, Q2 use months=4,5,6, Q3 use months=7,8,9, and Q4 use months=10,11,12. Always include the year parameter when using months.GET /api/informes/tesoreria
Returns the treasury report, including outstanding due dates (vencimientosPendientes), balance summary, and chart-ready data for cash position visualization.
GET /api/informes/tesoreria/flujo
Returns the cash flow timeline, showing a month-by-month view of expected collections (from pending invoices) versus actual collections (from paid invoices). This is distinct from the base treasury report — it focuses on liquidity projection rather than balance snapshot./tesoreria endpoint for downloadable treasury reports.
Exporting to Excel and PDF
Any of the five main report types can be downloaded as a formatted file by appending/exportar/:tipo/:formato to the base path. The same filter query parameters apply.
:tipo values: facturas | presupuestos | gastos | iva | tesoreria
The server internally overrides pagination to pagina_size=10000 for exports to include the full dataset regardless of what pagina_size the caller sent.
Response headers for Excel:
YYYY-MM-DD format.
Export examples
- Excel
- PDF
Invoice report — full year 2024:IVA report — Q1 2024:Expense report — date range:Treasury report:
Passing an unsupported format
If:formato is anything other than excel or pdf, the API returns:
IVA report — quarterly workflow
Pull the quarterly IVA data
Request the report for the desired quarter using
year and months. For Q2 2024:Review repercutido vs soportado
Check the
repercutido (output VAT from your invoices) and soportado (input VAT from your expenses) totals in the response. The resultado field gives you the net amount to declare.Error responses
All report endpoints return a consistent error envelope:| HTTP status | Cause |
|---|---|
400 | Invalid :tipo or :formato in export URL |
401 | Missing or expired JWT |
403 | Role not admin or user; or no active empresa |
500 | Internal server error (database query or file generation failure) |