Idempotency Is Easy Until the Second Request Is Different
Why idempotency in APIs is not just 'repeat the same request' but a whole science with pitfalls.

Everyone knows idempotency means a repeated request gives the same result as the first. Sounds simple, like pressing the elevator button twice. But in reality, it's more like assembling an IKEA cabinet without instructions: same parts, yet the outcome is different.
In practice, idempotency breaks when the second request comes with different data. For example, the client sends the same idempotency key but with a modified body. The server must decide: ignore the new body or treat it as a new request? Both can lead to unexpected consequences.
The author breaks down typical scenarios: from a simple repeated POST to complex cases with partial updates. It gets especially painful with distributed systems — every extra request can trigger a cascade of errors, like accidentally emailing a critical bug to all customers.
The main takeaway: idempotency is not just a protocol but an architectural decision. If you think adding an idempotency_key field to the database is enough, you're in for a surprise. Like with a midnight deploy, better measure twice than debug a production incident at 3 AM.
METABYTE studio's comment: Idempotency is one of those topics many developers postpone until they face duplicate payments or broken orders. At METABYTE, we bake idempotency into the architecture from day one — it's cheaper than explaining to a client why they were charged twice.
NEXT STEP
Liked the approach?
We apply the same principles to client projects: AI, automation, products that don't die after launch.