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.
Scopes by operation
Section titled “Scopes by operation”Every operation requires at most one scope of its own:
| Operation | Scope |
|---|---|
GET /me | none (any key) |
GET /categories | definitions:read |
GET /categories/{key} | definitions:read |
POST /categories | definitions:write |
PATCH /categories/{key} | definitions:write |
DELETE /categories/{key} | none (always answers 405) |
GET /definitions | definitions:read |
GET /definitions/{entity}/{key} | definitions:read |
POST /definitions | definitions:write |
PATCH /definitions/{entity}/{key} | definitions:write |
DELETE /definitions/{entity}/{key} | none (always answers 405) |
GET /customers | customers:read |
GET /customers/count | customers:read |
GET /customers/{customerRef} | customers:read (values only with attributes:read) |
POST /customers | customers:write |
POST /customers/resolve | contacts:read |
GET /customers/{customerRef}/attributes | attributes:read |
PATCH /customers/{customerRef}/attributes | attributes:write |
PUT /customers/{customerRef}/source-identity | attributes:write |
DELETE /customers/{customerRef}/source-identity/{sourceSystem} | attributes:write |
GET /customers/{customerRef}/bookings | bookings:read |
GET /bookings | bookings:read |
GET /bookings/{bookingRef} | bookings:read |
POST /bookings | bookings:write |
PATCH /bookings/{bookingRef} | bookings:write |
GET /bookings/{bookingRef}/attributes | attributes:read |
PATCH /bookings/{bookingRef}/attributes | attributes:write |
PUT /bookings/{bookingRef}/source-identity | attributes:write |
DELETE /bookings/{bookingRef}/source-identity/{sourceSystem} | attributes:write |
GET /customers/{customerRef}/loyalty | loyalty:read |
POST /loyalty/members | loyalty:write |
POST /loyalty/members/import | loyalty:import (a key that reaches every restaurant) |
GET /availability | none (any key) |
GET /restaurants | none (any key) |
GET /restaurants/{restaurantId}/areas | none (any key) |
GET /restaurants/{restaurantId}/tables | none (any key) |
GET /restaurants/{restaurantId}/experiences | none (any key) |
POST /batch | attributes:write |
GET /segments | segments:read |
GET /segments/{id} | segments:read |
GET /segments/{id}/count | segments:read |
GET /segments/{id}/customers | segments:read |
GET /webhooks | webhooks:manage |
POST /webhooks | webhooks:manage |
GET /webhooks/{id} | webhooks:manage |
PATCH /webhooks/{id} | webhooks:manage |
DELETE /webhooks/{id} | webhooks:manage |
POST /webhooks/{id}/rotate-secret | webhooks:manage |
POST /webhooks/{id}/test | webhooks:manage |
GET /webhooks/{id}/deliveries | webhooks:manage |
GET /webhooks/{id}/deliveries/{deliveryId} | webhooks:manage |
POST /webhooks/{id}/deliveries/{deliveryId}/redeliver | webhooks: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).
Key format
Section titled “Key format”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}\blivekeys work against production,testkeys 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 of123456789is0xCBF43926, written3jZRME. 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 /mereturns them askey_prefix. The full key is shown once, when the Owner mints it.
How the header is parsed
Section titled “How the header is parsed”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,bearerandBEARERare the same scheme, which is what makes this document’s ownsecuritySchemes: {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).
Keys limited to restaurants
Section titled “Keys limited to restaurants”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, andGET /availabilityand 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_idnaming another restaurant is refused 400; - manages only webhooks whose
restaurant_idis 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/importanswers403 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_idfilter names another restaurant. Such a segment is left out ofGET /segments, answers 404 on every route whose path names it, and is refused 400 on a webhook’ssegment_idexactly 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.