The Orders API manages the full lifecycle of a restaurant order — from the moment a waiter opens a ticket at a table to delivery and payment. It also powers the dashboard’s sales statistics panel. All endpoints require a valid JWT in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <token> header. Role restrictions on individual endpoints are noted below.
Endpoint overview
| Method | Path | Roles |
|---|---|---|
GET | /api/orders | All authenticated |
GET | /api/orders/stats | All authenticated |
GET | /api/orders/:id | All authenticated |
POST | /api/orders | admin, mesero, cajero |
PUT | /api/orders/:id/items | admin, mesero |
PUT | /api/orders/:id/status | All authenticated |
DELETE | /api/orders/:id/items/:itemId | admin, mesero |
GET /api/orders
Returns a flat array of all orders with their line items and calculated totals, sorted by creation time descending.GET /api/orders/stats
Returns aggregated sales statistics used by the management dashboard. Query parameters| Parameter | Type | Description |
|---|---|---|
range | week | month | week (default) returns the last 7 days; month returns all days in the current calendar month. |
Stats response fields
Array of daily sales totals sorted chronologically.
Up to 5 best-selling products over the last 7 days.
Revenue breakdown by product category for today.
GET /api/orders/:id
Returns a single order with full line-item details.404 if the order does not exist.
POST /api/orders
Creates a new order, inserts line items, optionally records a payment method, and sets the table status toocupada. If a reservation exists for the same table today, it is automatically linked and marked completada.
Roles: admin, mesero, cajero
Request body
ID of the table being served. The table must exist. After creation the table’s
estado is set to ocupada.ID of the waiter (usuario) responsible for this order.
One or more line items. Each element must include
producto_id and cantidad. Items with missing fields are silently skipped.General notes for the entire order.
ID of an existing customer record to associate with this order.
ID of an existing reservation to link. If omitted, the server looks for any
confirmada or pendiente reservation for this table today and links it automatically.Payment method. Accepted values:
efectivo, tarjeta, qr, transferencia. When provided a payment record is created immediately and estado_pago is set to pagado.Example request
Example response
PUT /api/orders/:id/items
Adds new line items to an existing order or updates the quantity of existing ones. Existing items are identified by theirid field; objects without id are inserted as new items.
Roles: admin, mesero
PUT /api/orders/:id/status
Updates the service status of an order. When the order transitions todelivered or cancelled, the associated table’s estado is automatically set back to libre. A notification is also dispatched to the relevant staff role.
Roles: All authenticated
Request body
English status string. Accepted values and their internal equivalents:
English (status) | Spanish (estado_servicio) | Triggers table libre |
|---|---|---|
pending | pendiente | No |
preparing | preparando | No |
ready | listo | No |
delivered | entregado | Yes |
cancelled | cancelado | Yes |
Example request
DELETE /api/orders/:id/items/:itemId
Removes a single line item from an order. Roles:admin, mesero
404 if itemId does not exist.
Order response object
The following fields are returned byGET /api/orders and GET /api/orders/:id.
Unique order ID.
ID of the table.
Human-readable table number.
Linked customer ID, if any.
Linked customer’s name, if any.
Linked reservation ID, if any.
ID of the assigned waiter.
Full name of the assigned waiter.
Current service status in Spanish:
pendiente, preparando, listo, entregado, or cancelado.Payment status:
pendiente, pagado, or anulado.Payment method recorded, if paid.
General order notes.
Sum of all line-item subtotals.
Same as
subtotal (tax not applied at the API level).Creation time formatted as
HH:MM in es-ES locale.Full ISO timestamp of order creation.
English-mapped service status:
pending, preparing, ready, delivered, or cancelled.Line items belonging to this order.