Skip to main content

POST /api/caja/abrir

Opens the cash register for the current shift. You must provide a denomination count; the server computes monto_inicial from those counts automatically. Only one register can be open at a time. Authentication: Bearer JWT required
Required role: admin or cajero

Request

Body

All denomination fields are optional and default to 0. Omitting a field is the same as passing 0.
b200
integer
Number of 200 BOB bills (default: 0, min: 0)
b100
integer
Number of 100 BOB bills (default: 0, min: 0)
b50
integer
Number of 50 BOB bills (default: 0, min: 0)
b20
integer
Number of 20 BOB bills (default: 0, min: 0)
b10
integer
Number of 10 BOB bills (default: 0, min: 0)
b5
integer
Number of 5 BOB bills (default: 0, min: 0)
m2
integer
Number of 2 BOB coins (default: 0, min: 0)
m1
integer
Number of 1 BOB coins (default: 0, min: 0)
m050
integer
Number of 0.50 BOB coins (default: 0, min: 0)
m020
integer
Number of 0.20 BOB coins (default: 0, min: 0)
m010
integer
Number of 0.10 BOB coins (default: 0, min: 0)

Denomination values

FieldValue (BOB)Type
b200200.00Bill
b100100.00Bill
b5050.00Bill
b2020.00Bill
b1010.00Bill
b55.00Bill
m22.00Coin
m11.00Coin
m0500.50Coin
m0200.20Coin
m0100.10Coin

Response

Success (201)

Returns the newly created caja_turno record.
id
number
Auto-incremented register ID
fecha
string
Opening date in YYYY-MM-DD format
hora_apertura
string
Opening timestamp (ISO 8601 with timezone)
hora_cierre
string | null
Closing timestamp — null while the register is open
usuario_id
string
ID of the user who opened the register
monto_inicial
number
Computed opening cash amount in BOB
b200
number
Count of 200 BOB bills recorded at opening
b100
number
Count of 100 BOB bills recorded at opening
b50
number
Count of 50 BOB bills recorded at opening
b20
number
Count of 20 BOB bills recorded at opening
b10
number
Count of 10 BOB bills recorded at opening
b5
number
Count of 5 BOB bills recorded at opening
m2
number
Count of 2 BOB coins recorded at opening
m1
number
Count of 1 BOB coins recorded at opening
m050
number
Count of 0.50 BOB coins recorded at opening
m020
number
Count of 0.20 BOB coins recorded at opening
m010
number
Count of 0.10 BOB coins recorded at opening
ventas_efectivo
number
Cash sales accumulated — 0 at opening
ventas_qr
number
QR sales accumulated — 0 at opening
total_salidas
number
Total expenses recorded — 0 at opening
cerrada
boolean
false — the register is open
cierre_obs
string | null
Closing observations — null while open

Error responses

StatusDescription
401Unauthorized — missing or invalid JWT
403Forbidden — role is not admin or cajero
409A register is already open; close it before opening a new one

Example

curl -X POST http://localhost:3000/api/caja/abrir \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "b200": 2,
    "b100": 1,
    "b50": 2,
    "b20": 5,
    "b10": 10,
    "b5": 10,
    "m2": 20,
    "m1": 20,
    "m050": 10,
    "m020": 10,
    "m010": 10
  }'
{
  "id": 1,
  "fecha": "2026-02-04",
  "hora_apertura": "2026-02-04T08:00:00.000Z",
  "hora_cierre": null,
  "usuario_id": "usr_abc123",
  "monto_inicial": 500.00,
  "b200": 2,
  "b100": 1,
  "b50": 2,
  "b20": 5,
  "b10": 10,
  "b5": 10,
  "m2": 20,
  "m1": 20,
  "m050": 10,
  "m020": 10,
  "m010": 10,
  "ventas_efectivo": 0,
  "ventas_qr": 0,
  "total_salidas": 0,
  "cerrada": false,
  "cierre_obs": null
}

Build docs developers (and LLMs) love