v1 · Stable

DirectDine Menu API

POS-neutral REST API for syncing restaurant menus. Compatible with Order Harmony Hub, Square Catalog v2, Toast Menus v2, Clover Inventory, and custom integrations.

Download OpenAPI 3.1 Generate API key

Base URL

https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1

Auth

Authorization: Bearer ddk_live_…

Webhooks

HMAC-SHA256 signed, 3 retries

Core concepts

Idempotency anchor

Every category & item carries an optional external_id — your POS's stable ID. Use it on every write to avoid duplicates and survive renames.

Minor units

All prices are integers in minor units (cents). R99.99 ⇒ 9999. Avoids floating-point drift.

Rate limit

120 req/min per key (rolling window). 429 includes Retry-After. Bulk /sync counts as a single request.

Delta sync

Pass ?updated_since=<iso> to receive only rows changed since your last poll. Combine with If-None-Match for 304s.

Per-location scoping

Every API key is bound to one specific location (branch). Reads, writes, availability toggles, and webhook events are automatically filtered to that location — plus restaurant-wide menu items that apply to all branches.

Multi-branch restaurants should generate one key per branch. A key issued for Sandton cannot read or modify the Rosebank menu, even within the same restaurant. Webhooks created with that key only fire for events scoped to its location (or restaurant-wide changes).

The location is locked at key creation and cannot be changed — revoke and re-issue to move integrations.

Quickstart

1. Fetch the full menu

curl -H "Authorization: Bearer ddk_live_xxx" \
  https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-menu

2. Bulk upsert via /sync

curl -X POST https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-write/sync \
  -H "Authorization: Bearer ddk_live_xxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "categories": [{ "external_id": "cat_burgers", "name": "Burgers", "sort_order": 1 }],
    "items": [{
      "external_id": "sku_classic",
      "category_external_id": "cat_burgers",
      "name": "Classic Burger",
      "price_minor": 9999
    }]
  }'

Add "prefer_existing": true to link to the restaurant's own dishes and categories (by an item's internal_id, else one unlinked dish with the same name) instead of adding copies.

2b. Hide what you no longer sell

curl -X POST https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-write/sync/prune \
  -H "Authorization: Bearer ddk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "item_external_ids": ["sku_classic"],
    "category_external_ids": ["cat_burgers"],
    "hide_category_names": ["Staff Meals"],
    "hide_item_names": ["Staff Burger"],
    "dry_run": true
  }'

After a full sync, hides your dishes and categories (those with an external_id) that aren't listed. Never deletes. Dishes made in DirectDine are only hidden when you name them in hide_category_names or hide_item_names (sections and dishes you switched off; combos and packs are never hidden by name). Use dry_run to see what would be hidden.

3. Quick 86 an item

curl -X PATCH https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-write/items/sku_classic/availability \
  -H "Authorization: Bearer ddk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{ "is_available": false }'

Variants & Addons

By default, /menu and /menu/items return only has_variants and has_addons flags to keep payloads lean. Pass ?include=variants,addons to embed the full configuration tree per item.

Request

# Snapshot with full variants + addons
curl -H "Authorization: Bearer ddk_live_xxx" \
  "https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-menu?include=variants,addons"

# Paginated items with full configuration
curl -H "Authorization: Bearer ddk_live_xxx" \
  "https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-menu/items?include=variants,addons&limit=50"

Both values are optional — use ?include=variants or ?include=addons independently. Omitting the parameter preserves the lightweight legacy response (fully backward compatible).

Response shape

{
  "id": "f1c2…",
  "external_id": "sku_classic",
  "name": "Classic Burger",
  "price_minor": 9999,
  "currency_code": "ZAR",
  "is_available": true,
  "has_variants": true,
  "has_addons": true,
  "variant_groups": [
    {
      "id": "vg_…",
      "name": "Size",
      "min_selection": 1,
      "max_selection": 1,
      "variants": [
        { "id": "v_single", "name": "Single", "price_minor": 9999, "is_default": true },
        { "id": "v_double", "name": "Double", "price_minor": 12999, "is_default": false }
      ]
    }
  ],
  "addon_groups": [
    {
      "id": "ag_extras",
      "name": "Extras",
      "min_selection": 0,
      "max_selection": 5,
      "addons": [
        {
          "id": "a_cheese",
          "name": "Extra Cheese",
          "price_minor": 1500,
          "is_preselected": false,
          "variant_prices_minor": { "v_double": 2000 }
        }
      ]
    }
  ]
}

Field notes

variant_groups[].min_selection / max_selection — enforce required choices (e.g. size must be picked) and caps (e.g. up to 3 toppings).

variants[].price_minor — replacement price for the item when this variant is selected (not additive).

addons[].variant_prices_minor — optional per-variant price overrides. Map of variant_id → price_minor. If the chosen variant isn't in the map, fall back to the addon's base price_minor.

