Definition
A property where performing the same operation multiple times produces the same result, preventing duplicate processing.
In Depth
Idempotency is the property where performing an operation multiple times produces the same end-state as performing it once. The first call applies the change; subsequent calls with identical input are safely absorbed without producing duplicates, side effects, or errors. In API terms, an idempotent endpoint can be retried without fear that retrying will charge a customer twice, create two orders, or send the same email five times.
The standard implementation pattern is the idempotency key: the client generates a unique ID for the operation (often a UUID) and sends it as a header like Idempotency-Key. The server stores a record of (key → result) on first call; on retry with the same key, it returns the stored result instead of re-executing the work. Stripe, GitHub, and most modern payment APIs use this pattern.
HTTP semantics already give you idempotency for free on GET, PUT, and DELETE — those methods are defined as idempotent by spec. POST is not, which is why idempotency keys are critical for POST endpoints that create resources. Without idempotency, every network blip, gateway timeout, or client retry becomes a data integrity bug waiting to happen.
Example Usage
Designing a payment processing API where retrying a failed request never charges the customer twice.
Business Context
Idempotency is critical for reliable integrations — network failures, timeouts, and retries are inevitable, and without idempotency, they cause duplicate records and incorrect data.
Related Terms
API Versioning
The practice of maintaining multiple versions of an API to allow gradual migration when breaking cha...
ETL
Extract, Transform, Load - process for moving data between systems.
GraphQL
Query language and runtime for APIs that allows clients to request specific data.
iPaaS
Integration Platform as a Service - cloud platforms for building and deploying integrations.
Message Queue
An asynchronous communication mechanism that decouples systems by storing messages until the receivi...
Also Known As
Tags
Quick Info
Need help implementing this in your business?
Get Started