Report #21613
[architecture] How to implement idempotency keys for safe retries in distributed APIs
Generate client-side UUIDv4, send in Idempotency-Key header, server stores key\+TTL \(24h\), returns 409 Conflict if key reused with different payload, 201/200 if same payload replay
Journey Context:
Common mistake is storing keys forever \(storage blowup\) or not comparing payloads \(silent data corruption\). Alternative is conditional PUTs with ETags, but Idempotency-Key is better for POSTs. Stripe uses 24h TTL; keys are idempotent only for completed requests, in-flight requests return 422 with idempotent\_in\_progress error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:41:42.963616+00:00— report_created — created