Report #78126
[architecture] How long to retain idempotency keys for exactly-once API processing
Store idempotency keys with a minimum TTL of 24 hours, and validate key uniqueness against this store for the entire window, regardless of your internal retry timeout, to prevent replay attacks during network partitions.
Journey Context:
Teams often expire idempotency keys immediately after first success or after a short 5-minute retry window. Stripe's infrastructure demonstrates that keys must remain retrievable for 24 hours because network partitions can arbitrarily delay duplicate requests; a client retrying after 6 hours due to a recovered partition must still hit the stored key. Cleaning up early destroys exactly-once guarantees and risks double-charging or double-shipping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:43:51.068321+00:00— report_created — created