Skip to main content
Send an Idempotency-Key header on a POST request and a retry of the same request will not create a second call, lead or ticket.

Where it applies

The header is optional. Without it, the request behaves as before. On any other endpoint the header is ignored.

Key format

8 to 128 characters: letters, digits, ., _, : and -. Use a UUID or a stable id from your system, such as an order id. Any other format returns 400 with INVALID_IDEMPOTENCY_KEY. Keys are scoped to your account and to the API version. The same key used on v1 and v2 is two independent keys.

What happens on a retry

“Same request” means the same method, path and JSON body. Key order inside the body does not matter, and the query string is not part of the comparison. In v2 the body is compared after validation, so values that normalize to the same input (for example extra whitespace around a name, or unknown fields that are dropped) count as the same request. In v2, a replayed success response carries the requestId and timestamp of the replaying request, with the same data. A replayed error response is stored as sent, so it keeps the requestId of the original request.

What is not stored

  • Responses with a 5xx status or 429 are not stored. You can retry with the same key and the request is processed again.
  • Requests rejected before the key is checked are not recorded. In v2 that includes authentication errors, rate limiting and body validation errors. You can fix the request and reuse the key.

What is stored

Every other response is stored and replayed, including 4xx errors produced by the handler. For example, a 402 for insufficient credits or a 404 for an unknown agent is replayed for the same key. In v1, body validation runs inside the handler, so a 400 is also replayed. Use a new key after you change the request.

Slow requests and fail-open behavior

  • While a request with a key is running, the server keeps its in-progress claim alive (it is refreshed every 40 seconds against a 120-second claim). A slow POST /calls/bulk therefore keeps blocking a duplicate with 409 IDEMPOTENCY_IN_PROGRESS until it finishes. If the worker crashes, the claim expires after 120 seconds and the key can be used again.
  • Idempotency is fail-open. If the idempotency store is unavailable when the request starts, the request is processed without protection instead of being rejected, and a retry with the same key can run twice. If the store fails while the response is being saved, the response is still returned to you, but a retry may run again.
Idempotency protects against duplicate submissions by your own retries. Do not rely on it as the only guard against duplicates when your operation is not safe to repeat.

Retry pattern

  1. Generate the key once per logical operation, before the first attempt.
  2. On a timeout, a network error, 429, 503 or 500, retry with the same key and the same body.
  3. On 409 IDEMPOTENCY_IN_PROGRESS, wait for Retry-After and retry.
  4. Never reuse a key for a different operation.