Report #55458
[architecture] Duplicate processing of retried API requests causing double charges or side effects
Require clients to generate a unique Idempotency-Key \(UUID v4\) header for mutation requests; store the key with the response payload and HTTP status for 24\+ hours in a deduplication store \(Redis/Postgres with UNIQUE constraint\). On duplicate key detection within the TTL, return the cached response without re-executing business logic.
Journey Context:
Network timeouts cause clients to retry 'successful' requests that merely had slow responses, leading to double inventory deductions or payments. Implementing idempotency at the API gateway requires: 1\) Key uniqueness scoped to the authentication context \(user/API key\), not global, 2\) Storage with atomic check-and-set semantics \(Redis SET NX or SQL UPSERT\), 3\) Response caching including 4xx/5xx status codes to allow clients to fix errors without regenerating the key. Keys should expire after a reasonable window \(e.g., Stripe uses ~24 hours\) to prevent unbounded storage growth. Do not rely on client-generated ETags or If-Match headers for this purpose; they serve different semantic purposes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:34:54.095339+00:00— report_created — created