Order Docs / API Guide
Overview
The Order platform exposes all of its services through a single API gateway. Every client — storefront, admin dashboard, mobile apps, operations — talks to the gateway; it authenticates the application, verifies the end user, enforces per-endpoint permissions and rate limits, then routes the request to the owning service.
Base URL
All requests go to the API gateway. Every service is mounted under a fixed public prefix
(/api/v1/<service>):
GET https://api.tryordersystem.com/api/v1/promocode/promocodes/view/123Switch the target gateway with the environment selector in the top bar. The full list of services and prefixes is in the API Reference.
Request lifecycle
On protected routes the gateway runs these checks in order — the order explains which error you get first:
- 1Route matchunknown path404
- 2App authenticationapp JWT missing / expired / bad signature401
- 3Revocation checkthe token or the application has been revoked401
- 4Identity resolvedthe verified tenant and application identity are attached to the request; any client attempt to spoof them is stripped
- 5Rate limitchecked before user validation, so over-quota requests are rejected early429
- 6User authorizationvalidates the customer / employee token and checks the required permission401 / 403
- 7Forward to servicethe request is routed to the owning service200
Two authentication layers
The platform authenticates at two independent levels — do not confuse them:
| Layer | Credential | Header | Issued by |
|---|---|---|---|
| Application (the calling app) | app JWT, 1 h TTL | Authorization: Bearer <app JWT> | gateway POST /auth/token |
| End user (customer / employee) | user token | x-authorization-token · x-authorization-employee-token | the login endpoints |
Every request to a protected route needs the app JWT. Endpoints gated by a user-level rule additionally need the matching user token — see Authentication and Authorization.
Multi-tenancy
x-tenant header sent with an API request is ignored and stripped — switching
tenant means requesting a new token. Downstream services receive the verified tenant in the
injected x-tenant header.Health & availability
- Every upstream is health-checked actively (probe every 5 s; 2 successes → up, 3 failures → down) and passively (real
5xxresponses demote a node). - A service with no healthy node returns 503 from the gateway.
- Multi-node upstreams are load-balanced with automatic failover.
Order Docs / API Guide / Authentication
Authentication
Two independent layers: the application authenticates to the gateway (app JWT), and the end user — customer or employee — authenticates with a user token. Most requests carry both.
1 · Application token — POST /auth/token
Issued by the gateway's auth service after database checks. Required for every protected route.
POST /auth/token Content-Type: application/json x-tenant: <tenant-slug> ← required; the tenant this token is bound to {"username": "<app username>", "password": "<app password>"}
What is verified
- 1Credentialsusername / password checked against the application registry; the application must be active
- 2Not blockedan app hard-stopped by an admin cannot obtain new tokens403
- 3Tenant grantthe app must be granted the requested tenant403
- 4Application registered for the tenantthe tenant must have an application registered for it403
- 5Token issueda signed bearer token is returned with the claims below200
Responses
| Status | Body message | Meaning |
|---|---|---|
| 200 | — | {"access_token":"<JWT>","token_type":"Bearer","expires_in":3600} |
| 400 | username and password are required · x-tenant header is required · invalid JSON body | missing input |
| 401 | invalid credentials | unknown username, wrong password, or inactive app |
| 403 | application is blocked | admin-blocked app |
| 403 | application has no access to this tenant | tenant not granted to this app |
| 403 | no application link for this tenant | tenant has no link application |
| 429 | too many failed attempts, try again later | brute-force throttle — details |
Granted tenants — POST /auth/tenants
Lists the tenants your application may request a token for — use it to pick the
x-tenant value before calling /auth/token. Same credentials,
no x-tenant header.
POST /auth/tenants Content-Type: application/json {"username": "<app username>", "password": "<app password>"}
{
"app_id": "<uuid>",
"all_tenants": false,
"tenants": ["tenant-a", "tenant-b"]
}| Field | Meaning |
|---|---|
| tenants | tenants granted to the app by name, sorted; empty when none |
| all_tenants | true = the app may request any existing tenant; those are not enumerated in tenants |
Credential checks and errors are the same as /auth/token:
400 missing input / invalid JSON ·
401 invalid credentials ·
403 application is blocked ·
429 brute-force throttle (failed attempts count against the same limit).
Token contents
The token is an opaque bearer credential — send it verbatim in the Authorization
header. It encodes the tenant it is bound to and its expiry (TTL 3600 s / 1 hour); when
it expires, request a new one.
Using the token
GET /api/v1/menu/menus
Authorization: Bearer <app JWT>| Status | Cause | Client action |
|---|---|---|
| 401 | header missing, token expired, or bad signature | fetch a new token from /auth/token |
401 token revoked | this token was revoked by an admin | fetch a new token |
401 application blocked | the whole app was stopped by an admin | stop retrying; contact ops |
WWW-Authenticate: Bearer (RFC 9110).Tenant branding — GET /api/v1/tenant/branding
Everything a client needs to theme itself for the tenant in one call: the tenant's
details, logo, colors, images and font. The tenant is the one bound to your app token
— no x-tenant header or parameter; to read another tenant, request a token for it.
Send x-localization: ar|en to pick the language of name.
GET /api/v1/tenant/branding
Authorization: Bearer <app JWT>{
"data": {
"tenant": {
"slug": "tenant-a",
"name": "Diner",
"names": {"ar": "مطعم", "en": "Diner"},
"logo": "https://…/logo.png",
"country": "SA",
"type": "restaurant",
"domain": "tenant-a.order.sa",
"currency": {"iso": "SAR", "digits": 2, "names": {"ar": "…", "en": "…"}}
},
"website": {
"colors": {"buttons_background_color": "#EF2811", "body_text_color": "#000000", …},
"images": {"logo": "…", "favicon": "…", …},
"font_family": "IBM+Plex+Sans+Arabic"
},
"app": {
"colors": {"background_color": "#FFFFFF", "secondary_color": "…", …},
"images": {"logo": "…", "navbar_logo": "…", …},
"font_family": null
}
}
}| Field | Meaning |
|---|---|
| tenant | identity: name (in the request language, and every language in names), main logo, country, type, storefront domain, currency |
| website | the web storefront's look |
| app | the mobile app's look |
| colors · images | key → value; the tenant's own value, else the platform default. Unset images are null |
Errors: 401 missing / expired / revoked app token (as any protected route) · 404 the token's tenant no longer exists. Changes to the tenant's settings show up immediately.
2 · End-user authentication
End users sign in through the login endpoints (app JWT still required — these endpoints are public, meaning no user token is needed to call them).
Customer registration & login
| Endpoint | Method | Purpose |
|---|---|---|
| /api/v1/user/customers/signup | POST | register a new customer |
| /api/v1/user/customers/login | POST | credentials login |
| /api/v1/user/customers/otp-login | POST | OTP login |
| /api/v1/user/customers/get-code | POST | request an OTP / verification code |
| /api/v1/user/customers/login-dine-in | POST | dine-in (table) login |
| /api/v1/user/customers/forget-password | POST | start password reset |
| /api/v1/user/customers/reset-password | POST | complete password reset |
| /api/v1/user/customers/logout | POST | logout — requires customer |
Employee login
| Endpoint | Method | Purpose |
|---|---|---|
| /api/v1/user/employees/login | POST | staff login |
| /api/v1/user/employees/logout | POST | logout — requires employee |
| /api/v1/user/employees/details | GET | current employee profile + permissions |
| /api/v1/user/employees/permissions | GET | permission list |
Presenting the user token
| Header | Audience | On failure |
|---|---|---|
| x-authorization-token: Bearer <token> | customer | silent — the request proceeds without customer identity (guarded endpoints then refuse) |
| x-authorization-employee-token: Bearer <token> | employee | 401 rejects the request |
The gateway validates the token and attaches the verified user identity to the request for the receiving service — see Headers. Customer identity is cached for 1 hour.
Bearer , Bearer undefined, Bearer null are
treated as "no credentials" — you get *_auth_required (show login), never
*_token_invalid (session expired).2b · Partner apps
A partner app is a third-party app published by Order and installed by each store from its control panel (the store reviews and grants the scopes).
- The store owner and staff keep signing in with their own accounts (/api/v1/user/employees/login), as before.
- The partner app never signs in as an employee and never receives an employee token. Do not call /employees/login and do not send
x-authorization-employee-token.
How a partner app authenticates
- POST /auth/tenants (app username + password): the stores where the app is installed and enabled.
- POST /auth/token with
x-tenant: <store>: the same request as section 1. - Call the API with only
Authorization: Bearer <app JWT>.
POST /auth/token Content-Type: application/json x-tenant: <store-slug> {"username": "<app username>", "password": "<app password>"} GET /api/v1/order/... Authorization: Bearer <app JWT>
Each installation acts as its own hidden integration employee in that store, holding exactly the permissions of the scopes the store granted. The gateway resolves the app token to that identity on every request, so the app can do what those scopes allow and nothing more. That identity cannot log in and is not visible to the store's staff.
Authorization: Bearer <JWT>. ?jwt=, a cookie or a bare token get 401.Token errors (partner apps)
| Status | Message | Meaning |
|---|---|---|
| 403 | application is not available | the app is not published (draft, or suspended by Order) |
| 403 | application is not installed for this tenant | the store has not installed the app |
| 403 | installation is disabled | the store disabled the app (or it is being uninstalled) |
| 409 | installation is not ready | the installation is still being set up; retry shortly |
Request errors (partner apps)
| Status | error | Meaning |
|---|---|---|
| 401 | installation_revoked | the store disabled or uninstalled the app; stop and request no new token |
| 403 | integration_route_not_allowed | the endpoint is not available to partner apps |
| 403 | permission denied | the store did not grant the scope this endpoint needs (see Authorization) |
| 503 | integration_identity_unavailable | temporary; retry with backoff |
Scopes
| Scope | Grants |
|---|---|
orders:read | read orders (sensitive) |
orders:write | manage orders |
delivery:write | manage delivery |
menu:read / menu:write | read / manage the menu |
branches:read / branches:write | read / manage branches |
customers:read / customers:write | read (sensitive) / manage customers |
coupons:read / coupons:write | read / manage coupons |
reservations:write | manage reservations |
payments:read | read payments (sensitive) |
reports:read | read reports (sensitive) |
Wallet, points and gift cards are not offered to partner apps.
To link a store that installed your app to an account in your system, and to receive install and uninstall events, see OAuth install flow.
3 · Token revocation (admin)
JWTs are stateless, so revocation is a denylist checked on every protected request. Both
endpoints are admin-only (X-Admin-Key header):
POST /auth/revoke {"token": "<JWT>"} revoke ONE token POST /auth/revoke-app {"app_id": "<uuid>"} revoke ALL of an app's tokens
- Revoking an app rejects every token issued before the revocation; tokens issued after work normally.
- Denylist entries expire when the tokens would have expired anyway (self-cleaning).
- The check fails open: if the denylist store is down, requests pass (and are logged) — an outage cannot lock the platform out.
- An admin can also block an app entirely: existing tokens get
401 application blockedand/auth/tokenreturns403until unblocked.
Security properties
- Spoof-proof headers — the gateway strips every identity header from client input (dash and underscore spellings) before injecting verified values.
- Brute-force throttle — 10 failed logins per username per 15 min → 429 (resets on success).
- Auditing — every security event (logins, throttles, blocks, revocations, denials) is one structured log line; passwords and tokens are never logged.
Order Docs / API Guide / OAuth install flow
OAuth install flow
How a partner app links a store that installed it to an account in the partner's own system, and the events it receives when a store installs, disables or uninstalls it. Partner apps authenticate as described in Authentication.
1 · Connecting a store
The install works like an OAuth 2.0 authorization code grant: the store approves your app in its control panel, you receive a short-lived one-time code (by redirect, or as a manual code), and your server exchanges it with your app credentials for the store's installation.
/auth/tenants tells you which stores installed your app, not who in your own system owns them. Never link a store to one of your accounts because a user typed its name. Link a store only from a one-time install code that you exchange with your app credentials: Order hands that code to the person who actually installed the app in the store.
- Send the signed-in user to the store's app page (recommended), with your own random
state(≤ 256 characters) kept in their session: https://<store>.cp2.tryorder.net/apps/<your-app-slug>?state=<random> - The store installs the app (or uses Connect again when it is already installed). Then:
- If your app has an install redirect URL, the browser is sent to it with
?code=<code>&state=<state>(stateonly when you sent one; the store name is never in the URL). Checkstateagainst the user's session first. - Otherwise the store sees a manual code
XXXX-XXXX-XXXXto paste into your app (case-insensitive; dashes and spaces ignored).
- If your app has an install redirect URL, the browser is sent to it with
- Exchange the code, server to server, while that user's session is open.
POST /auth/installations/exchange Content-Type: application/json {"username": "<app username>", "password": "<app password>", "code": "<code>", "state": "<state, when you sent one>"} 200 {"installation_id": "bd64ccab-…", "tenant": "burger", "store": {"name": "burger", "domain": "burger.tryorder.net"}, "scopes": ["menu:read", "orders:read"], "installed_at": "2026-11-26T21:29:15Z"}
Link tenant / installation_id to the signed-in account, then use
POST /auth/token with x-tenant: <tenant> as above.
| Status | Message | Meaning |
|---|---|---|
| 200 | — | the code was valid; it is now used up |
| 400 | invalid or expired code | unknown, already used, expired, issued to another app, wrong state, or the installation is no longer active: one answer for every case |
| 400 | username and password are required · code is required · state must be a string · invalid JSON body | bad input |
| 401 | invalid credentials | wrong app credentials; the code is not used up |
| 403 | application is blocked | the app was stopped by Order; the code is not used up |
| 429 | too many failed attempts, try again later | refused codes count as failed logins for your username |
- A code works once. Redirect codes expire after 10 minutes, manual codes after 15 minutes. A new code for the same store replaces the previous unused one.
- A code refused for a wrong
stateis used up: ask the store to use Connect again. - The store owner is notified by SMS each time a store is connected to your app.
2 · Webhook events for partner apps
Your app's webhook receives the data events of the scopes each store granted, and these lifecycle events for every store, whatever the scopes, including after the store disabled or uninstalled the app:
| Event | When |
|---|---|
app.installed | a store installed the app |
app.enabled | the store re-enabled the app |
app.disabled | the store disabled the app; no data events until it is enabled again |
app.scopes_changed | the scopes the store granted changed |
app.uninstalled | the store uninstalled the app; stop using its tenant |
POST <your webhook URL> Content-Type: application/json X-Webhook-Event: app.installed X-Webhook-Id: <event_id> X-Webhook-Delivery: <delivery uuid> X-Webhook-Tenant: <store> X-Webhook-Timestamp: <unix ts> X-Webhook-Signature: t=<unix ts>,v1=<hex hmac_sha256(signing secret, "{t}.{raw body}")> {"event": "app.installed", "version": 1, "event_id": "5f0c…", "occurred_at": "2026-11-26T21:29:16+00:00", "tenant": "burger", "data": {"installation_id": "bd64ccab-…", "app_slug": "your-app", "scopes": ["menu:read", "orders:read"], "store": {"name": "burger", "domain": "burger.tryorder.net"}}}
- Verify
X-Webhook-Signaturewith your endpoint's signing secret (given once when the app is created) and reject timestamps older than 5 minutes. - Retries reuse the same
event_id: de-duplicate on it. - A lifecycle event never contains a code, a token or an employee id. It tells you a store's state; it is not proof of who owns the store: link stores only through the code exchange above.
Order Docs / API Guide / Authorization
Authorization
Beyond the application token, an endpoint may require an end-user identity — a logged-in customer, or an employee holding a specific permission. Each endpoint states exactly what it needs in its Authorization field; this page explains that vocabulary.
Authorization vocabulary
| Guard | Allows |
|---|---|
| public | anyone with a valid app JWT — no user identity needed |
| customer | an authenticated customer |
| employee | any authenticated employee |
| employee:<permission> | an employee holding that store permission |
| op | an employee of an operations app |
| op:<permission> | an operations employee holding that permission |
| any_auth | a customer or an employee |
| internal | nobody — service-to-service only; the public edge refuses with 403 internal_endpoint |
403 unknown_guard).Shared endpoints (OR rules)
A rule may list several guards; the request passes when any one is satisfied. Used for
endpoints legitimately shared between audiences, e.g. GET /api/v1/menu/menus allows
any of employee:view_menus
employee:add_coupons
employee:update_coupons
employee:discounts. An OR never widens access beyond its own
branches.
Two permission sets
There is no permission called op — that guard only asserts the app type. Store staff
and operations staff each have their own set of permission slugs:
| Audience | Guard form | Example permissions |
|---|---|---|
| Store staff | employee:<perm> | orders_page add_menus allow_refund_order |
| Operations | op:<perm> | view_orders view_stores impersonate_manager |
Permissions are granted to roles, and an employee inherits them from their role.
The 401 / 403 contract
401 = no valid credentials (authenticate and retry). 403 = credentials accepted, but not allowed (retrying changes nothing). An expired token and a missing token are both 401.
A 403 names the missing permission and the endpoint:
{
"error": "permission_denied",
"required": ["allow_refund_order"],
"method": "POST",
"path": "/api/v1/order/orders/refund",
"message": "permission denied: 'allow_refund_order' is required for POST /api/v1/order/orders/refund"
}For an OR rule, required lists every acceptable permission. A 401
deliberately carries none of this — an anonymous caller must not be handed the authorization
map.
403 tells you exactly which permission
is missing on which route, so it is safe to surface to the user as "no access". See
Responses & Errors, in particular: never treat every 401 as "log
out".Per-endpoint authorization
Every endpoint's exact requirement is on its page in the API Reference. Path matching follows a few simple rules:
{param}matches exactly one path segment; a trailing*matches anything.- The most specific (longest) path wins when several could match.
Order Docs / API Guide / Headers
Headers
The headers you send with a request, and the headers you get back in the response.
Headers clients send
| Header | Required | Purpose |
|---|---|---|
| Authorization: Bearer <app JWT> | protected routes | application authentication |
| x-tenant | only on POST /auth/token | which tenant to bind the token to. Ignored / stripped on all other calls |
| x-authorization-token | customer-guarded endpoints | the customer's session token (Bearer <t>) |
| x-authorization-employee-token | employee/op-guarded endpoints | the staff session token |
All of the above are in the CORS allow-list for browser clients (credentials disabled).
Verified identity
x-tenant at login.Response headers
| Header | When | Meaning |
|---|---|---|
| X-RateLimit-Limit · X-RateLimit-Remaining | rate-limited routes | quota state — details |
| WWW-Authenticate: Bearer | every 401 | RFC 9110 compliance |
| Content-Type: application/json | gateway-generated errors | gateway error bodies are always JSON |
Order Docs / API Guide / Rate Limiting
Rate Limiting
All quotas are enforced at the gateway and shared across gateway nodes — the quota is global, not per-node.
API quota
- The key is the credential application (from the verified JWT claim — spoof-proof) plus the tenant. An app serving several tenants gets an independent bucket per tenant; two different apps calling the same tenant do not share a bucket.
- The count is checked before end-user validation, so over-quota requests are rejected cheaply.
- Over limit → 429 with message
rate limit exceeded.
Response headers
X-RateLimit-Limit: 120 ← the quota X-RateLimit-Remaining: 87 ← requests left in the current window
On 429 the body is JSON:
{"error_msg": "rate limit exceeded"}X-RateLimit-Remaining and back off before hitting zero; on 429, retry after the
window resets (up to 60 s). Do not retry immediately in a loop — the window is fixed, not
sliding.Login throttle
- Counted per username, only on failed attempts; a successful login resets the counter.
- While throttled,
/auth/tokenreturns 429 even with correct credentials. - Window: 15 minutes.
Order Docs / API Guide / Responses & Errors
Responses & Errors
Gateway-generated errors are always JSON, and every 401 carries
WWW-Authenticate: Bearer. Upstream service errors pass through untouched.
Branch on the error slug, never on message — messages get
reworded.
{"error": "<slug>", "message": "<human text>"} // 403s also carry required / method / pathThe slug table
| Status | error | Meaning | What the client should do |
|---|---|---|---|
| 401 | (none — app auth) | app JWT missing / expired / bad signature | fetch a new app token from /auth/token |
| 401 | (none) token revoked | this app token was revoked | fetch a new app token |
| 401 | (none) application blocked | the app was stopped by an admin | stop; contact ops |
| 401 | customer_auth_required | no customer credentials presented | show the login screen |
| 401 | customer_token_invalid | customer token presented and rejected | session expired → re-authenticate |
| 401 | employee_auth_required | no employee credentials presented | show the staff login |
| 401 | employee_token_invalid | employee token presented and rejected | session expired → re-authenticate |
| 401 | auth_required | several audiences accepted, none presented | show login |
| 401 | session_invalid | several audiences accepted, presented token rejected | re-authenticate |
| 403 | permission_denied | logged in, lacks the permission | show "no access" — do not log out |
| 403 | admin_access_required | staff, but the app is not an operations app | show "no access" |
| 403 | internal_endpoint | service-to-service endpoint hit from the public edge | don't call this |
| 403 | unknown_guard | misconfigured rule (fails closed) | report a bug |
| 429 | (none) | rate limit / login throttle | back off — details |
| 404 | (none) | no route matched | check the path |
| 503 | (none) | no healthy upstream node | retry with backoff |
Rules clients must follow
- 1Never treat every 401 as "log out and clear the session"a logged-in customer touching a staff-only endpoint gets
employee_auth_required— wiping their session would be wrong. Only*_token_invalid/session_invalidmean "your session died". - 2401 vs 403 is remedial401 → authenticate and retry; 403 → retrying changes nothing, the account lacks a grant
- 3Empty bearer values are "absent", not "invalid"
Bearer,Bearer undefined,Bearer null→*_auth_required
403 bodies name the fix
{
"error": "permission_denied",
"required": ["view_branches", "order_details_page"],
"method": "GET",
"path": "/api/v1/branch/branches/7",
"message": "permission denied: GET /api/v1/branch/branches/7 requires one of 'view_branches', 'order_details_page'"
}required / method / path appear on 403 only — a 401
caller has no identity, and naming permissions would hand the authorization map to anonymous
callers.
Order Docs / API Guide / Webhooks
Webhooks
How platform events reach you, and how to verify them. When a subscribed event
occurs, we send an HTTP POST with a JSON body to your endpoint URL.
Delivery
- A delivery is considered successful on a 2xx response.
- On failure we retry up to 5 times with exponential backoff (10 s → 1 m → 5 m → 30 m).
- 4xx responses (except 429) are not retried — check your URL / signature.
- The same event may be delivered more than once — use
X-Webhook-Idto deduplicate (idempotency). - Respond quickly (within a few seconds) and process asynchronously.
Request headers
| Header | Meaning |
|---|---|
| X-Webhook-Event | Event name (e.g. OrderCreatedEvent) |
| X-Webhook-Id | Event id — use it to avoid processing duplicates (idempotency) |
| X-Webhook-Delivery | Delivery id (uuid) |
| X-Webhook-Timestamp | Unix timestamp |
| X-Webhook-Signature | HMAC-SHA256 signature of the body — see Signature verification below |
| X-Webhook-Tenant | Store identifier (sent for global endpoints only) |
Payload shape
Every event arrives in the same envelope; the data object varies by event type:
{
"event": "OrderCreatedEvent",
"event_id": "9f1c8a2e-7d3b-4a10-9b2c-1e5f0a4d8c22",
"occurred_at": "2026-06-30T12:28:50+00:00",
"data": { /* depends on the event — see examples below */ }
}Signature verification (HMAC-SHA256)
Every request is signed with the X-Webhook-Signature header. The signature is
hmac_sha256(raw_body, signing_secret) encoded as hex. Recompute it on your side
and compare using a constant-time comparison before trusting the request.
<?php // raw body as received (do not re-encode the JSON) $payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? ''; $secret = 'whsec_...'; // your endpoint's signing secret $expected = hash_hmac('sha256', $payload, $secret); if (! hash_equals($expected, $signature)) { http_response_code(401); exit; // invalid signature — ignore the request } // valid — process the event, then return 2xx $event = json_decode($payload, true); http_response_code(200);
const crypto = require("crypto"); // pass the raw body: app.use(express.raw({ type: "*/*" })) function isValid(rawBody, signature, secret) { const expected = crypto.createHmac("sha256", secret).update(rawBody).digest("hex"); const a = Buffer.from(expected); const b = Buffer.from(signature || ""); return a.length === b.length && crypto.timingSafeEqual(a, b); } app.post("/webhook", (req, res) => { if (!isValid(req.body, req.get("X-Webhook-Signature"), "whsec_...")) { return res.status(401).end(); } const event = JSON.parse(req.body.toString()); res.status(200).end(); });
The signing_secret is shown once when the endpoint is created, and can be
regenerated on demand.
Supported events
| Event | X-Webhook-Event |
|---|---|
| Coupon created | CouponCreatedEvent |
| Coupon updated | CouponUpdatedEvent |
| Coupon deleted | CouponDeletedEvent |
| Order created | OrderCreatedEvent |
| Order canceled | OrderStatusUpdatedEvent |
| Order completed | OrderCompletedEvent |
Coupon created — CouponCreatedEvent
{
"id": 1234,
"code": "SUMMER20",
"type": "percentage",
"value": 20,
"tenant": "burger",
"max_uses": 100,
"starts_at": "2026-06-01",
"expires_at": "2026-09-01",
"is_active": true
}Coupon updated — CouponUpdatedEvent
Same shape as creation, after the update.
{
"id": 1234,
"code": "SUMMER25",
"type": "percentage",
"value": 25,
"tenant": "burger",
"is_active": true
}Coupon deleted — CouponDeletedEvent
{
"id": 1234,
"code": "SUMMER25",
"tenant": "burger"
}Order created — OrderCreatedEvent
{
"id": 5001,
"order_code": "OR-5001",
"tenant": "burger",
"status": "new",
"type": "delivery",
"total": 84.50,
"currency": "SAR",
"branch_id": 12,
"customer": { "id": 200, "name": "Sara", "mobile": "+9665XXXXXXX" },
"items": [ { "name": "Burger", "qty": 2, "price": 30.00 } ],
"created_at": "2026-06-30T12:00:00+00:00"
}Order canceled — OrderStatusUpdatedEvent
Cancellation arrives as a status update where status = "canceled".
{
"id": 5001,
"order_code": "OR-5001",
"tenant": "burger",
"status": "canceled",
"updated_at": "2026-06-30T12:20:00+00:00"
}Order completed — OrderCompletedEvent
{
"id": 5001,
"order_code": "OR-5001",
"tenant": "burger",
"status": "completed",
"completed_at": "2026-06-30T12:45:00+00:00"
}Order Docs / API Guide / Tenant
Tenant details & settings
Read a tenant's identity (name, logo, domain, currency) and its storefront / app settings (colors, images, font, behaviour). All of these need only the app token — they are public, no customer or staff login.
Which one to call
| You need | Call |
|---|---|
| Logo, colors, images and font, already grouped | GET /api/v1/tenant/branding |
| Tenant identity only (name, logo, contact, domain, currency, timezone…) | GET /api/v1/tenant/tenants/get-tenant-by-slug/{slug} |
Any settings group, as raw key / value pairs | GET /api/v1/tenant/defaultSettings/getSettingByGroups |
| Everything to boot a storefront in one read | GET /api/v1/tenant/bootstrap/init |
Send x-localization: ar|en to choose the language of translated values
(title, multi-language settings).
1 · Tenant details — GET /api/v1/tenant/tenants/get-tenant-by-slug/{slug}
{slug} is the tenant slug (e.g. tenant-a).
GET /api/v1/tenant/tenants/get-tenant-by-slug/tenant-a
Authorization: Bearer <app JWT>| Query | Meaning |
|---|---|
| with | optional — mobiles to include mobile_tenants |
{
"data": {
"name": "tenant-a",
"title": "Diner",
"email": "[email protected]",
"mobile": "5XXXXXXXX",
"logo": "https://…/logo.png",
"country": "SA",
"country_phone_code": "966",
"timezone": "Asia/Riyadh",
"domain": "tenant-a.order.sa",
"tracking_codes": [],
"mobile_tenants": [],
"currency": {"names": {"ar": "…", "en": "…"}, "iso": "SAR", "digits": 2},
"is_store_enabled": true
}
}| Field | Meaning |
|---|---|
| name | the tenant slug (the value of x-tenant) |
| title | display name, in the request language |
| email · mobile | the tenant's contact email and mobile |
| logo | main logo URL |
| country · country_phone_code · timezone | country code, its dialling code, and the tenant's timezone |
| domain | the canonical storefront host |
| tracking_codes | always empty here — use trackingCodes from §3 |
| mobile_tenants | the tenant's mobile numbers (id, country_code, mobile) — only with ?with=mobiles, else [] |
| currency | iso code, decimal digits, localized names |
| is_store_enabled | true when at least one branch has online store enabled |
Errors: 401 app token missing / expired · 404 no tenant with that slug.
2 · Settings — GET /api/v1/tenant/defaultSettings/getSettingByGroups
Returns every setting in the requested groups for the tenant bound to your app token. Each value is the tenant's own value, otherwise the platform default.
GET /api/v1/tenant/defaultSettings/getSettingByGroups?groups=website,app
Authorization: Bearer <app JWT>| Query | Meaning |
|---|---|
| groups | required — comma-separated group names |
| Group | Holds |
|---|---|
website | web storefront look: colors, logo, favicon, font, banners, open/closed |
app | mobile app look: colors, logos |
general | languages (default_lang, available_lang), tax, customer profile rules |
social | social links and app-store download links |
order · checkout · payment · language · marketing | ordering, checkout and payment behaviour, translations, marketing |
reservation · waitingList · dine_in | reservation, waiting-list and dine-in pages |
{
"data": [
{"key": "website.buttons_background_color", "value": "#EF2811", "values": null},
{"key": "website.logo", "value": "https://…/logo.png", "values": null},
{"key": "website.site_name", "value": "Diner", "values": {"ar": "مطعم", "en": "Diner"}},
{"key": "app.secondary_color", "value": "#111111", "values": null}
]
}| Field | Meaning |
|---|---|
| key | <group>.<name> |
| value | the value, in the request language for multi-language settings |
| values | every language ({"ar","en"}) for multi-language settings, else null |
The two app-store links in social also carry ios_app_id /
android_package_id, parsed from the link.
Errors: 401 app token missing / expired ·
422 groups missing.
3 · Storefront bootstrap — GET /api/v1/tenant/bootstrap/init
The reads a storefront needs at start-up, merged into one response for the token's tenant. Each part is identical to calling its own endpoint.
GET /api/v1/tenant/bootstrap/init?groups=general,website,app&place=web
Authorization: Bearer <app JWT>| Query | Meaning |
|---|---|
| groups | settings groups for defaultSettings, as in §2 |
| place | web or mobile — which tracking codes to return |
{
"data": {
"mainAppSettings": {"app_id": "…", "app_type": "single", "main_tenant": "tenant-a", "tenants": ["tenant-a"], "countries": ["SA"], … },
"tenant": { …tenant details, plus blocks_settings and meta_tags… },
"trackingCodes": [ … ],
"defaultSettings": [ {"key": "…", "value": "…", "values": null}, … ]
},
"errors": [ {"key": "trackingCodes", "message": "…"} ]
}| Part | Same as | If it fails |
|---|---|---|
| mainAppSettings | the app's settings: type, tenants, countries and currencies | whole call fails |
| tenant | tenant details as in §1, plus blocks_settings (home-page layout) and meta_tags (page-head meta entries); without email / mobile | whole call fails |
| defaultSettings | §2 getSettingByGroups | whole call fails |
| trackingCodes | marketing / analytics tags for place | null, reason listed in errors |
Order Docs / API Reference
API Reference
Authorization breakdown
Services
| Service | Public prefix | Auth | Endpoints |
|---|