Skip to content

Idempotency

Send Idempotency-Key: <your-key> (≤128 chars) on POST /batch, on both attribute PATCHes, on POST /customers, POST /bookings and PATCH /bookings/{bookingRef}, on BOTH the POST and the PATCH of /categories, /definitions and /webhooks, on POST /definitions/{entity}/{key}/recompute, POST /webhooks/{id}/rotate-secret and POST /webhooks/{id}/deliveries/{deliveryId}/redeliver, and on POST /loyalty/members and POST /loyalty/members/import — seventeen operations.

The seventeen are exactly the operations that declare an idempotency-key parameter in the API reference, and that list is the contract: on any other operation the header is accepted and IGNORED — no error, no Idempotent-Replay, nothing stored — the same silent treatment an unknown query parameter gets. A client that stamps the header on every call gets replay protection on the operations that DECLARE the parameter and nothing at all on the others, and cannot tell the two apart from the response. GET and DELETE routes take no key because they are already idempotent, but POST /customers/resolve and the source-identity PUTs and DELETEs also take none — check the operation’s parameters, not the method.

Recipe: pick a key per logical operation (e.g. your outbox row id), retry with the same key and byte-identical body until you get a response. Same key + same request → stored response replayed with Idempotent-Replay: true — the original status, body and Location header. Replays live 24h and are scoped to your key id, which GET /me reports (they do not survive key rotation).

Same key + a different request → 422 idempotency-key-conflict. “Different” is exact and covers more than the body: the stored fingerprint covers the method, the path with the query parameters the operation declares (force on rotate-secret), and, on an operation that takes a body, the body’s bytes exactly as sent, so re-using one key across two routes conflicts just as re-serialising an equivalent body does.

{
"type": "https://ninetables.io/problems/idempotency-key-conflict",
"title": "Idempotency Key Conflict",
"status": 422,
"detail": "This Idempotency-Key was already used for a different request",
"code": "IDEMPOTENCY_KEY_CONFLICT"
}

A concurrent duplicate, sent while the first request is still running, answers 409 idempotency-key-in-flight with Retry-After: 2. Retry it shortly with the same key:

{
"type": "https://ninetables.io/problems/idempotency-key-in-flight",
"title": "Idempotency Key In Flight",
"status": 409,
"detail": "A request with this Idempotency-Key is still being processed; retry shortly",
"code": "IDEMPOTENCY_KEY_IN_FLIGHT"
}

A key whose request was applied but cannot replay

Section titled “A key whose request was applied but cannot replay”

The cap is on the STORED row, not on the response you receive (Limits.idempotent_stored_response_bytes): a response over that size is gzipped first, and only one that is still too large compressed goes unstored — replaying such a key then answers 422 telling you it WAS applied. Do not re-send it, with this key or without one: that would apply it twice. These response bodies compress roughly 15×, so nothing a request within Limits.batch_items_per_request can produce reaches it; treat the 422 as a guard you should handle rather than a branch you will see.

The same 422 answers a request that failed (typically a 500) AFTER its write had committed. Retrying that 500 with the same key does not write again: the 422’s detail says the request was applied and names where to read the result — the created booking, guest or definition, or the attributes it wrote. A POST /batch answers a fault on one item as that item’s 500 result inside its 200, so a batch replays like any other stored response. Only a failure after its items have run, while the response is built, leaves it with nothing to replay; it has no single result, so that 422’s detail asks you to read the records it wrote instead of sending it again.