Idempotency-Key is required for order create, cancel, and replace requests.
idempotency_key appears in the JSON body, it must match the Idempotency-Key header.
What Counts As The Same Intent
Use one idempotency key for one business action:
If you change the order quantity, price, side, or pair, generate a new key. If you are only retrying because the network failed or the response was uncertain, reuse the original key.
Storage Pattern
Store the idempotency key before sending the API request.order_id, attach it to the local action. If the request times out, retry with the same key and then reconcile the returned order state.
Response Handling
Checklist
- Store the key with your local order action before sending the request.
- Retry uncertain responses with the same key.
- Generate a new key only for a new intent.
- Treat
409as an idempotency or current-state conflict. - Never use timestamps alone as idempotency keys; use a UUID or similarly unique value.
- Keep idempotency keys out of logs if your logs are widely accessible.