Skip to content

Addressing, listing and creating customers

Two resource families:

  • Key-addressed configuration: categories by {key}, definitions by the composite {entity}/{key} (the same key may exist on customer AND booking).
  • Id-or-source-addressed data: {customerRef} / {bookingRef} accept a UUID or {source_system}:{source_key} split on the FIRST colon (pos_x:cust-889). Any RFC 9562 UUID is a well-formed reference. The ids this API issues are v4 and v7, but a UUID of any other version — including the Nil 00000000-0000-0000-0000-000000000000 and the Max ffffffff-… that uuid.Nil, Guid.Empty and new UUID(0,0) produce for an unset field — is looked up and answers 404, the same as any id matching no record. Path charset is [A-Za-z0-9._~-] per half and each half is at most Limits.source_identity_half_chars characters — a longer one is invalid-ref, not a 404, because no record can carry it. Identifiers with other characters must go through POST /customers/resolve (the documented escape hatch). Attach identities with the source-identity PUT endpoints and remove them with DELETE …/source-identity/{sourceSystem}. source_system is canonicalized to lowercase and lookups case-fold it; source_key is case-SENSITIVE and is stored and matched exactly as you send it. A customer ref follows merges: a key held by a guest that was later merged into another resolves to the guest it was merged into. A booking key is unique per RESTAURANT, so a booking ref whose pair names bookings at more than one of the tenant’s restaurants answers 409 ambiguous-ref — address that booking by its id. Customers are created with POST /customers, which reuses the existing guest when the details match, and also originate from bookings and the Nine Tables app.

One code for a malformed identifier, wherever it was written: 400 invalid-ref means an IDENTIFIER is not well-formed for the route it addresses — not a UUID and not a pair on {customerRef}/{bookingRef}, not a UUID on an {id}, not a legal key on {key}/{entity}. It never means that a well-formed identifier matched no record, which is always a 404, and never that a UUID you sent was the wrong KIND of UUID.

The identifier is USUALLY a path segment, but the code follows the identifier rather than the position: a /batch item whose ref is malformed answers invalid-ref as that item’s problem, because it is the same reference the single-write route takes in its path and POST /batch promises a per-item problem “identical to what the single-write route would return”. One mistake, one type to branch on, whether you sent it one write at a time or a hundred at once. validation-failed covers everything else a body or a query string can get wrong.

One seam inside that rule is worth knowing before you generate a client. On /batch, EntityRef’s length bounds are part of the published request schema and are enforced with it — an empty or over-long ref is a whole-request validation-failed keyed items.0.ref — while its pattern is enforced by the ref parser, per item, as invalid-ref. A client generated from the schema therefore rejects some refs locally that the server would have reported per item. That is safe (it refuses only what the server also refuses) but it is a real behavioural difference between the generated client and this API.

Three kinds of customer and booking do not exist as far as this API is concerned: one moved to the trash, one anonymised for a data-protection erasure, and the demo records a trial tenant is seeded with. A ref to one answers the same 404 as a ref matching no record, and every listing leaves them out, so a list never surfaces a record whose own route answers 404. A key limited to some restaurants sees the bookings at the others the same way (see Keys limited to restaurants).

GET /customers pages by customer id in ascending order, at most 100 rows a page: a stable total order, so paging never skips or repeats a row, but it is not chronological, because customer ids are not uniformly time-ordered. A row carries only its id, the key it holds for the system you name in ?source_system= (both halves null where it holds none) and created_at, when Nine Tables first recorded the guest, unless you ask for more: include=contact adds the name, email, phone and marketing consent and needs contacts:read, and include=attributes adds the attribute value set, needs attributes:read and lowers the page size to 25 rows; a limit above that is clamped to it rather than refused. To read only the customers that changed since an instant, deletions included, pass updated_since (see Catching up with updated_since). A cursor belongs to the listing order that issued it: an id-order cursor sent with updated_since, or an updated_since cursor sent without it, answers 400 validation-failed on cursor, so start a fresh walk when you switch.

GET /customers/{customerRef} answers the same members as one object: the contact members and marketing_consent whenever the key holds contacts:read, with no include to ask for them. Without that scope they are absent rather than null, on the listing and the single read alike, because a null already means Nine Tables holds none. A customer carries no updated_at: to find the guests that changed, use updated_since.

