Idempotency-Key request header on every
mutating endpoint so you can safely retry after a network failure without
double-creating, double-deducting, or double-updating.
Supported endpoints
| Method | Endpoint | Effect of replay |
|---|---|---|
| POST | /developer/vouchers | No second voucher |
| POST | /developer/vouchers/{code}/redeem | No second deduction |
| POST | /developer/customers | No second customer |
| PATCH | /developer/customers/{customer_id} | No second update |
How it works
- Generate a unique key per logical operation (a UUID is fine). The header value can be up to 256 characters.
- Send the key in the
Idempotency-Keyheader on the request. - The server claims the key in Redis along with a SHA-256 fingerprint of the request body. The first request runs the operation and caches the response.
- Subsequent requests with the same key and the same body return the cached response verbatim – they do not re-execute the operation.
- The cache entry expires 24 hours after the first request.
Scoping
Idempotency keys are scoped to the API key that supplied them. Two different API keys can use the same idempotency key value without colliding, even within the same tenant.Same key, different body → 409
If you reuse anIdempotency-Key with a different request body within the
24-hour window, the server returns 409 Conflict instead of silently
replaying the original (now-stale) response:
amount, a different
email, a different first_name) and would otherwise receive the original
response with no indication that the new payload was discarded.
Concurrent duplicates → 409
If two requests with the same idempotency key arrive concurrently and the first has not yet finished, the second receives:Endpoint errors release the key
If the first request fails (validation error, business-rule rejection, etc.) the pending claim is released so you can retry with the sameIdempotency-Key after fixing the body. A transient endpoint error does not
permanently burn an idempotency key for 24 hours.