Skip to content

Authentication

Send Authorization: Bearer nt_live_… on every request. Each key carries scopes. The ApiScope component lists, for every scope, the operations that require it and the requests that need it on top of their operation’s own scope; a request without a scope it needs answers 403 insufficient-scope naming the missing scope. Call GET /me first — it reports your key id, its scopes and its rate limit, so you can check a scope before a call rather than discovering the gap as a 403 in production, and it is the only place your key id (the Idempotency-Key dedupe scope) is disclosed. GET /me itself requires no scope, and a key can only ever describe itself: it also returns the key’s restaurant limit and limits, every limit the deployment enforces.

Every operation requires at most one scope of its own:

OperationScope
GET /menone (any key)
GET /categoriesdefinitions:read
GET /categories/{key}definitions:read
POST /categoriesdefinitions:write
PATCH /categories/{key}definitions:write
DELETE /categories/{key}none (always answers 405)
GET /definitionsdefinitions:read
GET /definitions/{entity}/{key}definitions:read
POST /definitionsdefinitions:write
PATCH /definitions/{entity}/{key}definitions:write
DELETE /definitions/{entity}/{key}none (always answers 405)
GET /customerscustomers:read
GET /customers/countcustomers:read
GET /customers/{customerRef}customers:read (values only with attributes:read)
POST /customerscustomers:write
POST /customers/resolvecontacts:read
GET /customers/{customerRef}/attributesattributes:read
PATCH /customers/{customerRef}/attributesattributes:write
PUT /customers/{customerRef}/source-identityattributes:write
DELETE /customers/{customerRef}/source-identity/{sourceSystem}attributes:write
GET /customers/{customerRef}/bookingsbookings:read
GET /bookingsbookings:read
GET /bookings/{bookingRef}bookings:read
POST /bookingsbookings:write
PATCH /bookings/{bookingRef}bookings:write
GET /bookings/{bookingRef}/attributesattributes:read
PATCH /bookings/{bookingRef}/attributesattributes:write
PUT /bookings/{bookingRef}/source-identityattributes:write
DELETE /bookings/{bookingRef}/source-identity/{sourceSystem}attributes:write
GET /customers/{customerRef}/loyaltyloyalty:read
POST /loyalty/membersloyalty:write
POST /loyalty/members/importloyalty:import (a key that reaches every restaurant)
GET /availabilitynone (any key)
GET /restaurantsnone (any key)
GET /restaurants/{restaurantId}/areasnone (any key)
GET /restaurants/{restaurantId}/tablesnone (any key)
GET /restaurants/{restaurantId}/experiencesnone (any key)
POST /batchattributes:write
GET /segmentssegments:read
GET /segments/{id}segments:read
GET /segments/{id}/countsegments:read
GET /segments/{id}/customerssegments:read
GET /webhookswebhooks:manage
POST /webhookswebhooks:manage
GET /webhooks/{id}webhooks:manage
PATCH /webhooks/{id}webhooks:manage
DELETE /webhooks/{id}webhooks:manage
POST /webhooks/{id}/rotate-secretwebhooks:manage
POST /webhooks/{id}/testwebhooks:manage
GET /webhooks/{id}/deliverieswebhooks:manage
GET /webhooks/{id}/deliveries/{deliveryId}webhooks:manage
POST /webhooks/{id}/deliveries/{deliveryId}/redeliverwebhooks:manage

Some requests need a second scope on top of their operation’s own, which the ApiScope component lists in full: include=contact on GET /customers and GET /segments/{id}/customers needs contacts:read and include=attributes, filter or sort there needs attributes:read, include=customer on GET /bookings and GET /bookings/{bookingRef} needs customers:read, a values member on POST /customers or POST /bookings needs attributes:write, and on the webhook routes each event family a subscription carries, include_contact: true and include_customer: true need their read scopes, customers:read and contacts:read for the last (Webhooks).

A key is 44 characters: nt_, an environment marker, _, 30 random characters and a 6-character checksum, all drawn from the base62 alphabet 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. Every key matches this regular expression:

\bnt_(?:live|test)_[0-9A-Za-z]{36}\b
  • live keys work against production, test keys against staging and local deployments. A key presented to the other kind of deployment answers the same 401 as a key that was never issued.
  • The last 6 characters are a checksum of everything before them: the CRC-32 (IEEE 802.3, the variant zlib and PNG use) of those characters’ UTF-8 bytes, written in the alphabet above, most significant digit first, left-padded with 0. For example, the CRC-32 of 123456789 is 0xCBF43926, written 3jZRME. The checksum is not a secret, so you can verify it offline: to reject a mistyped or truncated key before sending it, and to tell a real key from a look-alike when you scan your own code, logs and configuration for leaked keys.
  • The first 12 characters identify a key without revealing it. The Nine Tables app lists keys by them, and GET /me returns them as key_prefix. The full key is shown once, when the Owner mints it.

