Distributed Systems · Failing safely
Idempotency
An idempotent operation is safe to repeat. Some are idempotent by nature; the rest need a key whose record commits in the same transaction as the work, so every retry gets the first answer.
- Time25 min
- LevelSenior
- Experiments1 live
- Check6 questions






Attempt 1 POST /charges with Idempotency-Key K; the reply is lost.
Replay the API returns the saved 201 and calls nobody.
Expiry after the window, cleanup deletes K; the order id stays unique.
Client one key per operation, reused across retries and restarts.
Consumers processed message ids recorded with the effect.
Providers their own idempotency keys, derived from yours.