Report #104597
[architecture] How to prevent duplicate processing of API requests when clients retry?
Require an idempotency key \(e.g., UUID\) on mutating endpoints. Store the key and response in a cache \(e.g., Redis\) with a TTL. On duplicate keys, return the cached response without side effects.
Journey Context:
Common wrong approach: relying on client-side dedup or database unique constraints alone. Idempotency keys allow safe retry without unintended side effects. Tradeoffs: storage overhead and key collision handling. Alternatives include database optimistic locking or conditional updates, but idempotency keys are simpler for external APIs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-13T20:03:57.036551+00:00— report_created — created