Getting started — the 7-step happy path
Every request goes to the base URL of your key’s deployment —
https://umqgbvlvbcwhqrnbfchs.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.
-
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. -
POST /categories, thenPOST /definitions(bothdefinitions: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 whenGET /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"}keyandlabelare the category’s required members;entity,key,label,categoryanddata_typeare the definition’s. -
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’sid, so later calls can address it aspos_x:cust-889.restaurant_idis required on a tenant with more than one active restaurant: read the ids fromGET /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/resolvewith{"email": "…"}or{"phone": "…"}: it only reads, needscontacts:read, and answers an emptymatcheswhen nobody matches. -
PATCH /customers/pos_x:cust-889/attributes(or/customers/{id}/…;attributes:write) with{"values": {"lifetime_spend": 1250}}— write values. -
GET /customers/pos_x:cust-889(customers:read) — read back the summary + values. Thevaluesmember needsattributes:readas well, and is absent without it. -
GET /segmentsthenGET /segments/{id}/customers(segments:read) — poll a segment’s members (built by the restaurant in the Nine Tables app). -
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.