Skip to main content
Authentication: Bearer JWT required

GET /api/caja/historial

Returns a list of past register records ordered by date descending. Includes both open and closed registers. Required role: admin

Request

Query parameters

limit
number
Maximum number of records to return (default: 10)

Response

Success (200)

An array of caja_turno objects.
[].id
number
Register ID
[].fecha
string
Register date (YYYY-MM-DD)
[].hora_apertura
string
Opening timestamp (ISO 8601)
[].hora_cierre
string | null
Closing timestamp, or null if still open
[].usuario_id
string | null
ID of the user who opened the register
[].monto_inicial
number
Opening cash amount (BOB)
[].ventas_efectivo
number
Total cash sales for the shift (BOB)
[].ventas_qr
number
Total QR sales for the shift (BOB)
[].total_salidas
number
Total expenses for the shift (BOB)
[].cerrada
boolean
true if the register has been closed
[].cierre_obs
string | null
Closing observations, if any

Error responses

StatusDescription
401Unauthorized — missing or invalid JWT
403Forbidden — role is not admin

Example

curl "http://localhost:3000/api/caja/historial?limit=5" \
  -H "Authorization: Bearer <token>"
[
  {
    "id": 3,
    "fecha": "2026-02-04",
    "hora_apertura": "2026-02-04T08:00:00.000Z",
    "hora_cierre": "2026-02-04T22:00:00.000Z",
    "usuario_id": "usr_abc123",
    "monto_inicial": 500.00,
    "ventas_efectivo": 1200.00,
    "ventas_qr": 800.00,
    "total_salidas": 150.00,
    "cerrada": true,
    "cierre_obs": "Cierre normal"
  }
]

GET /api/caja/:id/detalle

Returns the full detail of a specific register, including a computed financial summary and all associated expenses. Required role: admin or cajero

Request

Path parameters

id
number
required
The numeric ID of the register

Response

Success (200)

Same shape as the response from GET /api/caja/resumen, but for any register (not just the open one).
caja
object
The full caja_turno record for the requested register
resumen
object
Computed financial summary
gastos
array
All expenses recorded against this register

Error responses

StatusDescription
400Register not found
401Unauthorized — missing or invalid JWT
403Forbidden — insufficient role

Example

curl http://localhost:3000/api/caja/3/detalle \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love