addons[].is_preselected — when true, your UI should select this addon by default.

Variants without an explicit category are grouped under a synthesized "Options" group so your renderer always sees a consistent shape.

Connecting a till (POS)

One contract for every till: a hub (Order Harmony for Moog, or a Square, Clover or Lightspeed connector) pushes the till's menu with its own ids, and every order comes back with those ids, so the ticket prints exactly.

1. Connect with one call

curl -H "Authorization: Bearer ddk_live_xxx" \
  https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-menu/me

Works with any valid key. Returns the restaurant (id, name, currency), the branch for a branch key, the key's scopes and its webhooks with their health, so the hub can link itself and show "connected" as soon as a key is pasted.

2. Push sizes and add-ons with the till's ids

{
  "items": [{
    "external_id": "plu_ribeye",
    "category_external_id": "cat_grill",
    "name": "Ribeye 300g",
    "price_minor": 24900,
    "size_groups": [
      { "external_id": "set_size", "name": "Size", "required": true,
        "sizes": [
          { "external_id": "var_300", "name": "300g", "price_minor": 24900 },
          { "external_id": "var_500", "name": "500g", "price_minor": 32900 }
        ] }
    ],
    "addon_groups": [
      { "external_id": "mod_temp", "name": "Meat Temp", "min_selection": 1, "max_selection": 1,
        "addons": [
          { "external_id": "mod_rare", "name": "Rare", "price_minor": 0 },
          { "external_id": "mod_med", "name": "Medium", "price_minor": 0 }
        ] },
      { "external_id": "mod_sauce", "name": "Sauces", "min_selection": 0, "max_selection": 3,
        "addons": [ { "external_id": "mod_pepper", "name": "Pepper Sauce", "price_minor": 3500 } ] }
    ]
  }]
}

Sizes (size_groups, read back as variant_groups): each size carries the dish's full price in that size, which replaces the dish price; 0 means the dish price. Only one size group per dish may carry prices, because the chosen sizes of several groups add up. Square and Clover item variations map here.

Pick one, required: an add-on group with min_selection: 1 and max_selection: 1 (meat temperature, pizza base, pasta). Its prices are added on top, as in Moog, Lightspeed and most modifier systems. The diner must choose before Add to cart (nothing is chosen for them), and checkout refuses an order without it.

When sent, size_groups and addon_groups are the dish's whole set: groups and options not in them are removed. Leave one out to keep what was made in DirectDine. Problems come back per item as size_errors / addon_errors, and the menu read returns every external_id.

3. Orders come back with the till's ids

"items": [{
  "name": "Ribeye 300g",
  "quantity": 1,
  "unit_price": 284,
  "selected_variant": { "name": "500g", "sizes": [ { "id": "…", "name": "500g", "group": "Size" } ] },
  "selected_addons": [ { "id": "…", "name": "Medium", "quantity": 1 } ],
  "till": {
    "item_external_id": "plu_ribeye",
    "sizes":  [ { "name": "500g", "group": "Size", "external_id": "var_500" } ],
    "addons": [ { "name": "Medium", "quantity": 1, "external_id": "mod_med" } ]
  }
}]

Every order.* webhook reads the order's lines when it is sent and adds till to each one. An id the till never sent stays null; the name is always there.

Webhooks

Subscribe to real-time events instead of polling. Each delivery is signed with HMAC-SHA256.

Signature header

Format: X-DirectDine-Signature: t=<unix>,v1=<hex>
Signed payload: `${timestamp}.${rawBody}` — Stripe-style. Reject if timestamp drift > 5 minutes.

import crypto from "crypto";

export function verifyDirectDineSignature(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(",").map(p => p.trim().split("=")));
  const t = Number(parts.t);
  if (!t || !parts.v1) return false;
  if (Math.abs(Math.floor(Date.now() / 1000) - t) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret)
    .update(`${t}.${rawBody}`).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}

// Express handler — note the raw-body requirement
app.post("/webhooks/directdine",
  express.raw({ type: "application/json" }),
  (req, res) => {
    const sig = req.header("X-DirectDine-Signature");
    if (!verifyDirectDineSignature(req.body.toString(), sig, process.env.WHSEC)) {
      return res.status(400).send("invalid signature");
    }
    const event = JSON.parse(req.body.toString());
    // ... handle event
    res.sendStatus(200);
  }
);

Event types

Menu

menu.item.createdmenu.item.updatedmenu.item.deletedmenu.item.availability_changedmenu.category.createdmenu.category.updatedmenu.category.deleted

Orders (requires orders:read)

order.createdorder.paidorder.status_changedorder.completedorder.cancelledorder.refunded

Payload depth follows the payload profile set on the API key — summary (totals + status only) or full (line items, customer, addons).