Stated because the 401 is deliberately identical for every failure and so cannot tell you which rule you tripped:

  • The scheme is case-INSENSITIVE (RFC 9110 §11.1). Bearer, bearer and BEARER are the same scheme, which is what makes this document’s own securitySchemes: {scheme: "bearer"} — lowercase, as the OpenAPI specification requires — safe for a generator to emit literally.
  • The credential is case-SENSITIVE. It is matched by hash, so a key with one character re-cased is simply a different key and answers 401.
  • Whitespace around and after the scheme is tolerated: one or more spaces or tabs may separate the two, and leading/trailing space in the field value is stripped by HTTP itself before this API sees it. The credential is never trimmed internally — an embedded space makes the header unparseable.
  • Nothing else is accepted. No other scheme, no query parameter, no cookie; the 401 always carries WWW-Authenticate: Bearer.

Key lifecycle: issuance is deliberately outside this API

Section titled “Key lifecycle: issuance is deliberately outside this API”

Keys are minted, listed and revoked by a restaurant Owner in the Nine Tables app (Customer Data → API, available once the Customer Data app is installed on the tenant); this API can neither mint nor revoke them, by design. Getting a key lists what the Owner is asked for. A key that could mint keys would be a privilege-escalation primitive: a single leaked credential could issue itself successors that outlive the revocation of the one that leaked, and the tenant — who is the party granting access — would not have authorised any of them. Issuance therefore stays behind an authenticated Owner session, which is the only place that consent exists. Keys do not expire: a key works until an Owner revokes it. A key answers 403 app-not-installed while the restaurant has Customer Data uninstalled, and normally again after it reinstalls (see Errors).

The practical consequence for a fleet rollout is real and worth planning for: onboarding N restaurants means N Owners minting a key, and rotating a leaked key means asking them again. There is no dual-key overlap window like the one POST /webhooks/{id}/rotate-secret gives webhook secrets; the equivalent is operator-driven and you should treat it as: have the Owner mint a SECOND key, deploy it, verify with GET /me, then have the Owner revoke the first. Both keys are live in between, so the changeover has no gap.

Revoking a key stops the requests made with it, and nothing else: webhooks keep delivering, because a subscription belongs to the restaurant, not to the key that registered it. To stop one, delete the subscription with DELETE /webhooks/{id} or in the app (Customer Data → API).

An Owner can limit a key to some of the tenant’s restaurants. GET /me lists them in restaurant_ids; null means every restaurant, including ones added later. A limited key:

  • lists only its restaurants in GET /restaurants, and GET /availability and the area, table and experience directories under /restaurants/{restaurantId} refuse any other restaurant as they refuse an id they do not know;
  • reads, creates and changes bookings at its restaurants only: a booking elsewhere answers 404 as if it did not exist, and a restaurant_id naming another restaurant is refused 400;
  • manages only webhooks whose restaurant_id is one of its restaurants, and every webhook it creates must name one. It cannot subscribe a webhook to segment events, because a segment’s membership in deliveries counts bookings at every restaurant (see Webhooks);
  • attributes the guests it creates to one of its restaurants, and enrols a guest in the loyalty club through one of them;
  • cannot transfer loyalty members, because a transfer acts on guests of the whole tenant: POST /loyalty/members/import answers 403 tenant-wide-key-required;
  • counts only bookings at its restaurants in a segment’s booking conditions, so “no booking in the next 30 days” means none at its restaurants;
  • does not see a segment it cannot hold to its restaurants: a fixed segment with a booking condition, whose members were frozen from every restaurant’s bookings, and a segment whose restaurant_id filter names another restaurant. Such a segment is left out of GET /segments, answers 404 on every route whose path names it, and is refused 400 on a webhook’s segment_id exactly as a segment the tenant does not hold.

Guests, attribute definitions, categories and segments otherwise stay tenant-wide. That is wider than a restaurant manager in the app, who sees only guests who booked at, or were created at, their restaurants. Attribute conditions and attribute values are not narrowed either, including the system attributes such as last_visit_at that are computed from bookings at every restaurant.

CORS, and why keys still must not reach a browser

Section titled “CORS, and why keys still must not reach a browser”

This API is server-to-server. Whether a browser preflight succeeds is a property of the gateway in front of a given deployment, not of this application: the function itself emits no CORS headers, but a fronting gateway may add permissive ones to every response, and on at least one deployment it does. Do not treat a failed preflight as your protection.

The reason not to embed a key in client-side code does not depend on CORS at all: a key shipped to a browser is readable in the bundle, and once read it works from anywhere — curl included. Keep keys on your server, and let your own front end talk to your own backend.