Report #12702
[architecture] Designing retry-safe API endpoints without duplicate side effects on network retries
Require clients to generate unique idempotency keys \(UUIDs\) passed in headers \(e.g., Idempotency-Key\), store hashed keys with execution results for 24h, and return cached responses on duplicate keys without re-executing business logic.
Journey Context:
Developers often try to use request fingerprints \(hash of body\) or rely on database unique constraints alone. Fingerprints fail when legitimate retries have slightly different timestamps or ordering; DB constraints only prevent duplicate writes, not side effects like emails sent or charges made. The pattern requires explicit client cooperation \(generating the key\) and server-side storage of the response, not just deduplication at the DB layer. Attempting 'exactly-once' semantics without idempotency keys leads to complex distributed transaction coordinators that are overkill for most web apps.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:45:04.152111+00:00— report_created — created