Glossary/Idempotency
API & Integration
1 min read
Share:

What is Idempotency?

TL;DR

An operation is idempotent if performing it multiple times produces the same result as performing it once.

An operation is idempotent if performing it multiple times produces the same result as performing it once. In distributed systems, idempotency is critical for handling retries safely — network failures and timeouts mean requests may be sent multiple times.

HTTP method idempotency: GET (always idempotent), PUT (idempotent — setting a value to X twice = setting it once), DELETE (idempotent — deleting twice = deleting once), POST (NOT idempotent by default — creating a resource twice creates two resources).

Implementing idempotency: Idempotency keys (client sends a unique ID with each request; server deduplicates by key), Last-write-wins (for update operations), and Database constraints (unique constraints prevent duplicate creation). Stripe uses idempotency keys for payment API — critical for preventing double charges.

Why It Matters

In distributed systems, exactly-once delivery is impossible. Operations will be retried. Without idempotency, retries cause duplicate records, double charges, and corrupted state. Idempotency turns "at-least-once" into "effectively-once."

Frequently Asked Questions

What is idempotency?

An operation is idempotent if doing it multiple times has the same effect as doing it once. Critical for safe retries in distributed systems. PUT and DELETE are naturally idempotent; POST is not.

How do you make APIs idempotent?

Idempotency keys (client provides a unique request ID, server deduplicates). For updates: use PUT with full resource representation. For creates: check for existing records before inserting.

Related Terms

Need Expert Help?

Richard Ewing is a Product Economist and AI Capital Auditor. He helps companies translate technical complexity into financial clarity.

Book Advisory Call →