March 2026 • Rich Robertson

What Is Idempotency? (And Why It Matters in Distributed Systems)

An idempotent operation produces the same result whether it runs once or ten times. This property is not just a convenience — in distributed systems, it is what makes safe retries, durable workflows, and reliable message processing possible.

The Simple Definition

An operation is idempotent if applying it multiple times has the same effect as applying it once. The result after the first call is the same as the result after any subsequent call with the same inputs.

A good everyday example: setting the thermostat to 21°C is idempotent. Whether you press the button once or five times, the result is the same. Incrementing the temperature by 1°C each time is not — each press changes the outcome.

HTTP Methods and Idempotency

HTTP defines idempotency as part of its method semantics:

PATCH is ambiguous — it depends on whether the patch operation is absolute or relative.

Why Retries Require Idempotency

In distributed systems, network calls can fail in two ways: the request never arrived, or the request succeeded but the response was lost. From the caller's perspective, these look identical — a timeout or connection error. The only safe response is to retry.

If the operation is not idempotent, that retry is dangerous. A payment that timed out may have already been charged. Retrying processes the payment again. The customer pays twice.

If the operation is idempotent — or made idempotent via an idempotency key — retrying is safe. The server detects the duplicate and returns the original result without re-executing the action.

Idempotency Keys

For operations that are not naturally idempotent (like POST to create a payment), you can add idempotency by using a client-generated unique key. The caller generates a UUID or similar token, sends it as a request header (often Idempotency-Key), and the server stores the result of the first execution.

On a retry with the same key, the server looks up the stored result and returns it without re-executing. On a fresh key, it executes normally. Stripe, Braintree, and most payment APIs work this way.

The important details:

Idempotency in Distributed Workflows

Beyond APIs, idempotency matters anywhere work can be retried or replayed:

What Good Idempotent Design Looks Like

What to Read Next

For a broader view of my distributed systems and API work, see Distributed Systems Engineering: Correctness, Coordination, Reliability.

Idempotency and distributed locks are closely related — locks prevent concurrent execution of the same operation across workers. See What Is a Distributed Lock? (With Examples) for how lock semantics and fencing tokens protect critical sections. For a broader production framing of assumption failures around retries and partial completion, read The Fallacies of Distributed Computing Still Break Modern Systems. For overload and retry amplification under load, see Backpressure in Distributed Systems: Stability, Correctness, and Graceful Degradation.