Skip to content

Getting started — the 7-step happy path

Every request goes to the base URL of your key’s deployment — https://yovrgsvvkuirzofqbwfn.supabase.co/functions/v1/customer-data-api for an nt_live_ key, https://xvlolcjxgvardnirjmrz.supabase.co/functions/v1/customer-data-api for an nt_test_ key on staging — and carries the header Authorization: Bearer <your key>. Each step names the scope its call needs.

  1. GET /me (no scope) — confirm the key works and read its scopes, rate limit, key id and every enforced limit before you build anything on them: check a scope here rather than discovering a 403 in production. No key yet? Getting a key covers who issues one.

  2. POST /categories, then POST /definitions (both definitions:write) — create the category an attribute is filed under, then a customer attribute in it. A definition names an existing category, with no default and no auto-create; skip the first call when GET /categories (definitions:read) already lists one you can use.

    { "key": "pos_data", "label": "POS data" }
    {
    "entity": "customer",
    "key": "lifetime_spend",
    "label": "Lifetime spend",
    "category": "pos_data",
    "data_type": "number"
    }

    key and label are the category’s required members; entity, key, label, category and data_type are the definition’s.

  3. POST /customers (customers:write) with {"email": "…", "restaurant_id": "…", "source_system": "pos_x", "source_key": "cust-889"} — creates the guest, or reuses the one your details match, attaches your own id in the same call and answers the customer’s id, so later calls can address it as pos_x:cust-889. restaurant_id is required on a tenant with more than one active restaurant: read the ids from GET /restaurants (no scope). On a single-restaurant tenant you may omit it. A customer holds one key per system, so other integrations’ keys on the same guest never block yours. The call answers 409 only when the guest already holds a different key of your system, or a record this API does not acknowledge holds this pair — see “Creating a customer” and “One key per system per record”. To look up a guest that already exists instead, POST /customers/resolve with {"email": "…"} or {"phone": "…"}: it only reads, needs contacts:read, and answers an empty matches when nobody matches.

  4. PATCH /customers/pos_x:cust-889/attributes (or /customers/{id}/…; attributes:write) with {"values": {"lifetime_spend": 1250}} — write values.

  5. GET /customers/pos_x:cust-889 (customers:read) — read back the summary + values. The values member needs attributes:read as well, and is absent without it.

  6. GET /segments then GET /segments/{id}/customers (segments:read) — poll a segment’s members (built by the restaurant in the Nine Tables app).

  7. POST /webhooks (webhooks:manage, plus the read scopes of the events you subscribe to) — register for customer, segment and booking events instead of polling. Webhooks lists the scopes each family needs and how to verify a delivery.