Idempotency-Key header makes a retry safe — the server recognises a repeated
operation and returns the original result instead of performing it again.
How it works
Generate one UUID per logical operation
The client creates a fresh UUID v4 for each distinct operation (e.g. one
wallet send) and sends it in the
Idempotency-Key header.The server reserves the key first
Before performing the operation, the server atomically reserves the key. If
the reservation succeeds, this is the first attempt and the operation runs.
Retries replay the stored response
A retry with the same key returns the originally stored response — the
operation is never performed twice.
Header
Which operations support it
Idempotency keys apply to money-moving operations. In EU Rails, wallet send operations acceptIdempotency-Key.
Plain payments (
POST /payments) do not accept an Idempotency-Key
header. To avoid duplicate payments, guard the submission on the client (for
example, disable the submit control until the request resolves) and reconcile
against transaction status.Example: a wallet send
cURL
Node
Both success and failure are stored
The server stores the response for a key whether the operation succeeded or failed. This matters: if it only stored successes, a retry after a failure would get a409 “in progress” forever instead of the actual error. Because
failures are stored too, retrying a failed operation with the same key replays
the original failure — change the operation (and the key) to try again.
Errors
How the
409 and other failure responses are shaped.
