All glossary terms
Design

Idempotency

An operation is idempotent if calling it multiple times has the same effect as calling it once. In distributed systems, idempotent operations let you retry on network failure without duplicating side effects — a critical property for any API that handles payments, account changes, or external system calls. Without idempotency, a retried request risks double-charging, double-emailing, or corrupted state.

The standard implementation pattern is the idempotency key: a client-supplied unique identifier (often a UUID) that the server uses to recognise duplicates. The first request with key X executes and stores its result; later requests with the same key return the cached result without re-executing. Stripe popularised this pattern for payment APIs; it's now the canonical approach for any retry-safe API. Idempotency is one of the few API design choices that's genuinely hard to retrofit — much easier to bake in from day one.

Related terms