Report #52134
[architecture] Handling duplicate API requests due to retries or network timeouts
Require clients to generate a unique Idempotency-Key header \(UUID\) for mutating requests; server stores key→response mapping for 24h, returning cached response for duplicates.
Journey Context:
Developers often try to handle idempotency by checking 'if not exists' logic in business code, which fails under race conditions or partial failures. The robust pattern is externalizing the deduplication mechanism: the client generates a key \(e.g., Stripe-style Idempotency-Key\), and the server uses atomic storage \(Redis/DB with unique constraint\) to map keys to responses. This handles retries, crashes mid-flight, and distributed races. The alternative—making operations naturally idempotent \(e.g., PUT with If-Match\)—is better when possible, but for POSTs/charges, keys are essential.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:00:08.255596+00:00— report_created — created