GET /customers/count counts exactly the customers that listing pages through, with the same exclusions and the same tenant isolation. Unlike a segment count it is never capped, so a large tenant gets the true total.

GET /customers/{customerRef}/bookings pages one guest’s bookings by booking id, at most 100 rows a page, which is not chronological either, so sort by start_time yourself for a timeline. Its from/to window and status filter work as they do on GET /bookings, and its booking ids address the booking routes, such as an attribute write. A key limited to some restaurants lists the guest’s bookings at those only, while the guest itself stays tenant-wide.

marketing_consent is the guest’s current consent to marketing: granted_at, when it was recorded, and source, the surface it came through (the values are listed on MarketingConsentSource). It is null when the guest has given none or it was withdrawn, so a null member means Nine Tables holds no consent for that guest. A grant the guest gave through the booking widget, the walk-in queue or their own profile records the day only, as midnight UTC.

Consent is read-only on this API, and Nine Tables records it: the guest gives it through the widget, the queue or their profile, staff record or withdraw it in the Nine Tables app, and an import can carry either. No route here writes it, POST /customers included. A grant, a withdrawal or a change of its source moves the guest in an updated_since page and, unless an import made it, raises customer.updated with marketing_consent in changed (see Customer events), so a mailing list kept in your system can follow it.

POST /customers turns the contact details you hold into a Nine Tables customer id, creating a guest when none matches and REUSING the existing one when one does. A match is the documented success path, not a conflict: the answer is 201 with created: true for a new guest and 200 with created: false for a reused one, match_reason says on what evidence (see Which guest, and why), and Location points at the customer either way. Sending the same details again gives back the same id after a match or new, but not after conflict: when the conflict is on a phone another guest holds, every identical request creates one more provisional guest. So retry with an Idempotency-Key (a byte-for-byte retry replays the first answer), or send your source_system/source_key pair, which is consulted first and reuses the guest it was attached to. A matched guest’s profile is never written by this route, not even to fill a blank field: what you sent is kept as the contact details of this submission, and a guest’s profile is changed in the Nine Tables app.

The matching is the venue’s own, shared with its booking widget and its staff app (see The guest comes first). It is deliberately conservative: a guest is recognised on an email or a phone, which is why one of the two is required, never on a shared phone number alone, and the names you send are what let it tell two people on one address apart. Send firstname and lastname whenever you hold them. With contacts:read, the customer in the answer carries the details Nine Tables holds, so on a reused guest they are the stored ones rather than an echo of yours: compare them to see what the venue already knew. A created guest carries what you sent, with phone in its canonical +-and-digits form, except on conflict: a number another guest already holds stays with that guest, so the new one answers phone: null. A created guest has no marketing consent, since this route records none. The route itself needs only customers:write, and without contacts:read the customer leaves out firstname, lastname, email, phone and marketing_consent, carrying only its id, created_at and your source_system/source_key pair (null when you sent none).

Every guest carries the restaurant it came to you through, and restaurant_id names it by its id from GET /restaurants. It is provenance rather than a booking: it decides which staff, of those limited to some restaurants, can see the guest in the Nine Tables app, so the wrong one hides the guest from the people who should serve them. Omit it only when the tenant has exactly one live restaurant (neither disabled nor demo), which is then used; a tenant with several, or with none, is refused on that member rather than attributed by guesswork. A key limited to some restaurants attributes inside them only: it may omit the member when exactly one of them is live, and any other id is refused as one this tenant does not have.

A source_system/source_key pair is attached in the same call, to the new guest or to the existing one the details matched, after which the guest is addressable as {source_system}:{source_key} on every customer route. A customer pair is unique per tenant and is consulted BEFORE email and phone, so a pair a guest already holds reuses THAT guest, whatever contact details accompany it, rather than moving the pair. Two cases answer 409 and create nothing: a matched guest that already holds a different key of your system (conflict-source-identity, and the guest keeps its key), and a pair held by a record this API does not acknowledge (conflict-key-exists, naming no record).

