The contract
SendIdempotency-Key: <opaque-string> on a request that creates something
or spends credits. Within 24 hours, a retry with the same key and the
same body returns the same status code and body, byte for byte, with an
Idempotent-Replay: true header. Nothing runs again and nothing is charged
again.
- Still running: a retry while the first request is in progress gets
409 idempotency_in_flight. Wait and retry; never run a second copy. - Same key, different body:
422 idempotency_key_reuse. A key binds to one payload. - Keys are scoped to your account, so two accounts sending the same key never collide.
Where it applies
Use it whenever the same logical action might fire twice: network retries,
double clicks, agent tool calls that time out.
Pattern: generate the key once
${tool_name}-${workflow_id}-${YYYY-MM-DD} collapses the same
request on the same day into one run.