Saltar para o conteúdo
tablezio

Orders

Orders

The Order resource represents a single check — dine-in, takeout or delivery. Orders move through a defined lifecycle (draft → placed → preparing → ready → served → completed) and emit webhooks on every transition.

List orders

GET /v1/orders Escopo: orders:read

Returns orders for the authenticated restaurant, newest first. Combine cursor pagination, status / type filters and date ranges to slice the history.

Parâmetros de consulta

limitintegerOpcional

Page size, default 10, max 100.

starting_afterstringOpcional

Cursor from a previous response. Returns items older than this cursor.

ending_beforestringOpcional

Cursor from a previous response. Returns items newer than this cursor.

statusstringOpcional

Filter by status.

draftplacedpreparingreadyservedcompletedcancelled
typestringOpcional

Filter by order type.

dine_intakeoutdelivery
tablestringOpcional

Filter to a specific table id (tbl_…).

created.gteinteger (unix)Opcional

Only return orders created at or after this timestamp.

created.lteinteger (unix)Opcional

Only return orders created at or before this timestamp.

expandstring[]Opcional

Inline references. Supported: table, server, items.menu_item.

Requisição

curl 'https://api.tablezio.com/v1/orders?limit=2&status=placed' \
  -H 'X-API-Key: tbz_…'

Resposta

application/json
{
  "object": "list",
  "data": [ /* order objects */ ],
  "has_more": true,
  "next_cursor": "v1:5a1b2c…:1716657480000",
  "previous_cursor": null,
  "url": "/v1/orders"
}

Retrieve an order

GET /v1/orders/{id} Escopo: orders:read

Fetch a single order by its prefixed ID.

Parâmetros de caminho

idstringObrigatório

The order ID (e.g. ord_507f1f77bcf86cd799439011).

Parâmetros de consulta

expandstring[]Opcional

Inline references: table, server, items.menu_item.

Requisição

curl 'https://api.tablezio.com/v1/orders/ord_507f1f77bcf86cd799439011?expand[]=items.menu_item' \
  -H 'X-API-Key: tbz_…'

Resposta

application/json
{
  "id": "ord_507f1f77bcf86cd799439011",
  "object": "order",
  "created": 1716730000,
  "updated": 1716730000,
  "order_number": "ORD-042",
  "type": "takeout",
  "status": "draft",
  "source": "pos",
  "table": null,
  "server": null,
  "customer": {
    "name": "Carlos",
    "phone": "+34 600 000 000",
    "email": null
  },
  "delivery_address": null,
  "estimated_time_minutes": null,
  "items": [
    {
      "object": "order_item",
      "index": 0,
      "menu_item": "mi_5a1b2c3d4e5f6a7b8c9d0e1f",
      "name": "Classic burger",
      "quantity": 2,
      "unit_price": 1200,
      "modifiers": [],
      "notes": null,
      "status": "pending",
      "station": "kitchen",
      "sent_to_kitchen_at": null,
      "ready_at": null
    }
  ],
  "subtotal": 2400,
  "tax_amount": 0,
  "discount_amount": 0,
  "tip_amount": 0,
  "delivery_fee": 0,
  "total": 2400,
  "currency": "usd",
  "notes": null,
  "placed_at": null,
  "completed_at": null,
  "cancelled_at": null,
  "cancel_reason": null,
  "is_self_service": false,
  "is_virtual_table": false,
  "virtual_table_label": null,
  "livemode": true
}

Create an order

POST /v1/orders Escopo: orders:write

Creates a new order. Menu item IDs are resolved against the catalogue — names and prices come from your menu, not the request. Pass Idempotency-Key to make the call safely retryable.

Parâmetros do corpo

typestringObrigatório

Order channel.

dine_intakeoutdelivery
itemsarrayObrigatório

One or more line items: { menu_item, quantity, modifiers?, notes? }.

tablestringOpcional

Table ID for dine_in orders.

customer_namestringOpcional

Display name on the ticket.

customer_phonestringOpcional

Customer contact phone, stored on the order.

customer_emailstringOpcional

Customer contact email, stored on the order.

delivery_addressstringOpcional

Required for delivery orders if dispatching couriers.

notesstringOpcional

Free-form kitchen notes.

Items honour the latest menu prices server-side; pricing sent by clients is ignored.

Requisição

curl -X POST https://api.tablezio.com/v1/orders \
  -H 'X-API-Key: tbz_…' \
  -H 'Idempotency-Key: order_2026-05-26_carlos_1' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "takeout",
    "customer_name": "Carlos",
    "items": [
      { "menu_item": "mi_5a1b2c3d4e5f6a7b8c9d0e1f", "quantity": 2 }
    ]
  }'

Resposta

