api-designbackendsystem-design
Idempotency keys make retries safer
Anonymous
For a write API, associate a client-supplied key with the operation result. If the same key arrives again, return the recorded response rather than applying the mutation twice; reject reuse of a key with a different payload. Scope keys to an account or operation, set an expiry policy, and handle concurrent requests for the same key atomically. Keeping key recording and the mutation consistent is the hard part.
0