Report #97771
[architecture] How do I make API writes safe to retry?
Accept an Idempotency-Key header on mutating endpoints. Hash the key with the request method and path, store it with the response for 24 hours, and return the cached response on duplicate requests. Reuse of the same key with a different payload must return an error.
Journey Context:
Network timeouts make clients retry, which creates duplicate charges, posts, or records. Random tokens don't help unless the server remembers them. The key must be client-generated and scoped to the exact request; changing the body while reusing the key is an error. This moves safety from the unreliable client to the authoritative server.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:40:51.668896+00:00— report_created — created