The Orders API is the central nervous system of Tradiciones y Sabores. Every order placed — whether at a table, picked up at the counter, or sent out for delivery — flows through these five endpoints. Orders are created with full client information and line items, automatically generating an associated invoice with 16% IVA. All endpoints are available under bothDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Tradiciones-y-Sabores/llms.txt
Use this file to discover all available pages before exploring further.
/api/ordenes and the /api/pedidos alias for backward compatibility.
GET /api/ordenes
Retrieves all orders in the system, sorted by ticket number descending (newest first). Passestatus=activo to narrow results to only orders that are currently in-progress.
Alias: GET /api/pedidos
Query Parameters
Filter orders by activity state. The only recognized value is
activo, which returns only orders whose estado_orden is recibido or preparando. Omit this parameter to return all orders regardless of status.Response
Returns an array of order objects. Each object contains:Ticket number, mirrored from
num_ticket for compatibility with older clients.Primary identifier for the order. Used as the path parameter in all other endpoints.
ISO 8601 timestamp of when the order was created (UTC), e.g.
"2024-11-15T19:30:00".Full name of the customer. Defaults to
"Cliente General" if the client record is missing.National ID (cédula) of the customer, e.g.
"V-12345678".Phone number on file for the customer.
Order type string. Same value as
tipo_pedido, included for compatibility.Order fulfillment type. One of
mesa, pickup, or delivery.Table number assigned to the order. Same value as
id_mesa.Foreign key referencing the
mesa table. null for pickup and delivery orders.Delivery address. Same value as
direccion_envio. null for mesa and pickup orders.Full delivery address string. Only populated when
tipo_pedido is delivery.Line items attached to the order. Each element contains:
Dish ID, mirrored from
id_plato.Primary key of the
plato record.Dish name resolved from the
plato table. Falls back to "Plato #<id>" if the record is missing.Quantity ordered.
Unit price at the time of ordering, sourced from
plato.precio.Line total (
precio_unitario × cantidad), rounded to two decimal places.Sum of all line item subtotals before tax.
Value-added tax at 16% (
subtotal × 0.16), rounded to two decimal places.Final amount due (
subtotal + iva), rounded to two decimal places.Capitalized status string for display purposes, e.g.
"Recibido". Same state as estado_orden.Lowercase status string. One of
recibido, preparando, listo, or entregado.GET /api/ordenes/
Retrieves a single order by its ticket number. Returns the identical object shape as the list endpoint. Alias:GET /api/pedidos/{num_ticket}
Path Parameters
The ticket number of the order to retrieve. This is the
num_ticket value returned when the order was created.Response
Returns a single order object with all the fields described in GET /api/ordenes. Returns404 with {"detail": "Orden / Pedido no encontrado"} if no order with that ticket number exists.
POST /api/ordenes
Creates a new order. The server resolves or auto-creates the customer bycedula_cliente, assigns estado_orden = recibido, builds DetallePedido rows for every item, and generates an associated Factura with 16% IVA — all in a single atomic transaction.
Alias: POST /api/pedidos
Response status: 201 Created
Request Body
Customer national ID (cédula). Also accepted as
cliente_cedula. Defaults to "V-00000000" if omitted. If a Cliente record with this cédula already exists, it is reused; otherwise a new one is created automatically.Customer full name. Also accepted as
nombre_cliente. Defaults to "Cliente Consumidor". Only used when creating a new client record.Customer phone number. Also accepted as
telefono. Defaults to "0000000000".Fulfillment type. Also accepted as
tipo. Must be one of mesa, pickup, or delivery. Unrecognized values silently fall back to mesa.Table number for dine-in orders. Also accepted as
mesa. Pass null or omit for pickup and delivery.Full delivery address. Also accepted as
direccion. Required when tipo_pedido is delivery; ignored for other types.Line items for the order. Also accepted as
detalles. Each element must contain:ID of the dish being ordered. Also accepted as
id_producto.Quantity of this dish. Defaults to
1 if omitted.Override unit price. If the
id_plato resolves to a Plato record, plato.precio is used and this field is ignored. Only applied when the plato cannot be found.Response
Returns the full order object (same shape as GET) with the newly assignednum_ticket and invoice totals pre-calculated.
The invoice (
Factura) is created automatically with estado_pago = pendiente. There is no dedicated billing endpoint in the REST API — to update payment status (e.g. to pagado or anulado), update the factura.estado_pago field directly in the database.PUT /api/ordenes/
Updates theestado_orden of an existing order. This is the primary endpoint used by kitchen and delivery staff to advance an order through its lifecycle.
Alias: PUT /api/pedidos/{num_ticket}
Path Parameters
The ticket number of the order to update.
Request Body
New order status. Also accepted as
Estatus_Orden or estatus. Must be one of:recibido— Order received, awaiting preparationpreparando— Kitchen is actively preparing the orderlisto— Order is ready for pickup or deliveryentregado— Order has been delivered to the customer
Response
Always
"ok" on success.The ticket number of the updated order, echoed back for confirmation.
404 if the order does not exist.
DELETE /api/ordenes/
Permanently removes an order and all of its associated records. The deletion is performed in relational order —Factura first, then DetallePedido rows, then the Pedido itself — to respect foreign key constraints.
Alias: DELETE /api/pedidos/{num_ticket}
This operation is irreversible. The linked invoice and all line items are deleted along with the order. Consider updating
estado_orden to entregado instead of deleting if you need an audit trail.Path Parameters
The ticket number of the order to delete.
Response
Always
"deleted" on success.The ticket number of the deleted order, echoed back for confirmation.
404 with {"detail": "Orden / Pedido no encontrado"} if no order with that ticket number exists.