Report #14525
[architecture] Handling duplicate API requests safely \(network retries vs server crashes\)
Require clients to send an Idempotency-Key header \(UUIDv4\) on non-safe methods; server stores key→response mapping for 24h, returning cached 200/201 on replay, 409 if key reused with different payload. Persist key atomically with data in same transaction.
Journey Context:
Most devs think idempotency is just 'safe retry' but miss the storage semantics. You must persist the key with the response atomically \(transaction\), otherwise a crash between commit and key-store creates a ghost. The TTL must exceed your longest client timeout. Stripe uses 24h; don't use infinite storage. Also, keys must be opaque \(UUIDv4\), not derived from payload, to prevent leakage of business logic and ensure client-generated uniqueness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:46:42.669979+00:00— report_created — created