POST, PATCH, DELETE) requires an Idempotency-Key header. This lets you safely retry after network failures without creating duplicate orders, cancellations, withdrawals, or copy-trade subscriptions.
Key format
- Send
Idempotency-Key: <uuid>where<uuid>is a UUID v4. - Generate a fresh UUID for every distinct logical operation.
- Reuse the same UUID only when retrying a request that failed with a network error or timeout.
- Keys are 36 characters and must match the UUID v4 canonical format.
Scope
Idempotency keys are scoped to your API key. The same UUID sent under a different token is a different key. Keys are also scoped to the target endpoint. The same UUID sent to two different endpoints is treated as two separate operations.Retention window
Idempotency keys are retained on the Bravado side for a bounded window. Retries received within the window return the original response withIdempotent-Replayed: true set. Retries received after the window has expired are treated as a fresh request and can create a new operation.
Replay behavior
On a successful match against a prior request:- The response body is exactly the original response.
- The HTTP status is the original status.
- The response includes
Idempotent-Replayed: true. - No new operation is executed.
Conflicting payloads
If you reuse an idempotency key but change the request body, Bravado returns:- Do not reuse a key for a semantically different operation.
- Do generate a new UUID for each new intended operation.
When to retry
Retry with the same key when:- The network dropped mid-request and you never received a response.
- You received a
5xxresponse. - You received a
429withRetry-After(retry after honoring the header).
- You received a
4xxresponse other than429. Fix the request first, then submit with a new key. - Enough time has passed that the key may have expired (see retention window above).
Example
Placing an order with retry-safe idempotency:key is reused across all three attempts. If the first attempt landed and the response was lost, the retry returns the same order with Idempotent-Replayed: true.
Related
- Rate limits for the retry policy that pairs with idempotency.
- Error reference for the error responses you may see on retry.
- Safe retries with Idempotency-Key for a full worked guide.