Skip to main content

POST /api/caja/cerrar

Closes the currently open register. Provide a physical count of all denominations present in the drawer; the server computes monto_contado, compares it against the expected cash amount, and returns a reconciliation result. Authentication: Bearer JWT required
Required role: admin or cajero
The monto_contado is derived entirely from the denomination fields — you do not pass it directly. All denomination fields are required (pass 0 for empty denominations).

Request

Body

b200
integer
required
Number of 200 BOB bills counted at closing (min: 0)
b100
integer
required
Number of 100 BOB bills counted at closing (min: 0)
b50
integer
required
Number of 50 BOB bills counted at closing (min: 0)
b20
integer
required
Number of 20 BOB bills counted at closing (min: 0)
b10
integer
required
Number of 10 BOB bills counted at closing (min: 0)
b5
integer
required
Number of 5 BOB bills counted at closing (min: 0)
m2
integer
required
Number of 2 BOB coins counted at closing (min: 0)
m1
integer
required
Number of 1 BOB coins counted at closing (min: 0)
m050
integer
required
Number of 0.50 BOB coins counted at closing (min: 0)
m020
integer
required
Number of 0.20 BOB coins counted at closing (min: 0)
m010
integer
required
Number of 0.10 BOB coins counted at closing (min: 0)
cierre_obs
string
Optional closing observations (e.g. “Cierre normal sin novedades”)

Response

Success (200)

caja_id
number
ID of the register that was closed
fecha
string
Date of the closed register (YYYY-MM-DD)
monto_contado
number
Physical cash counted, computed from the submitted denomination counts
efectivo_esperado
number
Expected cash: monto_inicial + ventas_efectivo − gastos_efectivo
diferencia
number
monto_contado − efectivo_esperado. Negative means a shortage, positive means a surplus.
estado_diferencia
string
Reconciliation result. One of: exacto, sobrante, faltante
resumen_completo
object
Full summary object — same shape as the response from GET /api/caja/resumen

Error responses

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

Example

curl -X POST http://localhost:3000/api/caja/cerrar \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "b200": 3,
    "b100": 8,
    "b50": 12,
    "b20": 20,
    "b10": 25,
    "b5": 40,
    "m2": 15,
    "m1": 30,
    "m050": 50,
    "m020": 60,
    "m010": 70,
    "cierre_obs": "Cierre normal sin novedades"
  }'
{
  "caja_id": 1,
  "fecha": "2026-02-04",
  "monto_contado": 1580.00,
  "efectivo_esperado": 1600.00,
  "diferencia": -20.00,
  "estado_diferencia": "faltante",
  "resumen_completo": { "..." : "..." }
}

Build docs developers (and LLMs) love