Idempotency
Send an Idempotency-Key header on every POST, PUT, PATCH and DELETE. If a request times out or the connection drops, send it again with the same key: the API either finishes the original action once or replays its stored answer. A retry can never create a second object or repeat a money action.
curl https://holdyn-fb2e34c7cbae.herokuapp.com/api/v1/b2b/mandates \
-H "Authorization: Bearer $HOLDYN_API_KEY" \
-H "Idempotency-Key: 6f1b0b40-2f0a-4d6e-9d6c-2e4c3b5a7c11" \
-H "Content-Type: application/json" \
-d '{ "title": "Kitchen fit-out, phase 2", "amount": 2000000 }'Rules#
- The key is 1 to 255 printable ASCII characters. Use a UUID v4, one per user intent.
- Scope: a key is tied to who sent it, not just the tenant: the member, the API key or the portal grant. Two callers can never replay each other's responses. Keys are kept for 24 hours.
- Same key, same route, same body: the stored status and body are returned with the header
Idempotent-Replayed: true. - Same key, different route or body:
409 idempotency_key_reused. - Same key while the first request is still running:
409 idempotency_in_progresswithRetry-After: 2. Wait and retry. - What is stored:
2xxanswers and deterministic4xxanswers (400, 404, 409 other than the two above, 413, 422). Answers401,403,429,5xxand504are not stored, so a retry runs again. - If the idempotency store itself is unavailable, writes fail closed with
503 idempotency_unavailable.
Routes that do not store a response#
Public routes and routes that return a session are not stored; sending a key to them does nothing: signup, email verification, password reset, invitation preview and accept, login and MFA routes. Their effects are safe to repeat by design.
Secrets are never replayed#
Routes that return a secret once (POST /api-keys, POST /api-keys/:id/roll, POST /webhook-endpoints, POST /webhook-endpoints/:id/rotate-secret, POST /mandates/:id/grants, and POST /mandates/:id/send with notify_parties: false) store their answer with every secret set to null. A replay returns that redacted body with "redacted": true and "secret_returned": false. If you lost the secret, roll or re-issue it.
Without a key#
Even without the header, every action is safe under concurrency: status changes are compare-and-set and unique indexes stop duplicates. The key is still how you get the same answer back on a retry.