application/json
{
  "id": "ord_507f1f77bcf86cd799439011",
  "object": "order",
  "created": 1716730000,
  "updated": 1716730000,
  "order_number": "ORD-042",
  "type": "takeout",
  "status": "draft",
  "source": "pos",
  "table": null,
  "server": null,
  "customer": {
    "name": "Carlos",
    "phone": "+34 600 000 000",
    "email": null
  },
  "delivery_address": null,
  "estimated_time_minutes": null,
  "items": [
    {
      "object": "order_item",
      "index": 0,
      "menu_item": "mi_5a1b2c3d4e5f6a7b8c9d0e1f",
      "name": "Classic burger",
      "quantity": 2,
      "unit_price": 1200,
      "modifiers": [],
      "notes": null,
      "status": "pending",
      "station": "kitchen",
      "sent_to_kitchen_at": null,
      "ready_at": null
    }
  ],
  "subtotal": 2400,
  "tax_amount": 0,
  "discount_amount": 0,
  "tip_amount": 0,
  "delivery_fee": 0,
  "total": 2400,
  "currency": "usd",
  "notes": null,
  "placed_at": null,
  "completed_at": null,
  "cancelled_at": null,
  "cancel_reason": null,
  "is_self_service": false,
  "is_virtual_table": false,
  "virtual_table_label": null,
  "livemode": true
}

Update order status

PATCH /v1/orders/{id} Escopo: orders:write

Transition the order to the next lifecycle status. Emits the matching webhook (order.updated, order.completed, order.cancelled).

Parâmetros de caminho

idstringObrigatório

The order ID.

Parâmetros do corpo

statusstringObrigatório

Target status.

placedpreparingreadyservedcompletedcancelled
cancel_reasonstringOpcional

Required when transitioning to cancelled. Shown on receipts and audit logs.

Requisição

curl -X PATCH https://api.tablezio.com/v1/orders/ord_… \
  -H 'X-API-Key: tbz_…' \
  -H 'Content-Type: application/json' \
  -d '{ "status": "placed" }'

Resposta

application/json
{
  "id": "ord_507f1f77bcf86cd799439011",
  "object": "order",
  "created": 1716730000,
  "updated": 1716730000,
  "order_number": "ORD-042",
  "type": "takeout",
  "status": "draft",
  "source": "pos",
  "table": null,
  "server": null,
  "customer": {
    "name": "Carlos",
    "phone": "+34 600 000 000",
    "email": null
  },
  "delivery_address": null,
  "estimated_time_minutes": null,
  "items": [
    {
      "object": "order_item",
      "index": 0,
      "menu_item": "mi_5a1b2c3d4e5f6a7b8c9d0e1f",
      "name": "Classic burger",
      "quantity": 2,
      "unit_price": 1200,
      "modifiers": [],
      "notes": null,
      "status": "pending",
      "station": "kitchen",
      "sent_to_kitchen_at": null,
      "ready_at": null
    }
  ],
  "subtotal": 2400,
  "tax_amount": 0,
  "discount_amount": 0,
  "tip_amount": 0,
  "delivery_fee": 0,
  "total": 2400,
  "currency": "usd",
  "notes": null,
  "placed_at": null,
  "completed_at": null,
  "cancelled_at": null,
  "cancel_reason": null,
  "is_self_service": false,
  "is_virtual_table": false,
  "virtual_table_label": null,
  "livemode": true
}

Cancel an order

POST /v1/orders/{id}/cancel Escopo: orders:write

Convenience shortcut for PATCH …/orders/{id} with status: "cancelled". Idempotent.

Parâmetros de caminho

idstringObrigatório

The order ID.

Parâmetros do corpo

cancel_reasonstringOpcional

Optional reason — recorded on the order and on the resulting webhook.

Requisição

curl -X POST https://api.tablezio.com/v1/orders/ord_…/cancel \
  -H 'X-API-Key: tbz_…' \
  -H 'Content-Type: application/json' \
  -d '{ "cancel_reason": "Customer changed mind" }'

Resposta

application/json
{
  "id": "ord_507f1f77bcf86cd799439011",
  "object": "order",
  "created": 1716730000,
  "updated": 1716730000,
  "order_number": "ORD-042",
  "type": "takeout",
  "status": "draft",
  "source": "pos",
  "table": null,
  "server": null,
  "customer": {
    "name": "Carlos",
    "phone": "+34 600 000 000",
    "email": null
  },
  "delivery_address": null,
  "estimated_time_minutes": null,
  "items": [
    {
      "object": "order_item",
      "index": 0,
      "menu_item": "mi_5a1b2c3d4e5f6a7b8c9d0e1f",
      "name": "Classic burger",
      "quantity": 2,
      "unit_price": 1200,
      "modifiers": [],
      "notes": null,
      "status": "pending",
      "station": "kitchen",
      "sent_to_kitchen_at": null,
      "ready_at": null
    }
  ],
  "subtotal": 2400,
  "tax_amount": 0,
  "discount_amount": 0,
  "tip_amount": 0,
  "delivery_fee": 0,
  "total": 2400,
  "currency": "usd",
  "notes": null,
  "placed_at": null,
  "completed_at": null,
  "cancelled_at": null,
  "cancel_reason": null,
  "is_self_service": false,
  "is_virtual_table": false,
  "virtual_table_label": null,
  "livemode": true
}