Three requests create something: a firm quote, revealing a secret, and submitting a private swap. If one of them times out, you can’t tell whether it went through. Send an Idempotency-Key header with it, and if you need to retry, use the same key. You’ll get the original result instead of a duplicate.

Where it applies

Prices don’t create anything, so a key sent with one is ignored. It still has to be valid.

How it works

  • A key is 1 to 255 standard characters (printable ASCII, no spaces). Use a new one for each operation, such as a random UUID or an order number from your system.
  • Retry with the same key and the same request, and you get the original response.
  • Retry with the same key but a different request, and you get 400 invalid_request.
  • Retry while the original is still running, and you get 409 not_ready. Wait a moment and try again.
  • If a request fails, its key is freed so you can try again.
  • Keys are remembered for 24 hours.
Keys for firm quotes are kept separately for each partner. Keys for reveals and submissions are shared across everyone, so make them unique. A random UUID never clashes.