Skip to main content

GET /api/caja/resumen

Calculates and returns a real-time summary of the currently open register, including expected cash on hand, QR balance, and a list of all recorded expenses. Use this endpoint to review figures before closing the register. Authentication: Bearer JWT required
Required role: admin or cajero

Request

No parameters or body required.

Response

Success (200)

caja
object
The current open register object (same shape as GET /api/caja/actual)
resumen
object
Calculated financial summary for the current shift
gastos
array
List of all expense records for the current register

Error responses

StatusDescription
400No register is currently open
401Unauthorized — missing or invalid JWT
403Forbidden — role is not admin or cajero

Example

curl http://localhost:3000/api/caja/resumen \
  -H "Authorization: Bearer <token>"
{
  "caja": {
    "id": 1,
    "fecha": "2026-02-04",
    "cerrada": false
  },
  "resumen": {
    "monto_inicial": 500.00,
    "ventas_efectivo": 1200.00,
    "ventas_qr": 800.00,
    "gastos_efectivo": 100.00,
    "gastos_qr": 50.00,
    "efectivo_esperado": 1600.00,
    "total_qr": 750.00,
    "total_del_dia": 2000.00,
    "total_gastos": 150.00
  },
  "gastos": [
    {
      "id": 1,
      "caja_id": 1,
      "usuario_id": "usr_abc123",
      "descripcion": "Compra de gas",
      "metodo_pago": "efectivo",
      "monto": 100.00,
      "creado_en": "2026-02-04T10:00:00.000Z",
      "actualizado_en": "2026-02-04T10:00:00.000Z",
      "borrado_en": null
    }
  ]
}

Build docs developers (and LLMs) love