Skip to main content

POST /api/transacciones

Creates a new transaction. If a cash register (caja) is currently open, it is automatically associated with the transaction. If you provide a caja_id, it must match the currently open register. Authentication: Required Required role: Any authenticated user
If a cash register (caja) is currently open, the transaction is automatically linked to it even if you omit caja_id. Transactions created without an open register will have caja_id: null and any payments recorded will not be tallied to a shift — open the register first for accurate daily reconciliation.

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes
Content-Typeapplication/jsonYes

Body

nro_reg
number
required
Sequential registration number. Must be ≥ 1.
concepto
string
required
Description of the order (e.g. "Pedido mesa 5").
tipo
string
Transaction type. Defaults to "venta".
mesa
string
Service location descriptor: "Mesa 5", "Para llevar", "Delivery", etc.
cliente
string
Customer name.
estado
string
Initial status. One of pendiente, abierto, cerrado. Defaults to pendiente.
caja_id
number
ID of the cash register to associate. If omitted, the currently open register is used automatically.

Response

Success (201)

id
number
Auto-generated transaction ID.
nro_reg
number
Sequential registration number.
concepto
string
Transaction description.
tipo
string
Transaction type.
mesa
string | null
Service location.
cliente
string | null
Customer name.
estado
string
Current status (pendiente, abierto, or cerrado).
estado_cocina
string
Kitchen status (pendiente or terminado).
monto_total
string
Total amount as a decimal string. Starts at "0".
monto_pagado
string
Amount already paid as a decimal string. Starts at "0".
monto_pendiente
string
Calculated outstanding amount (monto_total - monto_pagado).
caja_id
number | null
Associated register ID, if any.
usuario_id
string
ID of the user who created the transaction.
fecha
string
Creation date (YYYY-MM-DD).
hora
string
Creation timestamp with timezone.
creado_en
string
Full creation timestamp.
actualizado_en
string
Last update timestamp.

Error responses

StatusDescription
400caja_id does not match the currently open register
401Unauthorized

Example

curl -X POST http://localhost:3000/api/transacciones \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"nro_reg": 1, "concepto": "Pedido mesa 5", "mesa": "Mesa 5", "cliente": "Juan Pérez"}'
{
  "id": 42,
  "nro_reg": 1,
  "concepto": "Pedido mesa 5",
  "tipo": "venta",
  "mesa": "Mesa 5",
  "cliente": "Juan Pérez",
  "estado": "pendiente",
  "estado_cocina": "pendiente",
  "monto_total": "0",
  "monto_pagado": "0",
  "monto_pendiente": "0.00",
  "caja_id": 3,
  "usuario_id": "usr_1234567890",
  "fecha": "2026-03-18",
  "hora": "2026-03-18T14:30:00.000Z",
  "creado_en": "2026-03-18T14:30:00.000Z",
  "actualizado_en": "2026-03-18T14:30:00.000Z",
  "borrado_en": null
}

Build docs developers (and LLMs) love