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

A price creates nothing, so POST /v1/price takes no key.

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, status included, with the header Idempotent-Replayed: true. A replayed 201 also carries Location again.
  • Retry with the same key but a different request, and you get 422 idempotency_key_reused.
  • Retry while the original is still running, and you get 409 idempotency_key_in_progress. 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 reveals and submissions belong to their quote, so fulfill-1 on one quote never collides with fulfill-1 on another. Keys for firm quotes are kept separately for each partner; anonymous callers share one space, so make those unique. A random UUID never clashes.