Idempotency-Key identifies retries of the same operation so the server can avoid duplicate effects while that key is retained.
How it works
Send anIdempotency-Key on a public POST or PATCH request to a /v1/ endpoint. Use one key for one business operation and persist it before submitting the request. A retry of that operation uses the same key, API key, acting account, method, path and body.
- Bachs executes the first request.
- A successful JSON response is cached for 24 hours from when it is stored.
- A matching retry returns the cached body and status without running the handler again. Reading a cached response does not extend its lifetime.
Using the header
Scope and caching
A 4xx or 5xx response is not cached by this middleware. Handle validation errors before trying again. For an uncertain write, reconcile its actual state before repeating it; keeping the same key is part of recovery, not proof that every failed exchange is safe to repeat.
If the original request is still running, a retry can return
409 IDEMPOTENCY_IN_PROGRESS. Wait briefly and retry the same operation with the same key. When a key’s response has expired, it no longer protects against a new execution; reconcile before resubmitting an old operation.
Fingerprint mismatch 409
Each idempotency key is bound to the exact request it was first used with (method + path + body). If you reuse a key with a different request body, you will receive409 with IDEMPOTENCY_CONFLICT:
Choosing good keys
Good
Tied to a specific business operation:
order_ORD-12345withdrawal_2026-05-14_batch-3_item-7checkout_usr_abc_session_xyz
Avoid
Keys that could collide or repeat:
- Random UUIDs regenerated on each retry (defeats the purpose)
- Timestamps alone (collide under load)
- Generic strings like
retry_1
Recover an uncertain write
- Keep the original operation ID,
Idempotency-Key, request body and acting account in your records. - For a timeout or 5xx, retrieve or reconcile the operation. For a withdrawal, use Get Payout or List Payouts.
- If you confirm a retry is needed, reuse the original key and unchanged request. Follow
Retry-Afteron rate-limit errors and wait briefly onIDEMPOTENCY_IN_PROGRESS. - If you cannot establish the outcome, investigate or contact support with the request ID. Do not create a replacement operation with a fresh key solely because the first response was lost.