Orders REST endpoints

GET /menu-api-v1-orders — list (supports ?status=, ?updated_since=, ?limit=)
GET /menu-api-v1-orders/{id} — fetch one
POST /menu-api-v1-orders — inject an external order (Uber Eats, DoorDash, etc.) — requires orders:write + location-scoped key
PATCH /menu-api-v1-orders/{id}/status — requires orders:write

Allowed status transitions: pending → preparing → ready → completed, plus cancelled. Body: { "status": "ready", "notes"?: "..." }.

Inject external order (POST /menu-api-v1-orders)

Push an order received from a marketplace (Uber Eats, DoorDash, Glovo, your own POS) into DirectDine so it lands in the kitchen, prints a ticket, and shows up in reporting. Treated as already paid — no payment is initiated. De-duplicates on (source, external_id) and supports the Idempotency-Key header (24h replay window).

curl -X POST https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-orders \
  -H "Authorization: Bearer ddk_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 5e2f1c3a-uber-12345" \
  -d '{
    "source": "uber_eats",
    "external_id": "UE-12345",
    "order_type": "delivery",
    "status": "paid",
    "customer": {
      "name": "Jane Doe",
      "phone": "+27821234567",
      "email": "jane@example.com"
    },
    "delivery_address": "9 Grafton Ave, Craighall Park, 2196",
    "special_instructions": "Ring buzzer 4B",
    "items": [
      {
        "name": "Margherita Pizza",
        "quantity": 1,
        "unit_price_minor": 12500,
        "menu_item_id": null,
        "variant": { "size": "Large" },
        "addons": [{ "name": "Extra cheese", "price_minor": 1500 }],
        "notes": "Well done"
      }
    ],
    "subtotal_minor": 14000,
    "delivery_fee_minor": 2500,
    "total_minor": 16500
  }'

Required: source, external_id, order_type (delivery | pickup), customer.name, customer.phone, items[]. delivery_address required when order_type=delivery.

Status: defaults to paid. Allowed: paid, accepted, preparing, ready.

Money: all amounts are integer minor units (cents). If subtotal_minor / total_minor are omitted they're computed from items[].

Returns: 201 with the created order. Re-posting the same (source, external_id) returns 200 with deduped: true.

Store hours endpoints

Push and pull a location's weekly schedule and date-specific overrides (closures, special hours). All keys are location-scoped, so the location is implicit. Times are 24h HH:MM; dates are YYYY-MM-DD.

GET /menu-api-v1-hours — current regular + holiday hours [hours:read]
PUT /menu-api-v1-hours/regular — replace weekly schedule [hours:write]
GET /menu-api-v1-hours/holidays — list date overrides [hours:read]
POST /menu-api-v1-hours/holidays — upsert date overrides [hours:write]
DELETE /menu-api-v1-hours/holidays/{date} [hours:write]

Replace weekly schedule (PUT /regular)

curl -X PUT https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-hours/regular \
  -H "Authorization: Bearer ddk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "regular_hours": {
      "monday":    [{"start":"09:00","end":"21:00"}],
      "tuesday":   [{"start":"09:00","end":"21:00"}],
      "wednesday": [{"start":"09:00","end":"21:00"}],
      "thursday":  [{"start":"09:00","end":"22:00"}],
      "friday":    [{"start":"09:00","end":"23:00"}],
      "saturday":  [{"start":"10:00","end":"23:00"}],
      "sunday":    []
    }
  }'

Days omitted or with empty arrays are marked closed. If a day has multiple periods we collapse to min(start)..max(end); finer-grained split shifts go on the holiday/override layer.

Upsert holiday / date overrides (POST /holidays)

curl -X POST https://ypmzikfaibkbiqdwfqba.supabase.co/functions/v1/menu-api-v1-hours/holidays \
  -H "Authorization: Bearer ddk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "holiday_hours": [
      { "date": "2026-12-25", "closed": true, "note": "Christmas Day" },
      { "date": "2026-12-31", "periods": [{"start":"10:00","end":"16:00"}], "note": "NYE early close" }
    ]
  }'

Each entry is keyed by (location_id, date). Re-posting the same date overwrites the previous entry. Use DELETE /holidays/{date} to revert to regular hours.

Retry policy

3 attempts at 30s · 5m · 30m backoff. Any 2xx response = success.

Webhooks auto-disable after 20 consecutive failures — re-enable from your Menu API settings.

10-second request timeout per attempt.

Error codes

CodeMeaning
400Validation error — check the response `error` field
401Missing or invalid API key
403Key lacks the required scope
404Resource not found (or not in your restaurant)
405Method not allowed for this endpoint
429Rate limit exceeded — see Retry-After header
500Internal error — safe to retry with same Idempotency-Key

Import the OpenAPI spec into Postman or Insomnia to scaffold a client.

View spec