Webhooks
A webhook subscription has Nine Tables POST a signed JSON body to your HTTPS endpoint whenever a guest record, a segment’s membership or a booking changes, or a computed attribute finishes computing, so your system stays in step without polling.
Events
Section titled “Events”Ten events in four families. One subscription can carry any mix of them.
| Event | Sent when | Body |
|---|---|---|
customer.created | a guest is recorded, restored from the trash or unmerged | WebhookCustomerDelivery |
customer.updated | a guest’s name, email, phone, marketing consent or a filled-in attribute value changes | WebhookCustomerDelivery |
customer.merged | guests are merged, once per merge, for the surviving guest | WebhookCustomerDelivery |
customer.deleted | a guest is trashed or deleted (deleted), or erased (erased) | WebhookCustomerDelivery |
segment.customer.entered | a customer starts matching a dynamic segment | WebhookDelivery |
segment.customer.exited | a customer stops matching one | WebhookDelivery |
booking.created | a booking is first recorded, or restored from the trash | WebhookBookingDelivery |
booking.updated | a watched member or a filled-in attribute value of a booking changes | WebhookBookingDelivery |
booking.deleted | a booking is moved to the trash or deleted outright | WebhookBookingDeletedDelivery |
definition.computed | a computed attribute finishes computing, or fails | WebhookDefinitionComputedDelivery |
A watched member is one of the record’s own fields whose change raises an update event, listed for customers under Customer events and for bookings under Booking events.
Customer and segment events report different facts. A customer event says the
guest record changed; a segment event says a membership changed, often with no
change to the record, as when a booking moves a guest’s visit count across a
rule. One change can raise both: a new guest who matches a segment at once gets
customer.created and, on the next sample, segment.customer.entered.
Delivery is at-least-once with no ordering guarantee for every event. Verify
the signature, then deduplicate on the webhook-id header: it equals the
body’s id and stays the same on every retry and redelivery. A body’s
created_at is when the event was recorded, not the order its write committed
in, so events from two overlapping writes can carry created_at values in the
opposite order. When the order of two events about one record matters, read
the record back (GET /customers/{customerRef}, whose values need
attributes:read, GET /bookings/{bookingRef} or
GET /segments/{id}/customers) rather than sorting deliveries.
Quick setup
Section titled “Quick setup”-
Use a key with the right scopes. Managing subscriptions needs
webhooks:manage. A delivery carries the data the matching read serves, so each event family you subscribe to also needs that read’s scopes:Events Read scopes customer.*customers:read,contacts:readsegment.customer.*segments:read,contacts:readbooking.*bookings:readdefinition.*definitions:readA customer or segment delivery always carries the guest’s name, so it needs
contacts:readeven withinclude_contact: false.include_contact: trueneedscontacts:readon any subscription.include_customer: trueputs the guest, name included, into booking deliveries, so it needscustomers:readandcontacts:readon top ofbookings:read. -
Subscribe.
POST /webhookswith your endpoint, the events you want, and the external system you are, so deliveries carry your own keys:{"url": "https://example.com/nine-tables-hook","events": ["customer.updated", "booking.created", "booking.updated"],"source_system": "pos_x"}The 201 carries the signing
secret, which no later read returns, so store it. Send anIdempotency-Key: a retry after a lost response then replays the same secret. -
Send a test.
POST /webhooks/{id}/testsends a signed sample of the first event ineventsto your endpoint and reports how it answered. -
Verify every delivery as Verifying a delivery describes, answer 2xx within 10 seconds, and do the work after answering.
Delivery bodies
Section titled “Delivery bodies”Every delivery is Content-Type: application/json and shares one envelope:
id, type, api_version, created_at and data, in that order. Only
data differs between events, so parse the envelope once and branch on
type. api_version is the major version the body is rendered under, the
value the X-NT-API-Version header carries on every API response (see
Versioning). Each body is declared
under the webhooks key of the OpenAPI document, so you can generate your
consumer’s types from it.
Customer events
Section titled “Customer events”{ "id": "01a021ab-5c3f-7d21-9a4e-2f3a4b5c6d7e", "type": "customer.updated", "api_version": "1", "created_at": "2026-08-21T10:03:17.551000Z", "data": { "customer": { "id": "01a021aa-e40c-7350-94d9-c5b7d7e1db0f", "source_system": "pos_x", "source_key": "cust-889", "firstname": "Kari", "lastname": "Nordmann", "created_at": "2026-03-14T18:22:05.118204Z" }, "changed": [ "email", "attributes.allergies" ] }}data.customer is the guest as the write left it, without attribute values
(read those from GET /customers/{customerRef}/attributes). Each event adds at
most one member beside it:
customer.createdadds nothing. It is sent when a guest is recorded by a booking, the booking widget, staff or this API, and when one comes back from the trash or out of a merge.customer.updatedaddschanged: the watched members that changed (firstname,lastname,email,phone,marketing_consent, in that order), thenattributes.<key>for each filled-in attribute value that was set, changed or cleared.marketing_consentis listed for a grant, a withdrawal and a change of the consent’s source alike (see Marketing consent). Values are named, never carried, so read them back (Sizing the read-back batches it). Writing the value already stored raises nothing, and computed values never raise an event.customer.mergedaddsmerged_customer_ids, the guests merged intocustomer, which is the survivor. It is sent once per merge, and the merged guests send nocustomer.deleted. They answer 404 by id, while a{system}:{key}ref to any of their keys resolves to the survivor (see Addressing). A merge that fills the survivor’s empty email, phone or marketing consent also sendscustomer.updated.customer.deletedaddsreason, andcustomershrinks to the id and your own key (WebhookDeletedCustomer):
{ "id": "01a021ab-7e51-7f43-9c60-4b5c6d7e8f90", "type": "customer.deleted", "api_version": "1", "created_at": "2026-08-21T12:30:58.763000Z", "data": { "customer": { "id": "01a021aa-e40c-7350-94d9-c5b7d7e1db0f", "source_system": "pos_x", "source_key": "cust-889" }, "reason": "deleted" }}reason is deleted when the guest was moved to the trash or deleted
outright, and erased when a data-protection erasure anonymized them: then
delete everything you hold about the guest. A trashed guest that is later
erased sends both events, and one restored from the trash sends
customer.created again.
Segment events
Section titled “Segment events”{ "id": "01a021aa-e40b-7d46-9332-0bee5c13fa45", "type": "segment.customer.entered", "api_version": "1", "created_at": "2026-08-21T00:00:00.000000Z", "data": { "segment": { "id": "01a021aa-e40c-7350-94d9-c5b629a34d4b", "name": "Regulars" }, "customer": { "id": "01a021aa-e40c-7350-94d9-c5b7d7e1db0f", "source_system": "pos_x", "source_key": "cust-889", "firstname": "Kari", "lastname": "Nordmann", "created_at": "2026-03-14T18:22:05.118204Z" } }}data.segment.id is the id GET /segments/{id}/customers takes, so you can
reconcile against the full membership straight from a delivery. Its name is
a label the restaurant can change, so key your records on the id. created_at
is when the membership sample observed the change.
A guest moved to the trash, or merged into another guest, stops matching every
segment and is sent segment.customer.exited for each one they were in. An
erased guest is sent none (see
Contact details and personal data).
Booking events
Section titled “Booking events”{ "id": "01a021ab-9f07-7a55-8c31-5d6e7f8a9b0c", "type": "booking.updated", "api_version": "1", "created_at": "2026-08-18T15:04:51.038000Z", "data": { "booking": { "id": "0198a5b0-9f11-7c02-8e5d-2a7b3c9d4e55", "source_system": "pos_x", "source_key": "order-777", "start_time": "2026-08-18T19:00:00.000000Z", "end_time": "2026-08-18T21:00:00.000000Z", "status": "completed", "guest_count": 4, "restaurant_id": "0198a5b0-1234-7abc-8def-0123456789ab", "customer_id": "0198a5b0-7c2e-7d31-b7c4-1f4dcaa1e001", "customer_notes": "Window table if one is free", "staff_notes": "Regular — give table 7 if free", "allergens": [ "gluten" ], "dietary_preferences": [ "vegetarian" ], "requested_area_id": null, "requested_table_count": null, "table_ids": [ "0198a5b0-77aa-7b10-9c21-5d3e4f6a7b88" ] }, "tables": [ { "id": "0198a5b0-77aa-7b10-9c21-5d3e4f6a7b88", "area_id": "0198a5b0-3c4d-7e10-9f21-6a7b8c9d0e11", "name": "12", "capacity_from": 2, "capacity_to": 4, "active": true, "booking_priority": 10, "shape": "rectangle" } ], "changed": [ "status", "guest_count" ] }}data.booking is the BookingSummary component, member for member what
GET /bookings/{bookingRef} returns without include=customer, as the booking
stood when the event was recorded. It is a full snapshot, not a diff, and
carries no attribute values (read those from
GET /bookings/{bookingRef}/attributes).
data.tables names the tables the booking holds: for each id in
booking.table_ids, in that order, the Table that
GET /restaurants/{restaurantId}/tables lists, and [] when the booking holds
none. A consumer keeping its own copy of the diary, such as a sheet the floor
falls back on during service, reads each table’s name straight from the
delivery. Each entry is the table as it stood when the event was
recorded, with active: false once the venue has removed it from the floor
plan. Renaming or removing a table raises no booking event, so the new name
arrives with the next event about the booking.
data.changed is present on booking.updated and absent on booking.created,
so test whether the member exists rather than its length. An update lists
either the watched members the write moved (start_time, end_time,
status, guest_count, customer_id, customer_notes, staff_notes,
allergens, dietary_preferences, requested_area_id,
requested_table_count and table_ids, in that order) or attributes.<key>
for each filled-in attribute value set, changed or cleared, sorted by key. An
update that changes none of these raises nothing, so changed is never empty,
and writing the value an attribute already holds raises nothing either.
Attaching or detaching a table, and moving a booking to another table, raises
booking.updated with changed: ["table_ids"], its data.tables naming the
tables the booking now holds. A write that moved other members and the tables
together, such as a PATCH sending guest_count and table_ids, raises one
booking.updated listing both, with the tables the write left. A
booking.created carries the tables its create attached.
source_system and source_key are not watched: you write them yourself
through PUT /bookings/{bookingRef}/source-identity, and announcing them would
send your own write back to you. A booking you create through this API is
still announced, and
The booking you just created will be delivered back to you
shows how to recognise it.
The guest is opt-in per subscription via include_customer (default
false). With it on, booking.created and booking.updated also carry the
guest booking.customer_id names as data.customer, between tables and
changed:
{ "id": "01a021ab-3c1d-7e42-bb90-0c2f7ad4e611", "type": "booking.created", "api_version": "1", "created_at": "2026-08-18T14:32:07.412000Z", "data": { "booking": { "id": "0198a5b0-9f11-7c02-8e5d-2a7b3c9d4e55", "source_system": "pos_x", "source_key": "order-777", "start_time": "2026-08-18T19:00:00.000000Z", "end_time": "2026-08-18T21:00:00.000000Z", "status": "completed", "guest_count": 4, "restaurant_id": "0198a5b0-1234-7abc-8def-0123456789ab", "customer_id": "0198a5b0-7c2e-7d31-b7c4-1f4dcaa1e001", "customer_notes": "Window table if one is free", "staff_notes": "Regular — give table 7 if free", "allergens": [ "gluten" ], "dietary_preferences": [ "vegetarian" ], "requested_area_id": null, "requested_table_count": null, "table_ids": [ "0198a5b0-77aa-7b10-9c21-5d3e4f6a7b88" ] }, "tables": [ { "id": "0198a5b0-77aa-7b10-9c21-5d3e4f6a7b88", "area_id": "0198a5b0-3c4d-7e10-9f21-6a7b8c9d0e11", "name": "12", "capacity_from": 2, "capacity_to": 4, "active": true, "booking_priority": 10, "shape": "rectangle" } ], "customer": { "id": "0198a5b0-7c2e-7d31-b7c4-1f4dcaa1e001", "source_system": "pos_x", "source_key": "cust-889", "firstname": "Kari", "lastname": "Nordmann", "created_at": "2026-03-14T18:22:05.118204Z" } }}data.customer is the WebhookDeliveryCustomer a customer event carries: the
guest’s id, their key from your declared system, their name and created_at,
with email, phone and marketing_consent only under include_contact (see
Contact details and personal data), and
no attribute values. It is null when the booking has no guest or its guest is
one GET /customers/{customerRef} answers 404 for (see
Records this API does not acknowledge),
so test for null before reading it. It is absent while include_customer is
off, and booking.deleted never carries it.
It is the guest as they stood when the booking event was recorded, so you can
act on the guest of a booking.created without reading them back, even when it
arrives before the guest’s own customer.created. Moving a booking to another
guest raises booking.updated naming customer_id, carrying the new guest. A
change to the guest alone raises no booking event: renaming them sends
customer.updated, so subscribe to that to keep your copy of the guest
current. include_customer: true needs booking.created or booking.updated
in events, and a subscription without either is refused with a 400 on
include_customer rather than accepted and ignored.
booking.deleted has its own body, WebhookBookingDeletedDelivery: the
booking’s id, its restaurant and your own key, with no snapshot.
{ "id": "01a021ab-a018-7b66-9d42-6e7f8a9b0c1d", "type": "booking.deleted", "api_version": "1", "created_at": "2026-08-18T16:20:33.917000Z", "data": { "booking": { "id": "0198a5b0-9f11-7c02-8e5d-2a7b3c9d4e55", "source_system": "pos_x", "source_key": "order-777", "restaurant_id": "0198a5b0-1234-7abc-8def-0123456789ab" } }}It is sent when a booking is moved to the trash (by staff, a bulk delete or an
import rollback) and when a live booking is deleted outright. Purging a booking
already in the trash sends nothing more, and restoring one sends
booking.created again, with its full snapshot. An erased guest’s bookings are
anonymized rather than deleted, so an erasure sends no booking.deleted.
Definition events
Section titled “Definition events”{ "id": "01a021ab-b129-7c77-8e53-7f8a9b0c1d2e", "type": "definition.computed", "api_version": "1", "created_at": "2026-08-20T11:44:52.418000Z", "data": { "definition": { "entity": "customer", "key": "total_visits", "name": "Total visits", "source": "system" }, "state": "ready", "guest_count": 4812, "computed_at": "2026-08-20T11:44:52.301000Z" }}definition.computed is sent once per computed attribute, to every
subscription carrying it, when a computation of the attribute finishes: after
it is created, switched on, given a new rule or recomputed. data.definition
names it by entity and key, the pair
GET /definitions/{entity}/{key} takes, with its label as name and its
source. data.state is ready once the computation has covered every guest
and failed when computing stopped after repeated errors, with the reason in the
definition’s computed.error. data.guest_count is how many guests held a
value when the event was recorded, 0 on failed, and data.computed_at is the
definition’s computed.computed_at: when the computation this event reports
became ready, and null on failed, since each computation clears it when it
starts.
Computed values raise no customer.updated and do not move updated_since,
so read the values back after this event rather than waiting for one per guest.
Values keep moving as bookings change, with no further event. See
Computed attributes.
Declaring your system
Section titled “Declaring your system”A record can hold keys from several external systems. A delivery carries
source_system and source_key only for the key the record holds under the
source_system your subscription declares, the rule every REST route applies
(see
One key per system per record).
Two nulls mean the record holds no key from your system, or your subscription
declares none; they never mean that another system holds it. The declared
system is lower-cased on write, as PUT /customers/{customerRef}/source-identity
lower-cases what it stores, and a subscription that declares none is sent no
key at all.
Contact details and personal data
Section titled “Contact details and personal data”A customer or segment delivery always carries the guest’s id, your own key,
their name and created_at, and so does the guest that include_customer
adds to a booking delivery.
email, phone and marketing_consent are
opt-in per subscription via include_contact (default false), and absent
rather than null while it is off; a marketing_consent of null means the guest
has given none or withdrawn it. Turning it off strips all three from every delivery already queued for the
subscription, delivered ones included, so neither a retry nor a redelivery
sends them again; turning it on applies to events queued afterwards.
customer.deleted never carries them. A customer.updated naming
marketing_consent is still sent with include_contact off: you learn that
the consent changed, and read it back with GET /customers/{customerRef}
under contacts:read.
A booking delivery carries the guest’s name and contact details only as the
data.customer that include_customer adds, which include_contact then
governs like any other. With include_customer off, the guest appears only as
booking.customer_id, which GET /customers/{customerRef} resolves under
customers:read. Turning include_customer off removes data.customer from
every booking delivery already queued for the subscription, delivered ones
included, so neither a retry nor a redelivery sends the guest again; turning it
on applies to events queued afterwards.
The tenant is the data controller for the endpoints it registers and for whatever the receiving system does with the data: endpoint choice, transport, retention and erasure in your store are the tenant’s, not Nine Tables’.
An erasure is announced by customer.deleted with reason: "erased". Delete
everything you hold about the guest when it arrives. Erasing a guest also drops
their deliveries not yet sent, strips the guest’s details from the ones already
sent, and sends no segment.customer.exited. Those stripped deliveries can no
longer be redelivered: a customer or segment delivery that was sent before the
guest was erased answers 409 conflict-delivery-erased and is never sent
again; the customer.deleted event the erasure sends, and booking deliveries,
stay redeliverable. An erasure keeps a sent booking delivery whole but for the
guest: booking.customer_id becomes null, and so does a data.customer that
include_customer embedded. A subscription without customer events is
therefore told nothing: reconcile with GET /segments/{id}/customers and drop
the guests who no longer appear.
When events arrive
Section titled “When events arrive”Events from a write
Section titled “Events from a write”A customer or booking event is queued by the write that raised it, and the
dispatcher, which runs every minute, sends it. A quiet system delivers it
within about a minute; a busy one takes longer. No change is lost to a sampling
window: a booking created and changed within the same minute sends both events,
and one created and then removed sends its booking.created and then its
booking.deleted. Guests behave the same way.
So a booking.created can arrive for a booking that is already gone. Read it
back before acting if your flow depends on it: GET /bookings/{bookingRef}
answers 404 for a booking this API no longer acknowledges.
An import sends no customer or booking events, so reconcile with
updated_since after one. The guests it
brings in still enter and leave segments, because the next membership sample
sees them like any other change.
Sizing the read-back
Section titled “Sizing the read-back”A customer delivery names the attributes that changed without their values,
and carries contact members only under include_contact, so reading each guest
back costs one request per event. One write can raise up to
2000 customer events per
subscription, against a default rate limit of
120 requests a minute
(Rate limits). Two habits keep the read-back small:
- Contact members: set
include_contact: true, andemail,phoneandmarketing_consentarrive in the delivery with nothing to read back. It needscontacts:read, which customer events already require. - Attribute values: collect a batch of events, then page through
GET /customers?updated_since=<instant>&include=attributes, which returns 25 changed guests a request, instead of oneGET /customers/{customerRef}per event. Both needattributes:read. Startupdated_since10 minutes before the earliestcreated_atin the batch, the overlap Catching up withupdated_sinceasks of every poll, because an event’screated_atand the guest’schanged_atare separate clock readings of the write; deduplicate byid.
Large writes are capped
Section titled “Large writes are capped”One database statement queues at most
2000 booking events and
2000 customer events per
subscription. Only a statement that changes that many records at once reaches
the cap, and it is counted per subscription, so one subscriber cannot starve
the others. Past it, only the events for the lowest record ids are sent, and
the rest are dropped rather than queued for later. Nothing is delivered to say
so, but the subscription’s last_capped_at records when it happened: list with
updated_since set to that time to fetch what the statement changed.
Events from the membership sample
Section titled “Events from the membership sample”Segment membership is sampled every 5 minutes. Each run spends at most 3.5 minutes evaluating segments, the one sampled longest ago first, and the next run starts with whatever is left. On a quiet system a segment event follows the change by ~5 minutes, which is the best case rather than a guarantee. Under load a segment can wait several runs, so the delay is a multiple of 5 minutes that grows with the number of segments, the cost of their rules and any backlog. Do not infer the order or timing of changes from when events arrive.
The sample compares snapshots rather than replaying history, so a customer who enters and leaves a segment between two samples sends nothing. The longer the gap between samples under load, the more such short visits go unreported.
A large membership change is paged, never dropped. One sample sends a subscription at most 10000 of a segment’s changes, fewer when more than five subscriptions cover the segment, and the rest go out on the following samples, a page each.
Managing subscriptions
Section titled “Managing subscriptions”| Route | What it does |
|---|---|
POST /webhooks | Registers an endpoint and returns its signing secret |
GET /webhooks, GET /webhooks/{id} | Read subscriptions, never their secrets |
PATCH /webhooks/{id} | Changes the members you send and leaves the rest |
DELETE /webhooks/{id} | Removes a subscription and its undelivered events |
POST /webhooks/{id}/rotate-secret | Mints a new signing secret |
POST /webhooks/{id}/test | Sends a signed sample delivery |
GET /webhooks/{id}/deliveries | Lists deliveries and their attempts |
GET /webhooks/{id}/deliveries/{deliveryId} | Reads one delivery with its body |
POST /webhooks/{id}/deliveries/{deliveryId}/redeliver | Sends one delivery again |
Every route needs webhooks:manage. A tenant holds at most
10 subscriptions across all of its
keys, paused ones included, so only a delete frees a slot.
What a subscription delivers needs read scopes too. POST /webhooks and
PATCH /webhooks/{id} answer 403 insufficient-scope, naming the
required_scope, when the subscription the request leaves carries data the key
cannot read. A PATCH is judged that way whenever it could send the data
somewhere new or send more of it: when it sets url, a filter or
source_system, sends active: true, emit_initial: true,
include_contact: true or include_customer: true, or adds an event.
Removing events, pausing, turning emit_initial, include_contact or
include_customer off and deleting need only webhooks:manage. The delivery
log, a delivery’s body and redelivery need the read scopes of the subscription
they read.
The subscription object
Section titled “The subscription object”WebhookSubscription is the object to read when deliveries stop. You own
url, events, segment_id, restaurant_id, source_system,
emit_initial, include_contact and include_customer. The server writes
initial_emitted_at,
consecutive_failures, failing_since, disabled_at, disabled_reason,
last_capped_at, created_at and updated_at, and clears active when it
disables the subscription. active: false with a null disabled_at is your
own pause; with a timestamp, the platform disabled it (see
Automatic disabling).
The write bodies refuse unknown members and the server-written ones alike, so
sending back a member you just read is a 400 rather than a silent no-op. A
PATCH is a merge: a body naming no members writes nothing and returns the
subscription unchanged, updated_at included. Changing url neither resets
consecutive_failures nor re-activates a disabled subscription; send
active: true for that.
Filters
Section titled “Filters”segment_id narrows the segment events to one dynamic segment, and
restaurant_id narrows the booking events to one restaurant. Each defaults to
null, which covers every dynamic segment or every restaurant, ones created
later included. A fixed segment is never covered: its membership is frozen, so
it has no changes to report. Neither filter touches another family, so a
subscription naming a restaurant_id still receives segment events for every
restaurant’s customers. Customer events take no filter, because a guest belongs
to the tenant rather than to a restaurant or a segment. A restaurant_id
change applies to events queued after it; deliveries already queued are still
sent.
A key limited to some restaurants sees and manages only subscriptions filtered
to one of them, must set restaurant_id on every subscription it creates, and
cannot subscribe to segment events (see
Keys limited to restaurants).
On a subscription that already carries segment events, it can still remove
them, pause the subscription or delete it.
The endpoint URL
Section titled “The endpoint URL”POST /webhooks, and a PATCH that sets url, check the URL before storing
it, and the same check runs again before every delivery:
- It must be
https://, with no credentials in it:https://user:password@host/…is refused, becauseurlis shown to every key holdingwebhooks:managewhile thesecretis never shown again. Put an authorization value in your endpoint’s own auth instead. - Surrounding whitespace is trimmed, and the trimmed URL is what is stored, shown and delivered to. Whitespace inside the URL is refused.
- The host must resolve only to globally routable addresses. Every range IANA’s special-purpose registries mark not globally reachable is refused (loopback, link-local, private and unique-local, carrier-grade NAT, documentation, multicast and reserved space), whether written as a literal or in an IPv4-in-IPv6 form, and so is a name that does not resolve.
- A single-label host (
https://metadata/…) and the suffixes.localhost,.local,.internal,.svcand.consulare refused on their spelling alone.
A name re-pointed at a refused address after registration fails its
deliveries instead of receiving them. When the resolver itself cannot be
reached, the check is skipped so that a DNS outage does not fail every
endpoint at once, and the delivery fails on its own lookup with
transport_error: "dns".
When segment events start
Section titled “When segment events start”Segment events come from a membership snapshot of each dynamic segment, kept
while a subscription with a segment event covers it, active or paused.
POST /webhooks, or a PATCH that changes segment_id, takes that snapshot
inside the request without sending anything, so the very next membership
change is reported. If taking it fails, the request still succeeds and the next
sample takes it instead, so changes in the minutes between are not reported.
Deleting the last subscription that covers a segment drops its snapshot, so a
later subscription starts from the membership at its own creation.
A dynamic segment whose rules read a computed attribute that is computing or
failed is not sampled until the attribute settles, so a computation is never
announced guest by guest, and a snapshot such a segment still needs is taken,
silently, once it does. A new rule on an attribute the segment reads is
treated the same way: the snapshot is taken again once the attribute is
ready, so the guests the edit moved into or out of the segment send no
event, and the changes after it are reported as usual (see
Computed attributes).
emit_initial: true also sends segment.customer.entered for every current
member of each covered segment, once per segment, which initial_emitted_at
records. It needs a segment event in events and is refused on a subscription
without one, rather than accepted and ignored. The backfill runs in customer-id
order on a sample that leaves no membership change pending, and each sample
backfills only what is left of the
10000-event page after that
sample’s own changes, so a large segment is backfilled over consecutive
samples. No member is skipped, and one who joins while the backfill is under
way is sent segment.customer.entered once. Neither re-activating the
subscription nor turning emit_initial on again repeats it; delete and
re-create the subscription to replay.
Any subscription can receive segment.customer.exited for a member it never
saw enter: one who joined before the subscription existed, or who left before
the backfill reached them. Treat an exit for a guest you do not hold as already
applied.
Rotating the signing secret
Section titled “Rotating the signing secret”POST /webhooks/{id}/rotate-secret returns a new secret, which is never
readable again, and keeps the previous one co-signing for 24 hours. During that
overlap webhook-signature carries both signatures, so a verifier that accepts
any matching entry switches with no gap. previous_secret_valid_until says
when the overlap ends.
There is one previous-secret slot. A second rotation inside the overlap answers
409 conflict-secret-rotation, naming when the overlap ends, rather than
cutting it short. ?force=true rotates anyway and ends the overlap at once,
which is what an exposed secret calls for. A rotation that loses a race with
another answers the same 409 and rotates nothing.
Send an Idempotency-Key, and reuse it when you retry. If a rotation succeeds
and its response is lost, a plain retry is refused 409 because the overlap has
started, and the new secret cannot be read again. Replaying the same key
returns the stored response, secret included, for as long as that secret still
signs; once a later rotation has replaced it, the replay answers
422 idempotency-key-conflict. The 201 of POST /webhooks replays its
secret on the same terms. Idempotency covers replays
in general.
The test delivery
Section titled “The test delivery”POST /webhooks/{id}/test sends a sample of the first event in the
subscription’s events, signed like a real delivery and carrying the extra
header X-NineTables-Test: true. Reorder events to test another body. The
sample has a real delivery’s members in the same order and honours the
subscription’s include_contact, include_customer and source_system, so a
fixture built from it matches production. A customer.updated sample names one
watched member and one attribute in changed, and a booking.updated sample
two watched members. A booking sample holds one table, which data.tables
names. Under include_customer, a booking sample’s customer is the guest its
booking.customer_id names. A definition.computed sample names
a made-up tenant attribute, sample_attribute, with a guest_count of 4812,
not one of your definitions.
A test cannot show two branches. A record holding no key from your system
arrives with both halves null, while the sample always carries your pair when
you declared a system, so treat source_key as nullable. A guest with no
marketing consent arrives with marketing_consent: null, while the sample’s
is always a grant, so treat it as nullable too. A booking with no guest, or
with one this API does not acknowledge, arrives with customer: null, while
the sample’s booking always has a guest, so treat customer as nullable as
well. A booking at no table arrives with tables: [], while the sample’s
holds one.
The test never touches the failure counters or the queue, and it is sent even
while active is false, so you can prove an endpoint works before re-enabling
it. Pausing therefore does not stop tests reaching the URL; delete the
subscription for that.
The call is synchronous. It waits up to 10 seconds for your endpoint, plus the
address check, so set your client timeout above 15 seconds. The answer reports
delivered, status_code and duration_ms. An answer outside 2xx is a
status_code, and error reads HTTP <status>. When the endpoint was never
reached, transport_error names why, as the delivery log’s last_error does:
dns: the host did not resolve when the request was made. A host that resolves to nothing is refused by the endpoint check first, so this is the case where the resolver could not be reached for that check.connect: the host resolved, but no connection was established.tls: the TLS handshake or the certificate check failed.timeout: no response within 10 seconds of the request leaving Nine Tables.unknown: a transport failure none of the above describes.
A URL the endpoint check refuses answers 400 on url. Within the address space
those rules allow, the test reaches whatever host url names, from Nine Tables’
addresses, and reports whether it answered, so use it only on endpoints you are
entitled to probe.
Retries and redelivery
Section titled “Retries and redelivery”Once an event is queued, its delivery works the same whatever its family. The dispatcher runs every minute and POSTs each due delivery with a 10-second timeout. Any 2xx acknowledges it, and the body of your answer is ignored, so acknowledge first and process afterwards. Anything else fails the attempt: another status, a timeout, a transport failure, and a 3xx too, because redirects are not followed. Register the URL that answers.
A failed attempt is retried on a fixed schedule. The failed attempts wait
2, 4, 8, 16, 32, 64, 128, 256 and 360 minutes in turn before the next one, and failed
attempt 10 is final: the delivery is marked
failed, about 14.5 hours after its first
attempt. A 429 or 503 carrying Retry-After waits that long instead when
it asks for longer, up to 6 hours; every other status’s Retry-After is
ignored. A due retry goes out within a minute of its time.
Automatic disabling
Section titled “Automatic disabling”The platform disables a subscription whose endpoint keeps failing, and
disabled_reason says why:
failing: its deliveries have failed for 12 hours with no success between.failing_sincesays when the stretch began; a success clears it, and a gap of more than 7 hours between two failures starts a new stretch. An endpoint that fails every delivery is disabled before any delivery runs out of attempts, so its queue is held rather than failed one delivery at a time.gone: a delivery was answered410 Gone, which disables the subscription at once.
Either way active becomes false, disabled_at is set, and the account’s
Owners are emailed with the endpoint’s host and the cause. Watch
consecutive_failures (failed attempts since the last success) and
failing_since to see a disable coming. A test delivery never counts toward
either rule.
Paused and disabled subscriptions
Section titled “Paused and disabled subscriptions”While active is false, because you sent active: false or because the
platform disabled the subscription, every event it subscribes to is still
queued, and none is delivered or failed. Held events are kept for 30 days, so a
subscription paused for longer loses its oldest ones. Fix the endpoint, then
send active: true (in the app: Customer Data → API). That clears
consecutive_failures, failing_since, disabled_at and disabled_reason,
and sends the held events at once, each on a fresh retry schedule and in no
particular order. The emit_initial backfill is not repeated, because the held
events already carry what changed. To stop events accumulating, delete the
subscription instead.
Uninstalling the Customer Data app holds every subscription of the account the
same way: what was already queued is kept for the same 30 days and sent once
the app is reinstalled. The changes made while it is uninstalled are never
sent, and your keys answer 403 app-not-installed meanwhile (see
Errors).
The delivery log
Section titled “The delivery log”GET /webhooks/{id}/deliveries lists one subscription’s deliveries, newest
first and cursor-paginated, and status narrows it to pending, delivered
or failed. Each entry carries its event type, its status, next_attempt_at,
last_error and every recorded attempt: the status your endpoint answered, how
long it took and the start of its response body, where the reason for a
refusal is usually written. Deliveries are kept 30 days after they are
delivered or given up, and a held one 30 days after it was queued. A key
limited to some restaurants sees no segment delivery, and a booking delivery
only for a booking at one of its restaurants; customer and definition
deliveries, which are about the tenant, it sees all of.
GET /webhooks/{id}/deliveries/{deliveryId} returns one entry with its body:
the JSON the dispatcher sends for it, member for member and in the same order,
with the subscription’s current include_contact and include_customer
applied. It is the body as it stands now, as a redelivery would send it:
turning include_contact off since shows it without the contact members,
turning include_customer off shows a booking delivery without
data.customer, and a customer or segment delivery whose guest was erased
shows only what the erasure kept. The signature covers the
bytes that arrived, so verify against those rather than a re-serialisation of
body (see Verifying a delivery). A delivery the log
does not show the key, or of an event the subscription no longer carries,
answers 404.
Redelivery
Section titled “Redelivery”POST /webhooks/{id}/deliveries/{deliveryId}/redeliver queues a delivered or
failed delivery again, with the same webhook-id, the body as it is stored now
and a fresh retry schedule; a pending one is already queued and is left as it
is. The stored body is the one first sent unless turning include_contact or
include_customer off, or erasing the guest, has since reduced it (see
Contact details and personal data). A
consumer that already processed it drops it by its webhook-id, and one that
missed it processes it now. The subscription must be active: on a paused or
disabled one the call answers 409 conflict-webhook-inactive, because its
queue is held. Resume the subscription first, which sends what it held, then
redeliver. A customer or segment delivery that was sent before the guest was
erased answers 409 conflict-delivery-erased and is never sent again; the
customer.deleted event the erasure sends, and booking deliveries (with
customer_id and any embedded customer null), stay redeliverable, so the
delivery that tells you to
erase your copy of the guest can always be sent again. A delivery of an event
the subscription no longer carries
answers 404, as does one the delivery log does not show the key. Removing an
event from a subscription also drops that event’s queued deliveries.
Catching up with updated_since
Section titled “Catching up with updated_since”The webhook stream is at-least-once, but it is not a ledger to replay. An
import sends no customer or booking events, a statement over a
per-write cap drops the excess, a subscription
paused for more than 30 days loses its oldest events, and nothing is sent for
changes made while the app is uninstalled. GET /customers and GET /bookings
take updated_since, an RFC 3339 instant, and return what changed at or after
it instead of every record:
- The page is ordered by
changed_at, thenid, and every item carrieschanged_at. - It covers every change a webhook announces: for a guest, a change to
firstname,lastname,email,phoneormarketing_consentor to an attribute value, a trash, a restore, a merge and an erasure; for a booking, a change to any watched member or to an attribute value, a trash, a restore and an erasure. It also covers the records an import wrote, and deletions outright, which no listing in id order can show. - A trashed record comes back as itself, with
deleted_atset. A guest merged into another comes back the same way;customer.mergednames the survivor. - An erased record, and one deleted outright, comes back as a
RecordTombstone:id,removed: true,reasonandchanged_at, wherereason(erasedordeleted) matchescustomer.deleted’s. Test forremovedbefore reading an item as a record. A tombstone carries only the Nine Tablesid, so if you key your copy by your ownsource_key, keep theidbeside it. - On
GET /bookings,from,toandstatuscannot be combined with it, because a booking that changed out of the filter could not be reported; they answer 400validation-failedkeyedupdated_since.restaurant_idcombines. - It reaches back at most 90 days, how long a
tombstone is kept. An older instant answers 400
validation-failed; resync by paging the list withoutupdated_since, then poll from the time that resync began.
Overlap your polls. changed_at is the time of the write’s own statement,
not of its commit, so a write still open when you poll can appear later with an
earlier changed_at. Start each poll at the previous poll’s highest
changed_at minus 10 minutes, and dedupe by id. A write that stays open
longer than that can still be missed, and its webhook is the backstop.
Verifying a delivery
Section titled “Verifying a delivery”Deliveries are signed per Standard Webhooks, so any of its libraries verifies them with the subscription’s secret. Each delivery carries these headers:
webhook-id: <uuid>webhook-timestamp: <unix seconds>webhook-signature: v1,<base64(hmac-sha256(key, webhook-id + "." + webhook-timestamp + "." + rawBody))>X-NineTables-Event: segment.customer.enteredX-NineTables-Test: trueX-NineTables-Event repeats the body’s type, so a router can dispatch before
parsing, and X-NineTables-Test: true appears only on a
test delivery.
A verifier follows seven rules:
- Verify the raw body. Compute the MAC over the bytes exactly as they
arrived, not over a re-serialised parse:
JSON.stringifyof a parsed body is a different byte string, so it verifies as false. - Decode the key. The HMAC key is the part of the secret after
whsec_, base64-decoded, not the secret string itself. - Check the timestamp.
webhook-timestampis when this attempt was sent. Reject a delivery more than 300 seconds away from your clock. - Accept any matching entry.
webhook-signatureis a space-separated list, and for 24 hours after a secret rotation it carries two entries (v1,<new> v1,<old>). - Compare in constant time, over byte strings of equal length.
- Never throw. Every header is attacker-controlled, so answer false for an absent, repeated or malformed header and for a body of the wrong type. A verifier that throws answers 500, and the platform retries the same payload on the whole schedule.
- Deduplicate after verifying, on
webhook-id.
A Node verifier that follows them:
const crypto = require('node:crypto');
// True only for a genuine delivery whose webhook-timestamp is within 300 seconds of// this clock, either way. Anything else, input of the wrong shape included,// answers false rather than throwing.const verifyWebhook = (id, timestamp, signatures, rawBody, secret) => { try { if (typeof id !== 'string' || typeof timestamp !== 'string') return false; if (typeof signatures !== 'string' || !secret.startsWith('whsec_')) { return false; } const sentAt = Number(timestamp); // A non-numeric header is NaN, which compares false with everything, so // the skew check alone would let it through. if (!Number.isFinite(sentAt)) return false; if (Math.abs(Date.now() / 1000 - sentAt) > 300) return false; const key = Buffer.from(secret.slice('whsec_'.length), 'base64'); const expected = Buffer.from( crypto .createHmac('sha256', key) .update(`${id}.${timestamp}.`) .update(rawBody) .digest('base64'), ); return signatures.split(' ').some((entry) => { if (!entry.startsWith('v1,')) return false; // timingSafeEqual throws on buffers of different lengths, so compare the // lengths in bytes first: a multibyte entry is longer in bytes than in // characters. const given = Buffer.from(entry.slice('v1,'.length)); return ( given.length === expected.length && crypto.timingSafeEqual(given, expected) ); }); } catch { return false; }};rawBody is the bytes that arrived, as a Buffer or the string they decode
to. In Express, mount the route with express.raw({ type: 'application/json' })
so req.body is that Buffer, and read the headers with req.get().
Test your verifier offline
Section titled “Test your verifier offline”These five values satisfy the algorithm above, so you can test a verifier with
no live endpoint. It must return true for them, and false once you change one
byte of the body. rawBody is one line with no trailing newline, exactly as
printed. The timestamp is in the past, so check the MAC with the 300-second
check disabled or with your clock set to the timestamp.
secret whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS1wcm9kLTE=id 01a021aa-e40b-7d46-9332-0bee5c13fa45timestamp 1787270400rawBody {"id":"01a021aa-e40b-7d46-9332-0bee5c13fa45","type":"segment.customer.entered","api_version":"1","created_at":"2026-08-21T00:00:00.000000Z","data":{"segment":{"id":"01a021aa-e40c-7350-94d9-c5b629a34d4b","name":"Regulars"},"customer":{"id":"01a021aa-e40c-7350-94d9-c5b7d7e1db0f","source_system":"pos_x","source_key":"cust-889","firstname":"Kari","lastname":"Nordmann","created_at":"2026-03-14T18:22:05.118204Z"}}}signature v1,QDAJf0tgJ5Aq/FyoUjpJ2LPe9NJFTj8RYUbhOfPdkLk=