A values map writes attributes in the same request and needs attributes:write on top of customers:write. The guest, the pair and the values are written in one transaction, so a 400 or a 409 never leaves a half-made guest behind, and a retry with a refused attribute key corrected cannot create a second one.

resolve finds a guest, and never creates one

Section titled “resolve finds a guest, and never creates one”

POST /customers/resolve only reads, and answers an empty matches for a guest nobody has created yet. POST /customers creates one, or reuses the guest the details match, so you do not have to search here first.

Every criterion you send must match (they are AND-ed), and matches lists the guests with the most recent booking activity first. A criterion that matches nothing is not an error: the answer is still 200, with an empty matches and criteria, the canonical form the server searched on. Compare criteria with what you sent before concluding a guest is absent. email matches case-insensitively, and phone is normalised to E.164, so +4790000001, +47 90 00 00 01 and 004790000001 are one number. A pair finds the guest holding it, or the guest that holder was merged into, and a pair alone is also served by GET /customers/{source_system}:{source_key}. source_system may also ride alongside email or phone on its own: it narrows the search to the guests holding a key from your system, and it is what makes each match’s key disclosable to you (see Names you can discover). The route requires contacts:read, because it finds guests by their email and phone and answers with their contact details.

resolve requires a phone with a + or 00 prefix and refuses everything else — 4790000001 (Norway, plus dropped) and 90000001 (a Norwegian national number) are the same shape, so reading the leading digits as a country code would answer one of them with an empty matches you could not tell apart from an absent guest. Both are refused.

A customer or booking holds one key per external system: the {source_system, source_key} pairs of several integrations sit side by side on the same guest, and attaching yours never touches another system’s. PUT …/source-identity attaches your key, lower-casing source_system, and is idempotent for the same pair, including one a guest merged into the record holds. It answers 409 in two cases only: the record already holds another key of your own system (conflict-source-identity, quoting the key it holds), or another record holds this pair (identity-already-assigned, naming it only by conflicting_id). When that other record is one this API does not acknowledge, the answer is conflict-key-exists, naming no record at all. DELETE …/source-identity/{sourceSystem} removes your key — from the record and from any guest merged into it — so another can be attached, which is how you replace a key, or so the record is no longer addressable by it. It answers the record with your pair now null, and removing a key that is not there answers the same 200, so a retry is safe.

A booking key is unique per RESTAURANT rather than per tenant, so a POS that restarts its order numbers at each venue may attach the same pair to bookings at several of them. identity-already-assigned then names only another booking at the same restaurant, and a ref naming bookings at several restaurants answers ambiguous-ref. Both booking source-identity routes answer with the booking id and your pair, plus the booking’s diary members when the key also holds bookings:read.

A key follows its record. A guest merged into another keeps its keys, and they resolve to the guest it was merged into. A record moved to the trash lets its keys go, so a re-import can give them to a new record, and takes them back on restore while nobody else holds them.

Because a key does not identify WHICH external system is calling (it carries scopes and a tenant, not a source_system), a record’s key is disclosed only to a caller who names that system — in the path ref, in ?source_system=, or as a resolve criterion — and only the key of the system named. Name none, or a system the record holds no key from, and both halves are null. So do not expect another integration’s key on a record: its identifier is never handed to you as if it were your own.

The same rule holds for webhook deliveries, which carry only the key of the system a subscription declares (see Declaring your system).

Names you can discover, and what that means for yours

Section titled “Names you can discover, and what that means for yours”

What is withheld is the pairing — which guest a foreign system claimed, and under what key. A foreign system’s NAME is a weaker secret than that, and you should not treat it as one: because source_system genuinely narrows a resolve, a criterion naming the wrong system answers an empty matches for a guest who exists, and naming the right one answers a match. Any holder of any key on this tenant can therefore test a candidate name one guess at a time and learn which integrations are attached, bounded only by their per-key rate limit. The same is true from the other side: your own source_system is discoverable by every other integration the restaurant has authorised.

This is a deliberate trade, not an oversight — the narrowing IS the disclosure gate, and removing it would take the identity feature with it. The practical consequence is one rule: a source_system is a label, never a credential. Name it after your product, not after a tenant, an environment or anything you would not want a peer integration on the same restaurant to read. Nothing about the guest, the key or the pairing leaks with it.