Idempotency-Key header. Send one key per logical write, and send the same key again, unchanged, on every retry of that write. If a response is lost, a retry gets the first answer back instead of making the change twice.
Which requests need a key
- Writes: every
POST,PATCH,PUTandDELETE. Without a key the request is refused with400 idempotency_key_required. - No key needed: reads; the read-only
POSTs (/record-search,/records/{type_id}/query,/facts/query,/figures/query,/figures/explain); dry runs ("dry_run": true); and creating the ontology (POST /v1/object-model, which an organization can do only once). These are never recorded.
What a retry gets
A key belongs to your organization and to the person the API key acts for. Two of one person’s API keys retrying the same write agree. Another person using the same key string makes a separate write of their own. The API records each write’s fingerprint: the method, the route, the path, the request body as parsed (key order and spacing do not matter) and anyIf-Match. A retry then gets one of three answers:
A replay is authorized like any request: the API key must still be valid and carry the route’s scope, and the replay counts toward the rate limit. An
If-Match the original carried is not checked again, because the original’s own success moved the version it named.
A lost response
The connection drops before the answer arrives, so the client sends the same request with the same key:A concurrent duplicate
A second copy arrives while the first is still running:Idempotent-Replayed: true.
What is recorded, and for how long
- Every answer the ontology gave is recorded, refusals included. For example, a
422for an action that stopped part way replays with what it committed, so a retry never quietly writes more. - Some failures are not recorded: a permission refusal (
403), a5xx, a503and a504. None of them says what was committed, so a retry with the same key runs again. The ontology recognizes the key for the writes listed below, so the change is still made once. - After a
504the request may still be running. A retry within the time the API waits for that route plus 30 seconds getsrequest_in_progress. After that, the retry runs again. - Answers replay for 24 hours. After that the key is free, and a request under it runs again.
- If the record cannot be written or read, the write does not run, and you get
503 idempotency_unavailablewithRetry-After.
After the replay window
Past 24 hours, or after a504 whose hold has lapsed, a retry reaches the ontology again. Most writes are still recognized by their key there. Each endpoint page describes its own behavior under Re-sent under the same Idempotency-Key. In summary:
Actions
An action run’s key also names the run. Itsinstance_id is derived from the person and the key, so two people who choose the same key run two separate runs, and the answer carries the instance_id.
A run that stopped part way answers 422 with what it committed under result. Re-sending it under the same key answers that partial result again and writes nothing. To continue the run, send the same action, subject and params with a new Idempotency-Key, the instance_id from the partial answer, and "resume": true:
instance_id belongs to your organization. Another person’s run under it, or the same id with a different body, is refused with instance_mismatch.
The generic endpoint
The older generic endpoint (POST /v1/object-model/{object_model_id}/request) takes Idempotency-Key optionally. Without one, a request runs every time it is sent. With one, it is recorded and replayed as described above.