Skip to main content
curl -X POST https://api.restai.com/api/orders \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "dine_in",
    "customerName": "John Doe",
    "notes": "Extra napkins please",
    "items": [
      {
        "menuItemId": "123e4567-e89b-12d3-a456-426614174000",
        "quantity": 2,
        "notes": "No onions",
        "modifiers": [
          {
            "modifierId": "987fcdeb-51a2-43f7-9c8d-123456789abc"
          }
        ]
      },
      {
        "menuItemId": "456e7890-e89b-12d3-a456-426614174001",
        "quantity": 1
      }
    ],
    "couponCode": "SUMMER20",
    "redemptionId": "789fedcb-a123-45f6-9d8e-456789abcdef"
  }'

POST /api/orders

Creates a new order with one or more menu items. The order is automatically assigned an order number and calculates totals including tax and any applicable discounts.

Authentication

Requires orders:create permission (waiter, cashier, branch_manager, org_admin).

Request Body

type
string
default:"dine_in"
Order type. Options: dine_in, takeout, delivery
customerName
string
Customer’s name (optional for dine-in, recommended for takeout/delivery)
notes
string
Special instructions or notes for the order (max 500 characters)
items
array
required
Array of order items (minimum 1 item required)
couponCode
string
Optional coupon code to apply discount (max 50 characters)
redemptionId
string
UUID of a loyalty reward redemption to apply

Response

success
boolean
Indicates if the request was successful
data
object
The created order object

Error Responses

success
boolean
false when an error occurs
error
object
Error details

Example Response

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "organization_id": "123e4567-e89b-12d3-a456-426614174000",
    "branch_id": "789e4567-e89b-12d3-a456-426614174111",
    "table_session_id": null,
    "customer_id": null,
    "order_number": "ORD-00042",
    "type": "dine_in",
    "status": "pending",
    "customer_name": "John Doe",
    "subtotal": 3200,
    "tax": 576,
    "discount": 0,
    "total": 3776,
    "notes": "Extra napkins please",
    "inventory_deducted": false,
    "created_at": "2024-01-15T14:30:00.000Z",
    "updated_at": "2024-01-15T14:30:00.000Z",
    "items": [
      {
        "id": "660e8400-e29b-41d4-a716-446655440001",
        "order_id": "550e8400-e29b-41d4-a716-446655440000",
        "menu_item_id": "123e4567-e89b-12d3-a456-426614174000",
        "name": "Cheeseburger",
        "unit_price": 1200,
        "quantity": 2,
        "total": 2400,
        "notes": "No onions",
        "status": "pending"
      },
      {
        "id": "770e8400-e29b-41d4-a716-446655440002",
        "order_id": "550e8400-e29b-41d4-a716-446655440000",
        "menu_item_id": "456e7890-e89b-12d3-a456-426614174001",
        "name": "French Fries",
        "unit_price": 800,
        "quantity": 1,
        "total": 800,
        "notes": null,
        "status": "pending"
      }
    ]
  }
}

WebSocket Notification

When an order is created, a WebSocket event is broadcast to:
  • branch:{branchId} - Notifies all branch staff
  • branch:{branchId}:kitchen - Updates kitchen display
{
  "type": "order:new",
  "payload": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "orderNumber": "ORD-00042",
    "status": "pending",
    "items": [
      {
        "id": "660e8400-e29b-41d4-a716-446655440001",
        "name": "Cheeseburger",
        "quantity": 2,
        "status": "pending",
        "notes": "No onions"
      },
      {
        "id": "770e8400-e29b-41d4-a716-446655440002",
        "name": "French Fries",
        "quantity": 1,
        "status": "pending",
        "notes": null
      }
    ]
  },
  "timestamp": 1705330200000
}

Notes

  • All monetary values are in cents (e.g., $32.00 = 3200)
  • Order numbers are automatically generated and sequential per branch
  • Tax rate is configured per branch (default 18% for Peru)
  • For customer roles, table_session_id is automatically determined from active session
  • Orders with loyalty redemptions or coupons will have discounts applied automatically
Menu items must exist and be available at the branch. The system validates inventory and availability before creating the order.

Build docs developers (and LLMs) love