The Orders API gives a restaurant owner three endpoints to manage the orders their establishment has received. All three require JWT authentication — the server filters every query byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lffiesco-svg/gastromovil/llms.txt
Use this file to discover all available pages before exploring further.
restaurante__propietario=request.user so owners only ever see their own orders. When an order’s status is updated, the server pushes a real-time notification over Django Channels WebSocket groups: the client is always notified, and when an order transitions to enviado an available delivery driver is also notified via their dedicated WebSocket channel.
All three endpoints require a valid JWT Bearer token. Session authentication is accepted but JWT is recommended for programmatic clients. An unauthenticated request returns
401 Unauthorized.Order State Machine
Orders move through the following states. Cancellation is allowed at any point.| Estado | Meaning |
|---|---|
pendiente | Order placed, awaiting restaurant acknowledgement |
aceptado | Restaurant accepted the order |
preparando | Kitchen is actively preparing the order |
enviado | Order dispatched; delivery driver notified |
entregado | Order successfully delivered to the customer |
cancelado | Order cancelled at any stage |
List All Orders
Returns every order ever placed with the authenticated restaurant, sorted from newest to oldest.GET /api/pedidos/
Example Request
Response
200 OK — array of order objects.
Unique database identifier of the order.
Full name of the customer, falling back to their username if no full name is set.
Order total as a decimal string (e.g.
"45000.00").Current status code:
pendiente, aceptado, preparando, enviado, entregado, or cancelado.ISO-8601 date string of when the order was placed (e.g.
"2025-06-15").Optional customer notes (e.g. allergy information or special instructions).
Human-readable delivery address string, or an empty string if none was provided.
List Active Orders
Returns only orders that are still in progress — those with statuspendiente, aceptado, preparando, or enviado. Use this endpoint to power a live kitchen dashboard.
GET /api/pedidos/activos/
Example Request
Response
200 OK — array of active order objects, newest first.
Unique database identifier of the order.
Full name or username of the customer.
Order total as a decimal string.
One of
pendiente, aceptado, preparando, or enviado.Number of distinct product lines in the order.
Delivery address string, or
"Sin dirección" if none was recorded.Optional customer notes.
Update Order Status
Changes the status of a single order and triggers real-time WebSocket notifications to the affected parties.POST /api/pedidos/<pk>/estado/
Path Parameters
Primary key of the order to update. Must belong to the authenticated user’s restaurant.
Request Body
The new status code. Must be one of:
pendiente, aceptado, preparando, enviado, entregado, cancelado.Example Request
WebSocket Notifications
Every status change dispatches a message to the customer’s WebSocket groupcliente_<customer_id> with a human-readable status message:
| Estado | Message sent to client |
|---|---|
aceptado | ✅ ¡Tu pedido fue aceptado! El restaurante lo está preparando. |
preparando | 👨🍳 Tu pedido está siendo preparado. |
enviado | 🛵 ¡Tu pedido está en camino! |
entregado | 🎉 ¡Tu pedido fue entregado! |
cancelado | ❌ Tu pedido fue cancelado. |
estado is set to "enviado", the server additionally looks up the first available delivery driver (estado='disponible', activo=True) and sends a pedido_disponible event to their WebSocket group repartidor_<driver_user_id> containing the order ID, restaurant name, and delivery address.
Responses
200 OK — status updated and notifications dispatched.
400 Bad Request — the supplied status value is not in the valid list.
404 Not Found — order not found or belongs to a different restaurant.