Idempotency

Send an Idempotency-Key header with every write, so a retry after a timeout or a dropped connection can never start a second session, screen a name twice or create a duplicate endpoint.

Sending a key

Generate a new random value, such as a UUID, for each distinct operation, and reuse it only when you retry that same operation. Keys are scoped to your account, so another organization's key can never collide with yours.

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions \
  -H "Authorization: Bearer $NEXIEL_ACCESS_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"clientId":"quickstart","checkType":"age-verification"}'

What happens on a retry

  • Same key, same request, first one finished: you get the first response again, with its status and body. The operation does not run twice.
  • Same key, different body or parameters: 409 idempotency_key_conflict. Nothing runs. Use a new key for a new operation.
  • Same key, same request, first one still running: the copy waits up to 10 seconds for the first to finish and then returns its response. If the first is still running after that, the copy gets 409 idempotency_request_in_progress with a Retry-After header. Retry the same request later to receive the result.
  • The first request failed: errors are not stored. The key is released, so retrying with the same key runs the operation again.

Guarantees

  • A key is claimed before any work starts, so two copies of a request sent at the same moment never both run, even on different servers.
  • A slow request keeps its claim while it runs. If a request stops without finishing, its claim lapses after about two minutes, and the next retry with the same key runs the operation.
  • A stored response is kept for 24 hours. After that, the same key starts a new operation.
  • When the operation writes a record, its response is stored in the same transaction, so a retry never sees a half-finished result.

Which routes take a key

The routes that create or change something accept an Idempotency-Key: sessions, screening decisions, signing and sealing requests, webhook endpoints, relying-party identity, trust policies and more. Send one on every POST, PUT, PATCH and DELETE: a route that does not use it, such as a GDPR erasure request, ignores it. The routes a wallet calls itself, such as the response callback, do not take one.

Combining with retries

Retry network errors, 429, 500 and 503 responses with exponential backoff, keeping the same key for every attempt of one operation. See which errors to retry.

A GET takes no Idempotency-Key: repeating a read is always safe, and cursor pagination keeps a list's pages stable while you retry.