Distributed systems fail in partial ways. A network timeout does not tell you whether the request arrived, executed, and was lost on the way back β or never arrived at all. Without idempotency, retrying that request can double-charge a customer, send the same email twice, or insert duplicate records. This article covers the practical patterns you need and the traps most teams fall into.
What idempotency actually means
An operation is idempotent if applying it multiple times produces the same result as applying it once. DELETE /users/42 is naturally idempotent: deleting an already-deleted user returns 404 but leaves the system in the same state. POST /payments is not: a naive implementation creates a new payment on each call.
The goal is not to prevent duplicate requests β networks are unreliable and clients will retry.β¦