{
  "openapi": "3.1.0",
  "info": {
    "title": "Cloud POS 4U API",
    "version": "1.2.0",
    "summary": "Read the menu, orders, tables, reservations and sales of a restaurant branch, and place orders and reservations.",
    "description": "The Cloud POS 4U public API, version 1. Available on the Ultimate plan (API Access) and on on-premise editions whose licence includes API Access.\n\nAuthentication: an API key created in Automation (sidebar) > APIs, sent as `X-API-Key: pos_…` or `Authorization: Bearer pos_…`. A key belongs to one branch and holds scopes; staff sign-ins are not accepted.\n\nGuide: https://cloudpos4u.com/en/developers/api",
    "contact": {
      "name": "Cloud POS 4U support",
      "url": "https://cloudpos4u.com/en/contact"
    }
  },
  "servers": [
    {
      "url": "https://{restaurant}.cloudpos4u.com/api/v1",
      "description": "Cloud: your restaurant's address.",
      "variables": {
        "restaurant": {
          "default": "your-restaurant",
          "description": "Your restaurant's address name."
        }
      }
    },
    {
      "url": "https://{server}/api/v1",
      "description": "On-premise: your Cloud POS 4U server.",
      "variables": {
        "server": {
          "default": "pos.local"
        }
      }
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "BearerApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Customers"
    },
    {
      "name": "Menu"
    },
    {
      "name": "Orders"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Reservations"
    },
    {
      "name": "Tables"
    }
  ],
  "paths": {
    "/customers": {
      "get": {
        "operationId": "findCustomer",
        "summary": "Find a customer",
        "description": "The restaurant's customer with exactly this phone number or email address, or null. Send phone or email.",
        "tags": [
          "Customers"
        ],
        "x-scope": "customers:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "customers:read"
            ]
          },
          {
            "BearerApiKey": [
              "customers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "phone",
            "in": "query",
            "description": "The phone number as stored, international format, for example +971501234567.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "+971501234567"
          },
          {
            "name": "email",
            "in": "query",
            "description": "The email address.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Customer"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6f7a8b9c-0d1e-4f2a-8b3c-4d5e6f7a8b9c",
                    "name": "Sara Ahmed",
                    "phone": "+971501234567",
                    "email": null,
                    "customerTypes": [
                      "Regular"
                    ],
                    "loyaltyPoints": 120,
                    "loyaltyTier": null,
                    "preferredLanguage": "en",
                    "marketingConsent": false,
                    "createdAt": "2026-05-02T10:00:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/menu": {
      "get": {
        "operationId": "getMenu",
        "summary": "Get the branch menu",
        "description": "The dishes the key's branch sells now, with the branch's own price (in the branch currency) and availability, and the categories they belong to. A dish with no price in the branch currency is left out, as on the branch's tills.",
        "tags": [
          "Menu"
        ],
        "x-scope": "menu:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "menu:read"
            ]
          },
          {
            "BearerApiKey": [
              "menu:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "description": "Only the dishes of this category id.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Menu"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "dishes": [
                      {
                        "id": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                        "name": "Chicken shawarma",
                        "description": "With garlic sauce",
                        "price": 15,
                        "image": null,
                        "categoryId": "5e2a9c1b-7d3f-4a5b-9c8d-0e1f2a3b4c5d",
                        "category": {
                          "id": "5e2a9c1b-7d3f-4a5b-9c8d-0e1f2a3b4c5d",
                          "name": "Wraps"
                        },
                        "isAvailable": true,
                        "preparationTime": 10,
                        "isFeatured": false
                      }
                    ],
                    "categories": [
                      {
                        "id": "5e2a9c1b-7d3f-4a5b-9c8d-0e1f2a3b4c5d",
                        "name": "Wraps"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "listOrders",
        "summary": "List orders",
        "description": "The orders of the key's branch, newest first, one page at a time.",
        "tags": [
          "Orders"
        ],
        "x-scope": "orders:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "orders:read"
            ]
          },
          {
            "BearerApiKey": [
              "orders:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "One order status or a comma-separated list, for example In Progress,Ready.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "In Progress,Ready"
          },
          {
            "name": "from",
            "in": "query",
            "description": "First business date (YYYY-MM-DD), in the branch's own time zone and day cut-off.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2026-11-01"
          },
          {
            "name": "to",
            "in": "query",
            "description": "Last business date (YYYY-MM-DD), inclusive. from and to go together; one alone means that single day.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2026-11-21"
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "description": "One or more of Pending, Collected, Paid, Partially Paid, Partially Refunded, Refunded, Failed, Cancelled (comma-separated), or unpaid.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orderType",
            "in": "query",
            "description": "One or more of Dine-in, Delivery, Takeaway, Staff Meal (comma-separated).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 200. 50 when not sent.",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "example": 50
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Orders to skip, for the next page.",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "3f6c1d2e-8a4b-4c5d-9e6f-7a8b9c0d1e2f",
                      "orderNumber": "ORD-1042",
                      "orderStatus": "In Progress",
                      "paymentStatus": "Pending",
                      "orderType": "Takeaway",
                      "orderDate": "2026-11-21T12:30:00.000Z",
                      "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "tableId": null,
                      "customerDetails": {
                        "name": "Sara Ahmed",
                        "phone": "+971501234567",
                        "email": null,
                        "guests": null
                      },
                      "items": [
                        {
                          "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                          "name": "Chicken shawarma",
                          "quantity": 2,
                          "price": "30.000000"
                        }
                      ],
                      "bills": {
                        "subtotal": 28.57,
                        "discountAmount": 0,
                        "total": 28.57,
                        "tax": 1.43,
                        "taxRate": 5,
                        "serviceChargeAmount": 0,
                        "totalWithTax": 30,
                        "customerDeliveryFee": 0,
                        "tipAmount": 0,
                        "pricesIncludeTax": true
                      },
                      "currencySymbol": "AED",
                      "externalOrderId": "WEB-88213",
                      "notes": null
                    }
                  ],
                  "pagination": {
                    "total": 1,
                    "limit": 50,
                    "offset": 0,
                    "hasMore": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "summary": "Place an order",
        "description": "Places an order for the key's branch. The server prices every line from the branch menu (prices you send are not used) and a key cannot give discounts or change prices. The branch needs an open shift. How the order starts is set per key in Automation > APIs: by default it waits for staff to accept it in the app (Pending Approval); a key set to send orders straight to the kitchen creates them In Progress, unless you send orderStatus Pending Approval. orderStatus can only make it stricter: In Progress from a key that waits for approval still gives Pending Approval (no error; the answer shows the real status). Send an Idempotency-Key header so a retry never creates a second order. The order counts toward the plan's monthly order limit.",
        "tags": [
          "Orders"
        ],
        "x-scope": "orders:write",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "orders:write"
            ]
          },
          {
            "BearerApiKey": [
              "orders:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "8 to 64 letters, digits, - or _. The same key again returns the first order (200, replayed) instead of a second one.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "web-88213-1"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              },
              "example": {
                "orderType": "Takeaway",
                "customerDetails": {
                  "name": "Sara Ahmed",
                  "phone": "+971501234567"
                },
                "externalOrderId": "WEB-88213",
                "items": [
                  {
                    "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                    "quantity": 2,
                    "notes": "No pickles"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "message": "Order created!",
                  "data": {
                    "id": "3f6c1d2e-8a4b-4c5d-9e6f-7a8b9c0d1e2f",
                    "orderNumber": "ORD-1042",
                    "orderStatus": "Pending Approval",
                    "paymentStatus": "Pending",
                    "orderType": "Takeaway",
                    "orderDate": "2026-11-21T12:30:00.000Z",
                    "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "tableId": null,
                    "customerDetails": {
                      "name": "Sara Ahmed",
                      "phone": "+971501234567",
                      "email": null,
                      "guests": null
                    },
                    "items": [
                      {
                        "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                        "name": "Chicken shawarma",
                        "quantity": 2,
                        "price": "30.000000"
                      }
                    ],
                    "bills": {
                      "subtotal": 28.57,
                      "discountAmount": 0,
                      "total": 28.57,
                      "tax": 1.43,
                      "taxRate": 5,
                      "serviceChargeAmount": 0,
                      "totalWithTax": 30,
                      "customerDeliveryFee": 0,
                      "tipAmount": 0,
                      "pricesIncludeTax": true
                    },
                    "currencySymbol": "AED",
                    "externalOrderId": "WEB-88213",
                    "notes": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN). The plan's monthly order limit is reached (PLAN_LIMIT_REACHED, or PLAN_LIMIT_REACTIVATION).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders/quote": {
      "post": {
        "operationId": "quoteOrder",
        "summary": "Price a cart",
        "description": "Prices the lines exactly as POST /orders would (menu prices, deals, tax and service charge of the branch) and saves nothing. Use it to show the customer the total before placing the order.",
        "tags": [
          "Orders"
        ],
        "x-scope": "orders:write",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "orders:write"
            ]
          },
          {
            "BearerApiKey": [
              "orders:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              },
              "example": {
                "orderType": "Takeaway",
                "items": [
                  {
                    "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                    "quantity": 2
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/OrderQuote"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "currency": "AED",
                    "decimals": 2,
                    "orderType": "Takeaway",
                    "subtotal": 28.57,
                    "discountAmount": 0,
                    "total": 28.57,
                    "taxRate": 5,
                    "tax": 1.43,
                    "serviceChargeRate": 0,
                    "serviceChargeAmount": 0,
                    "customerDeliveryFee": 0,
                    "totalWithTax": 30,
                    "tipAmount": 0,
                    "amountDue": 30,
                    "pricesIncludeTax": true,
                    "appliedDeals": [],
                    "lines": [
                      {
                        "index": 0,
                        "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                        "quantity": 2
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get an order",
        "description": "One order of the key's branch. An order of another branch answers 404.",
        "tags": [
          "Orders"
        ],
        "x-scope": "orders:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "orders:read"
            ]
          },
          {
            "BearerApiKey": [
              "orders:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The order id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "3f6c1d2e-8a4b-4c5d-9e6f-7a8b9c0d1e2f",
                    "orderNumber": "ORD-1042",
                    "orderStatus": "In Progress",
                    "paymentStatus": "Pending",
                    "orderType": "Takeaway",
                    "orderDate": "2026-11-21T12:30:00.000Z",
                    "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "tableId": null,
                    "customerDetails": {
                      "name": "Sara Ahmed",
                      "phone": "+971501234567",
                      "email": null,
                      "guests": null
                    },
                    "items": [
                      {
                        "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                        "name": "Chicken shawarma",
                        "quantity": 2,
                        "price": "30.000000"
                      }
                    ],
                    "bills": {
                      "subtotal": 28.57,
                      "discountAmount": 0,
                      "total": 28.57,
                      "tax": 1.43,
                      "taxRate": 5,
                      "serviceChargeAmount": 0,
                      "totalWithTax": 30,
                      "customerDeliveryFee": 0,
                      "tipAmount": 0,
                      "pricesIncludeTax": true
                    },
                    "currencySymbol": "AED",
                    "externalOrderId": "WEB-88213",
                    "notes": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's branch (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/exports": {
      "post": {
        "operationId": "startReportExport",
        "summary": "Start a report export",
        "description": "Starts a background export of a ready or saved report as csv, xlsx (one sheet per currency, numbers with the currency's decimals) or pdf, with the same rules as POST /reports/run. Answers 202 with the export id; poll GET /reports/exports/{id}. At most 3 exports in progress per key and 100 a day per restaurant (429 REPORT_EXPORT_BUSY / REPORT_EXPORT_DAILY_LIMIT).",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportRequest"
              },
              "example": {
                "templateId": "branchComparison",
                "startDate": "2026-11-01",
                "endDate": "2026-11-30",
                "format": "xlsx",
                "language": "en"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ReportExport"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f",
                    "status": "queued",
                    "format": "xlsx",
                    "source": "api",
                    "templateId": "branchComparison",
                    "savedReportId": null,
                    "fileName": null,
                    "sizeBytes": null,
                    "rowCount": null,
                    "createdAt": "2026-11-30T08:00:00.000Z",
                    "completedAt": null,
                    "expiresAt": null,
                    "error": null,
                    "download": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/exports/{id}": {
      "get": {
        "operationId": "getReportExport",
        "summary": "Get a report export",
        "description": "The status of an export this key started: queued, running, done, failed (with error.code) or expired. When done, download.url is a signed link on this host that works for 15 minutes without the API key; call again for a fresh one. Files are deleted after 7 days. Another key's export answers 404.",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The export id from POST /reports/exports.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ReportExport"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f",
                    "status": "done",
                    "format": "xlsx",
                    "source": "api",
                    "templateId": "branchComparison",
                    "savedReportId": null,
                    "fileName": "report-branchComparison-2026-11-01-2026-11-30.xlsx",
                    "sizeBytes": 8421,
                    "rowCount": 2,
                    "createdAt": "2026-11-30T08:00:00.000Z",
                    "completedAt": "2026-11-30T08:00:04.000Z",
                    "expiresAt": "2026-12-07T08:00:04.000Z",
                    "error": null,
                    "download": {
                      "url": "/api/reports/exports/5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f/file?expires=1764490504&sig=AbC123",
                      "expiresAt": "2026-11-30T08:15:04.000Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's branch (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/live-orders": {
      "get": {
        "operationId": "getLiveOrders",
        "summary": "Get the live orders",
        "description": "The open orders of the key's branch right now (not completed or cancelled), newest first, at most 50. meta.truncated says when there are more.",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "3f6c1d2e-8a4b-4c5d-9e6f-7a8b9c0d1e2f",
                      "orderNumber": "ORD-1042",
                      "orderStatus": "In Progress",
                      "paymentStatus": "Pending",
                      "orderType": "Takeaway",
                      "orderDate": "2026-11-21T12:30:00.000Z",
                      "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "tableId": null,
                      "customerDetails": {
                        "name": "Sara Ahmed",
                        "phone": "+971501234567",
                        "email": null,
                        "guests": null
                      },
                      "items": [
                        {
                          "dishId": "9b1d7c3e-2f4a-4b6c-8d0e-1f2a3b4c5d6e",
                          "name": "Chicken shawarma",
                          "quantity": 2,
                          "price": "30.000000"
                        }
                      ],
                      "bills": {
                        "subtotal": 28.57,
                        "discountAmount": 0,
                        "total": 28.57,
                        "tax": 1.43,
                        "taxRate": 5,
                        "serviceChargeAmount": 0,
                        "totalWithTax": 30,
                        "customerDeliveryFee": 0,
                        "tipAmount": 0,
                        "pricesIncludeTax": true
                      },
                      "currencySymbol": "AED",
                      "externalOrderId": "WEB-88213",
                      "notes": null
                    }
                  ],
                  "meta": {
                    "limit": 50,
                    "truncated": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/run": {
      "post": {
        "operationId": "runReport",
        "summary": "Run a ready or saved report",
        "description": "Runs a ready report (templateId) or a saved report (savedReportId) for a period of business days (each branch's time zone and day-close cut-off, at most 366 days) across the key's allowed branches, or the branchIds you send (a branch the key may not read is 403 BRANCH_FORBIDDEN). Rows and totals are per currency; amounts in different currencies are never added. Figures the key may not see answer 403 REPORT_FIELD_FORBIDDEN. A saved report needs the plan's custom report builder. The same numbers as the app.",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportRequest"
              },
              "example": {
                "templateId": "salesSummary",
                "startDate": "2026-11-01",
                "endDate": "2026-11-30",
                "branchIds": [
                  "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                  "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ReportResult"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "rows": [
                      {
                        "key": "[\"AED\",\"2026-11-01\"]",
                        "currency": "AED",
                        "dims": {
                          "businessDate": "2026-11-01"
                        },
                        "values": {
                          "netSales": 1250.5,
                          "saleCount": 48
                        }
                      }
                    ],
                    "page": {
                      "page": 1,
                      "limit": 100,
                      "total": 30,
                      "hasMore": false
                    },
                    "totals": [
                      {
                        "currency": "AED",
                        "decimals": 2,
                        "values": {
                          "netSales": 38420.75,
                          "saleCount": 1460
                        }
                      },
                      {
                        "currency": "KWD",
                        "decimals": 3,
                        "values": {
                          "netSales": 912.375,
                          "saleCount": 210
                        }
                      }
                    ],
                    "converted": null,
                    "templateId": "salesSummary"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales-summary": {
      "get": {
        "operationId": "getSalesSummary",
        "summary": "Get the sales summary",
        "description": "Net sales, order counts, refunds and the payment mix of the key's branch for a period of business days, with the previous period for comparison. The same figures as the app's Home dashboard.",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "description": "today (the default), yesterday, last7Days, last30Days, thisWeek, thisMonth, lastMonth, thisYear, all or custom.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "today",
                "yesterday",
                "last7Days",
                "last30Days",
                "thisWeek",
                "thisMonth",
                "lastMonth",
                "thisYear",
                "custom"
              ]
            },
            "example": "today"
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "For period=custom: the first business date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "For period=custom: the last business date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/SalesSummary"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "period": "today",
                    "generatedAt": "2026-11-21T15:00:00.000Z",
                    "ranges": [],
                    "current": {
                      "netSales": 1250.5,
                      "refunds": 0,
                      "orderCount": 48,
                      "settledCount": 45,
                      "averageCheck": 27.79,
                      "cancelledCount": 1
                    },
                    "previous": {
                      "netSales": 1100,
                      "orderCount": 44
                    },
                    "salesTrend": 13.68,
                    "ordersTrend": 9.09,
                    "mixedCurrency": false,
                    "byCurrency": [],
                    "recentOrders": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reports/templates": {
      "get": {
        "operationId": "listReportTemplates",
        "summary": "List the ready reports",
        "description": "The ready reports (the same as the app's Reports screen) with the figures and splits each shows, whether this key may run it, and the branches the key reads reports for: its own branch plus the branches chosen for it in Automation > APIs.",
        "tags": [
          "Reports"
        ],
        "x-scope": "reports:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reports:read"
            ]
          },
          {
            "BearerApiKey": [
              "reports:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ReportTemplates"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "templates": [
                      {
                        "id": "salesSummary",
                        "group": "sales",
                        "measures": [
                          "grossSales",
                          "discounts",
                          "sales",
                          "refunds",
                          "netSales",
                          "outputTax",
                          "tips",
                          "saleCount",
                          "averageCheck"
                        ],
                        "dimensions": [
                          "businessDate"
                        ],
                        "allowed": true
                      },
                      {
                        "id": "labourVsSales",
                        "group": "costs",
                        "measures": [
                          "netSales",
                          "labour"
                        ],
                        "dimensions": [
                          "branch",
                          "businessDate"
                        ],
                        "allowed": false
                      }
                    ],
                    "branchIds": [
                      "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reservations": {
      "get": {
        "operationId": "listReservations",
        "summary": "List reservations",
        "description": "The reservations of the key's branch. Needs the Reservation System plan feature (included in Ultimate).",
        "tags": [
          "Reservations"
        ],
        "x-scope": "reservations:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reservations:read"
            ]
          },
          {
            "BearerApiKey": [
              "reservations:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "One of Requested, Declined, Pending, Confirmed, Seated, Completed, Cancelled, No Show.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Reservations ending after this date-time (ISO 8601).",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2026-11-22T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "description": "Reservations starting before this date-time (ISO 8601).",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2026-11-23T00:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Reservation"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
                      "reservationNumber": "RSV-0031",
                      "customerName": "Omar Khan",
                      "customerPhone": "+971551112233",
                      "guestCount": 4,
                      "startsAt": "2026-11-22T17:00:00.000Z",
                      "endsAt": "2026-11-22T19:00:00.000Z",
                      "status": "Confirmed",
                      "scope": "Tables",
                      "floorId": null,
                      "notes": "Window seat",
                      "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                      "source": "Staff"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN). PLAN_FEATURE_REQUIRED here can also mean the plan lacks Reservations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createReservation",
        "summary": "Create a reservation",
        "description": "Books tables (or a whole floor) of the key's branch. Overlapping bookings of the same table are refused with 409.",
        "tags": [
          "Reservations"
        ],
        "x-scope": "reservations:write",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reservations:write"
            ]
          },
          {
            "BearerApiKey": [
              "reservations:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReservationCreate"
              },
              "example": {
                "customerName": "Omar Khan",
                "customerPhone": "+971551112233",
                "guestCount": 4,
                "startsAt": "2026-11-22T17:00:00Z",
                "endsAt": "2026-11-22T19:00:00Z",
                "tableIds": [
                  "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f"
                ],
                "notes": "Window seat"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Reservation"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "message": "Reservation created.",
                  "data": {
                    "id": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
                    "reservationNumber": "RSV-0031",
                    "customerName": "Omar Khan",
                    "customerPhone": "+971551112233",
                    "guestCount": 4,
                    "startsAt": "2026-11-22T17:00:00.000Z",
                    "endsAt": "2026-11-22T19:00:00.000Z",
                    "status": "Confirmed",
                    "scope": "Tables",
                    "floorId": null,
                    "notes": "Window seat",
                    "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "source": "Staff"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN). PLAN_FEATURE_REQUIRED here can also mean the plan lacks Reservations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reservations/{id}": {
      "patch": {
        "operationId": "updateReservation",
        "summary": "Change a reservation's status",
        "description": "Moves a reservation to another status (for example Seated, Completed, Cancelled, No Show). A move the reservation cannot make answers 409. A guest's online booking request (Requested) can only be cancelled here; staff confirm or decline it in the app.",
        "tags": [
          "Reservations"
        ],
        "x-scope": "reservations:write",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "reservations:write"
            ]
          },
          {
            "BearerApiKey": [
              "reservations:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The reservation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReservationStatusUpdate"
              },
              "example": {
                "status": "Seated"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/Reservation"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "2d3e4f5a-6b7c-4d8e-9f0a-1b2c3d4e5f6a",
                    "reservationNumber": "RSV-0031",
                    "customerName": "Omar Khan",
                    "customerPhone": "+971551112233",
                    "guestCount": 4,
                    "startsAt": "2026-11-22T17:00:00.000Z",
                    "endsAt": "2026-11-22T19:00:00.000Z",
                    "status": "Seated",
                    "scope": "Tables",
                    "floorId": null,
                    "notes": "Window seat",
                    "branchId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "source": "Staff"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN). PLAN_FEATURE_REQUIRED here can also mean the plan lacks Reservations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's branch (NOT_FOUND).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The change conflicts with the current state (CONFLICT, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tables": {
      "get": {
        "operationId": "listTables",
        "summary": "List tables",
        "description": "The tables of the key's branch with their state and floor.",
        "tags": [
          "Tables"
        ],
        "x-scope": "tables:read",
        "x-editions": [
          "cloud",
          "on-prem"
        ],
        "security": [
          {
            "ApiKeyHeader": [
              "tables:read"
            ]
          },
          {
            "BearerApiKey": [
              "tables:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Table"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
                      "tableNo": "T4",
                      "status": "Available",
                      "seats": 4,
                      "floor": {
                        "id": "5e2a9c1b-7d3f-4a5b-9c8d-0e1f2a3b4c5d",
                        "name": "Ground floor"
                      },
                      "currentOrderId": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request is not valid (VALIDATION_ERROR, or a more specific code).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is not valid or has expired (API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope (API_SCOPE_NOT_ALLOWED), the plan does not include a feature this endpoint needs (PLAN_FEATURE_REQUIRED), the module is switched off for the restaurant (FORBIDDEN) or the branch is not the key's (BRANCH_FORBIDDEN).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for the key or the restaurant (RATE_LIMITED). Wait Retry-After seconds.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "503": {
            "description": "The key could not be checked just now (SERVER_BUSY). Try again in a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "An API key (pos_…)."
      },
      "BearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pos_ API key",
        "description": "The same API key as a Bearer token."
      }
    },
    "headers": {
      "RateLimit": {
        "description": "Requests left in the current window (IETF draft 7: limit, remaining, reset).",
        "schema": {
          "type": "string"
        }
      },
      "RateLimitPolicy": {
        "description": "The limit and window, for example 300;w=60.",
        "schema": {
          "type": "string"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Customer": {
        "title": "Customer",
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "loyaltyPoints": {
            "type": "number"
          },
          "loyaltyTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferredLanguage": {
            "type": [
              "string",
              "null"
            ]
          },
          "marketingConsent": {
            "type": "boolean"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "Dish": {
        "title": "Dish",
        "description": "A dish as the key's branch sells it.",
        "type": "object",
        "required": [
          "id",
          "name",
          "price",
          "isAvailable"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "The branch's price in the branch currency."
          },
          "image": {
            "type": [
              "string",
              "null"
            ]
          },
          "categoryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "A UUID."
              },
              "name": {
                "type": "string"
              }
            }
          },
          "isAvailable": {
            "type": "boolean"
          },
          "preparationTime": {
            "type": [
              "number",
              "null"
            ],
            "description": "Minutes."
          },
          "isFeatured": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Error": {
        "title": "Error",
        "description": "Every error answer. `code` is stable and machine-readable; `message` is English text for a person.",
        "type": "object",
        "required": [
          "status",
          "message"
        ],
        "properties": {
          "status": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "For example API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED, API_SCOPE_NOT_ALLOWED, PLAN_FEATURE_REQUIRED, PLAN_LIMIT_REACHED, FORBIDDEN, BRANCH_FORBIDDEN, RATE_LIMITED, VALIDATION_ERROR, NOT_FOUND, CONFLICT, SERVER_BUSY."
          },
          "details": {
            "type": "object"
          },
          "requestId": {
            "type": "string",
            "description": "Quote it when you contact support."
          },
          "errorStack": {
            "type": "string",
            "description": "Always empty in production."
          }
        }
      },
      "Menu": {
        "title": "Menu",
        "type": "object",
        "required": [
          "branchId",
          "dishes",
          "categories"
        ],
        "properties": {
          "branchId": {
            "type": [
              "string",
              "null"
            ]
          },
          "dishes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Dish"
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A UUID."
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Order": {
        "title": "Order",
        "description": "An order. The fields listed are stable in v1; other fields may appear and can be ignored.",
        "type": "object",
        "required": [
          "id",
          "orderStatus",
          "paymentStatus",
          "items",
          "bills"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "orderNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderStatus": {
            "type": "string",
            "enum": [
              "Pending Approval",
              "In Progress",
              "Ready",
              "Served",
              "On the Way",
              "Delivered",
              "Awaiting Payment",
              "Completed",
              "Cancelled"
            ]
          },
          "paymentStatus": {
            "type": "string"
          },
          "orderType": {
            "type": "string",
            "enum": [
              "Dine-in",
              "Delivery",
              "Takeaway",
              "Staff Meal"
            ]
          },
          "orderDate": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "branchId": {
            "type": [
              "string",
              "null"
            ]
          },
          "tableId": {
            "type": [
              "string",
              "null"
            ]
          },
          "checkNumber": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The check's number at its table (1, 2, 3…) when the table has several checks."
          },
          "splitGroupId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Split bill: the same UUID on an order split into separate checks and on every check cut from it (the original order's id). Null when the order was never split."
          },
          "splitFromOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Split bill: on a check cut from another order, that order's UUID; null on the original and on orders never split. Each check has its own payments and tax invoice."
          },
          "splitPlan": {
            "type": [
              "object",
              "null"
            ],
            "description": "Split bill: payer shares of this check, frozen when saved: { version, mode (even, amount or seat), shares: [{ key, label, amount, seatKey? }] }. Amounts exclude tips and add up to the bill. Each share's payments are in the order's payment lines (settlementScope \"share\", settlementKey = the share's key, tipPortion = that payer's tip). One tax invoice for the order. Null when the check is not shared."
          },
          "customerDetails": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "guests": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "bills": {
            "type": "object",
            "required": [
              "subtotal",
              "total",
              "tax",
              "totalWithTax"
            ],
            "properties": {
              "subtotal": {
                "type": "number"
              },
              "discountAmount": {
                "type": "number"
              },
              "total": {
                "type": "number"
              },
              "tax": {
                "type": "number"
              },
              "taxRate": {
                "type": "number"
              },
              "serviceChargeAmount": {
                "type": "number"
              },
              "totalWithTax": {
                "type": "number"
              },
              "customerDeliveryFee": {
                "type": "number"
              },
              "tipAmount": {
                "type": "number"
              },
              "pricesIncludeTax": {
                "type": "boolean"
              }
            }
          },
          "currencySymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The order's currency code (ISO 4217) when known."
          },
          "externalOrderId": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "OrderCreate": {
        "title": "OrderCreate",
        "description": "A new order for the key's branch.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderLine"
            }
          },
          "orderType": {
            "type": "string",
            "enum": [
              "Dine-in",
              "Delivery",
              "Takeaway"
            ],
            "description": "Dine-in when not sent."
          },
          "tableId": {
            "type": "string",
            "description": "For Dine-in: a table id from GET /tables."
          },
          "customerDetails": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "phone": {
                "type": "string",
                "description": "Required for Delivery. International format, for example +971501234567."
              },
              "email": {
                "type": "string"
              },
              "guests": {
                "type": "integer"
              }
            }
          },
          "deliveryAddress": {
            "type": "string",
            "description": "Required for Delivery."
          },
          "orderStatus": {
            "type": "string",
            "enum": [
              "In Progress",
              "Pending Approval"
            ],
            "description": "The key's order setting decides how the order starts. The default is Pending Approval: staff accept it in the app first. A key set to send orders straight to the kitchen creates them In Progress unless you ask for Pending Approval. This field can only make it stricter: In Progress from a key that waits for approval still gives Pending Approval."
          },
          "externalOrderId": {
            "type": "string",
            "description": "Your own reference for the order."
          },
          "idempotencyKey": {
            "type": "string",
            "description": "Or the Idempotency-Key header: 8 to 64 letters, digits, - or _. Sending the same key again returns the first order instead of a second one."
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "OrderLine": {
        "title": "OrderLine",
        "description": "One line of an order you send. The server prices every line from the branch menu: a price you send is not used.",
        "type": "object",
        "required": [
          "dishId",
          "quantity"
        ],
        "properties": {
          "dishId": {
            "type": "string",
            "description": "The dish id from GET /menu."
          },
          "quantity": {
            "type": "number",
            "description": "More than 0."
          },
          "notes": {
            "type": "string",
            "description": "A note for the kitchen."
          }
        }
      },
      "OrderQuote": {
        "title": "OrderQuote",
        "description": "What the order would cost now, priced by the server exactly as POST /orders would price it. Nothing is saved. Amounts are numbers rounded to the currency's decimals.",
        "type": "object",
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 code of the branch currency."
          },
          "decimals": {
            "type": "integer"
          },
          "orderType": {
            "type": "string"
          },
          "subtotal": {
            "type": "number"
          },
          "discountAmount": {
            "type": "number"
          },
          "total": {
            "type": "number"
          },
          "taxRate": {
            "type": "number"
          },
          "tax": {
            "type": "number"
          },
          "serviceChargeRate": {
            "type": "number"
          },
          "serviceChargeAmount": {
            "type": "number"
          },
          "customerDeliveryFee": {
            "type": "number"
          },
          "totalWithTax": {
            "type": "number"
          },
          "tipAmount": {
            "type": "number"
          },
          "amountDue": {
            "type": "number"
          },
          "pricesIncludeTax": {
            "type": "boolean"
          },
          "appliedDeals": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "dishId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "number"
                }
              }
            }
          }
        },
        "required": [
          "currency",
          "decimals",
          "subtotal",
          "total",
          "tax",
          "totalWithTax",
          "amountDue",
          "lines"
        ]
      },
      "Pagination": {
        "title": "Pagination",
        "type": "object",
        "required": [
          "total",
          "limit",
          "offset",
          "hasMore"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "RateLimited": {
        "title": "RateLimited",
        "description": "429 Too Many Requests. Wait for the Retry-After header (seconds) before trying again.",
        "type": "object",
        "required": [
          "status",
          "code",
          "message"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "enum": [
              429
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "RATE_LIMITED"
            ]
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "string",
                "enum": [
                  "per_key",
                  "writes_per_key",
                  "per_restaurant"
                ]
              },
              "retryAfterSeconds": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ReportExport": {
        "title": "ReportExport",
        "description": "A background report export. When status is done, download.url (on this API host, no key needed) works for 15 minutes; ask again for a fresh link. Files are kept 7 days.",
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "done",
              "failed",
              "expired"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "xlsx",
              "pdf"
            ]
          },
          "source": {
            "type": "string"
          },
          "templateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "savedReportId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "sizeBytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "rowCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "download": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "expiresAt": {
                "type": "string"
              }
            }
          }
        }
      },
      "ReportRequest": {
        "title": "ReportRequest",
        "description": "A ready report (templateId) or a saved report (savedReportId) for a period of business days and the key's branches.",
        "type": "object",
        "properties": {
          "templateId": {
            "type": "string",
            "description": "A ready report id from GET /reports/templates."
          },
          "savedReportId": {
            "type": "string",
            "description": "A saved report the person who created the key can open."
          },
          "startDate": {
            "type": "string",
            "description": "The first business date (YYYY-MM-DD). At most 366 days."
          },
          "endDate": {
            "type": "string",
            "description": "The last business date (YYYY-MM-DD)."
          },
          "branchIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Branches within the key's allowed branches; none = all of them."
          },
          "refundBasis": {
            "type": "string",
            "enum": [
              "refundDay",
              "saleDay"
            ],
            "description": "refundDay (default): refunds on the day they were made; saleDay: against the sale's day."
          },
          "currencyMode": {
            "type": "string",
            "enum": [
              "perCurrency",
              "converted"
            ],
            "description": "Totals per currency always; converted adds one total at the owner's monthly rates."
          },
          "grain": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month"
            ]
          },
          "page": {
            "type": "integer"
          },
          "limit": {
            "type": "integer",
            "description": "Rows per page, at most 500."
          },
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "xlsx",
              "pdf"
            ],
            "description": "Exports only."
          },
          "language": {
            "type": "string",
            "description": "Exports only: the file's language (en, ar, ur, …)."
          }
        }
      },
      "ReportResult": {
        "title": "ReportResult",
        "description": "Report rows and totals PER CURRENCY: amounts in different currencies are never added together.",
        "type": "object",
        "required": [
          "rows",
          "totals"
        ],
        "properties": {
          "definition": {
            "type": "object"
          },
          "columns": {
            "type": "object"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "dims": {
                  "type": "object"
                },
                "values": {
                  "type": "object"
                }
              }
            }
          },
          "page": {
            "type": "object"
          },
          "totals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "decimals": {
                  "type": "integer"
                },
                "values": {
                  "type": "object"
                }
              }
            }
          },
          "converted": {
            "type": [
              "object",
              "null"
            ]
          },
          "warnings": {
            "type": "array"
          },
          "templateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "savedReport": {
            "type": [
              "object",
              "null"
            ]
          },
          "labels": {
            "type": "object"
          }
        }
      },
      "ReportTemplates": {
        "title": "ReportTemplates",
        "description": "The ready reports and whether this key may run each (a key reads sales, refunds, tax collected, payments and items; financial and staff figures need staff permissions).",
        "type": "object",
        "required": [
          "templates"
        ],
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "group": {
                  "type": "string"
                },
                "measures": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "dimensions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "allowed": {
                  "type": "boolean"
                }
              }
            }
          },
          "branchIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The branches this key reads reports for (its own first)."
          }
        }
      },
      "Reservation": {
        "title": "Reservation",
        "type": "object",
        "required": [
          "id",
          "customerName",
          "guestCount",
          "startsAt",
          "endsAt",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "reservationNumber": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "customerPhone": {
            "type": [
              "string",
              "null"
            ]
          },
          "guestCount": {
            "type": "integer"
          },
          "startsAt": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "endsAt": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "status": {
            "type": "string",
            "enum": [
              "Requested",
              "Declined",
              "Pending",
              "Confirmed",
              "Seated",
              "Completed",
              "Cancelled",
              "No Show"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "Tables",
              "Floor"
            ]
          },
          "floorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "branchId": {
            "type": "string",
            "description": "A UUID."
          },
          "source": {
            "type": "string"
          }
        }
      },
      "ReservationCreate": {
        "title": "ReservationCreate",
        "type": "object",
        "required": [
          "customerName",
          "guestCount",
          "startsAt",
          "endsAt"
        ],
        "properties": {
          "customerName": {
            "type": "string"
          },
          "customerPhone": {
            "type": "string"
          },
          "guestCount": {
            "type": "integer"
          },
          "startsAt": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "endsAt": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "scope": {
            "type": "string",
            "enum": [
              "Tables",
              "Floor"
            ],
            "description": "Tables (the default) books tableIds; Floor books a whole floor (floorId)."
          },
          "tableIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "floorId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "Confirmed",
              "Pending"
            ],
            "description": "Confirmed when not sent."
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "ReservationStatusUpdate": {
        "title": "ReservationStatusUpdate",
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "Pending",
              "Confirmed",
              "Seated",
              "Completed",
              "Cancelled",
              "No Show"
            ]
          }
        }
      },
      "SalesSummary": {
        "title": "SalesSummary",
        "description": "Sales of the key's branch for a period of business days (the branch's own time zone and day cut-off).",
        "type": "object",
        "required": [
          "period",
          "current"
        ],
        "properties": {
          "period": {
            "type": "string"
          },
          "generatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time (UTC)."
          },
          "ranges": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object"
            }
          },
          "current": {
            "type": "object",
            "properties": {
              "netSales": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "refunds": {
                "type": "number"
              },
              "orderCount": {
                "type": "integer"
              },
              "settledCount": {
                "type": "integer"
              },
              "averageCheck": {
                "type": "number"
              },
              "cancelledCount": {
                "type": "integer"
              }
            }
          },
          "previous": {
            "type": [
              "object",
              "null"
            ]
          },
          "salesTrend": {
            "type": [
              "number",
              "null"
            ]
          },
          "ordersTrend": {
            "type": [
              "number",
              "null"
            ]
          },
          "mixedCurrency": {
            "type": "boolean"
          },
          "byCurrency": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "recentOrders": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Table": {
        "title": "Table",
        "type": "object",
        "required": [
          "id",
          "tableNo",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "tableNo": {
            "type": [
              "string",
              "integer"
            ]
          },
          "status": {
            "type": "string",
            "description": "For example Available, Booked."
          },
          "seats": {
            "type": [
              "integer",
              "null"
            ]
          },
          "floor": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "A UUID."
              },
              "name": {
                "type": "string"
              }
            }
          },
          "currentOrderId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  },
  "x-scopes": {
    "menu:read": "Read the branch menu: dishes, prices in the branch currency, categories and availability.",
    "orders:read": "Read the branch orders and one order by id.",
    "orders:write": "Price a cart (quote) and place orders for the branch. Gives no discount or price-override power.",
    "tables:read": "Read the branch tables and their state.",
    "reservations:read": "Read the branch reservations.",
    "reservations:write": "Create reservations and change their status.",
    "reports:read": "Read the sales summary and the live orders of the branch, and run or export the ready and saved reports across the key's allowed branches (sales figures only; no costs, staff or customer details).",
    "customers:read": "Find a customer by phone number or email address."
  },
  "x-rate-limits": {
    "windowSeconds": 60,
    "perKey": 300,
    "writesPerKey": 60,
    "perRestaurant": 1200
  },
  "x-changelog": [
    {
      "version": "1.2.0",
      "date": "2026-12-01",
      "changes": "Orders: split bill link fields. An order split into separate checks and every check cut from it carry splitGroupId (the original order's id); a cut check carries splitFromOrderId. checkNumber is documented. A check shared between payers carries splitPlan (frozen payer shares; each share's payment lines name it). Additive: existing fields are unchanged."
    },
    {
      "version": "1.1.0",
      "date": "2026-11-30",
      "changes": "Reports: list the ready reports, run a ready or saved report and start / follow a background export (CSV, Excel, PDF) across the key's allowed branches (its own plus the branches chosen in Automation > APIs). Totals per currency, never added across currencies."
    },
    {
      "version": "1.0.0",
      "date": "2026-11-21",
      "changes": "First version: menu, orders (list, get, quote, create), tables, reservations, sales summary, live orders and customer lookup. API keys with scopes, a per-key order setting (orders wait for staff approval unless the key is set to send them to the kitchen), per-key rate limits."
    }
  ]
}
