Skip to main content
Extras are add-ons attached to a specific item. They can reference an ingredient from the inventory (ingrediente_id) or be entered as free text (descripcion). Each extra has a price and quantity, and its cost is rolled up into the parent item’s subtotal.

POST /api/transacciones/:id/items/:itemId/extras

Adds an extra to an item. You must supply either ingrediente_id or descripcion — not both, not neither. Authentication: Required Required role: Any authenticated user

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes
Content-Typeapplication/jsonYes

Path parameters

ParameterTypeDescription
idnumberThe transaction ID
itemIdnumberThe item ID

Body

ingrediente_id
string
ID of a known inventory ingredient. Mutually exclusive with descripcion.
descripcion
string
Free-text description of the extra (e.g. "Extra queso"). Mutually exclusive with ingrediente_id.
You must provide exactly one of ingrediente_id or descripcion. Providing neither returns a 400 error.
precio
number
required
Price of the extra. Must be ≥ 0.
cantidad
number
Quantity of the extra. Defaults to 1. Must be ≥ 0.01.

Response

Success (201)

id
number
Auto-generated extra ID.
detalle_item_id
number
Parent item ID.
ingrediente_id
string | null
Associated ingredient ID, if provided.
descripcion
string | null
Free-text description, if provided.
precio
string
Price as a decimal string.
cantidad
string
Quantity as a decimal string.

Error responses

StatusDescription
400Neither ingrediente_id nor descripcion provided
401Unauthorized
404Transaction, item, or ingredient not found

GET /api/transacciones/:id/items/:itemId/extras

Returns all active extras for the specified item, enriched with the ingredient name when an ingrediente_id is present. Authentication: Required Required role: Any authenticated user

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes

Path parameters

ParameterTypeDescription
idnumberThe transaction ID
itemIdnumberThe item ID

Response

Success (200)

An array of extra objects:
[].id
number
Extra ID.
[].detalle_item_id
number
Parent item ID.
[].ingrediente_id
string | null
Ingredient ID.
[].descripcion
string | null
Free-text description.
[].nombre
string
Resolved ingredient name, or the descripcion value if no ingredient.
[].precio
string
Price as a decimal string.
[].cantidad
string
Quantity as a decimal string.

DELETE /api/transacciones/:id/items/:itemId/extras/:extraId

Soft-deletes an extra. The parent item’s subtotal and the transaction’s monto_total are recalculated automatically. Authentication: Required Required role: Any authenticated user

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes

Path parameters

ParameterTypeDescription
idnumberThe transaction ID
itemIdnumberThe item ID
extraIdnumberThe extra ID

Response

Success (200)

message
string
Confirmation message.

Error responses

StatusDescription
401Unauthorized
404Transaction, item, or extra not found

Example

# Add a free-text extra to item 7 on transaction 42
curl -X POST http://localhost:3000/api/transacciones/42/items/7/extras \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"descripcion": "Extra queso", "precio": 5.00, "cantidad": 1}'
{
  "id": 3,
  "detalle_item_id": 7,
  "ingrediente_id": null,
  "descripcion": "Extra queso",
  "precio": "5.00",
  "cantidad": "1",
  "creado_en": "2026-03-18T14:32:00.000Z",
  "actualizado_en": "2026-03-18T14:32:00.000Z",
  "borrado_en": null
}
# Add an ingredient-linked extra
curl -X POST http://localhost:3000/api/transacciones/42/items/7/extras \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ingrediente_id": "ing_abc123", "precio": 3.50, "cantidad": 2}'
# List all extras on item 7
curl http://localhost:3000/api/transacciones/42/items/7/extras \
  -H "Authorization: Bearer $TOKEN"
# Remove extra 3
curl -X DELETE http://localhost:3000/api/transacciones/42/items/7/extras/3 \
  -H "Authorization: Bearer $TOKEN"

Build docs developers (and LLMs) love