The Treasury API provides a cross-invoice view of allDocumentation 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.
facturas_vencimientos (due-date instalments) for the active company. Where the Invoices API manages vencimientos in the context of a single factura, Tesorería operates globally — letting finance teams see all pending, overdue, and collected amounts in one place, group disparate vencimientos from multiple invoices into a single instalment for bank remittance, and register or revert collections without leaving the treasury screen. All endpoints require a Bearer token with a valid empresa_id.
Base path: /api/tesoreria
Authorization: Authorization: Bearer <token> with empresa_id embedded.
Endpoint reference
| Method | Path | Description |
|---|---|---|
| GET | /api/tesoreria/resumen | Cash-flow summary (pending, collected, overdue) |
| GET | /api/tesoreria/vencimientos | List due dates with filters |
| PATCH | /api/tesoreria/vencimientos/:id | Inline-update a due date |
| POST | /api/tesoreria/cobros | Register a collection against a vencimiento |
| POST | /api/tesoreria/vencimientos/:id/revertir-cobro | Revert a collection on a vencimiento |
| POST | /api/tesoreria/cobros/agrupar | Group vencimientos into a combined instalment |
| GET | /api/tesoreria/vencimientos/:id/hijos | List child vencimientos of an agrupador |
| POST | /api/tesoreria/vencimientos/:id/desagrupar | Dissolve a grouped vencimiento |
GET /api/tesoreria/resumen
Returns a high-level cash-flow summary for the active company: total amounts pending, collected, and overdue across all confirmed invoices. ResponseSum of all vencimientos in
pending state whose fecha_vencimiento is today or in the future.Sum of all vencimientos in
cobrado state.Sum of all vencimientos in
pending or partial state whose fecha_vencimiento is in the past (overdue).Grand total across all states (
pendiente + cobrado + vencido + partial).GET /api/tesoreria/vencimientos
Returns the full list of due-date instalments for the active company. Supports multiple simultaneous filters. Query parameters| Parameter | Type | Description |
|---|---|---|
fecha_desde | YYYY-MM-DD | Return vencimientos with fecha_vencimiento ≥ this date. |
fecha_hasta | YYYY-MM-DD | Return vencimientos with fecha_vencimiento ≤ this date. |
estado_vencimiento | string | Filter by vencimiento state: pending, partial, cobrado, overdue. |
estado_factura | string | Filter by the parent invoice state: borrador, confirmada, anulada. |
cliente_id | UUID | Restrict to a single client’s vencimientos. |
PATCH /api/tesoreria/vencimientos/:id
Inline-updates a single vencimiento. Onlypending vencimientos can be edited. If the vencimiento already has a cobro, only fecha_vencimiento, notas, and instrumento_id may be changed — the importe is locked to the cobro amount.
New instalment amount. Blocked if the vencimiento has an existing cobro.
New due date.
Replacement payment instrument.
Updated internal note.
POST /api/tesoreria/cobros
Registers a collection against a vencimiento. This is the treasury-level equivalent ofPOST /api/facturas/:id/cobros and supports the same full/partial payment logic.
The vencimiento to pay.
Amount collected. Must be > 0 and ≤ the vencimiento’s
importe.Date the payment was received.
Payment instrument used. Must be active.
Required for partial payments. The due date for the remaining balance instalment. Must be after
fecha_pago.Optional note on the collection.
| Status | mensaje |
|---|---|
| 400 | "Campos requeridos: vencimiento_id, importe, fecha_pago" |
| 400 | "El instrumento de pago es obligatorio" |
| 400 | "El instrumento de pago no existe o no está activo" |
| 400 | "Importe debe ser mayor a 0" |
| 404 | "Vencimiento no encontrado" |
POST /api/tesoreria/vencimientos/:id/revertir-cobro
Reverts all cobros registered on a vencimiento, restoring it topending. Partial-payment rest vencimientos created by this vencimiento’s cobro are also removed.
Response
POST /api/tesoreria/cobros/agrupar
Groups two or more vencimientos (from any invoices) under a single synthetic agrupador vencimiento. This is used for bank remittance runs where multiple client instalments are combined into one bank operation.IDs of the vencimientos to group. Minimum 2 required.
Total amount of the grouped instalment. Typically the sum of the individual vencimiento amounts.
Due date of the agrupador.
Payment instrument for the grouped cobro.
Note on the grouped operation.
Once vencimientos are grouped, their parent invoices cannot be edited, voided, or deleted until the group is dissolved with
POST /api/tesoreria/vencimientos/:id/desagrupar.