Plain definition
Definition of Idempotency
A property of an operation or API request where executing it multiple times with the same inputs produces the exact same end state as executing it once.
Client Retry (Same Idempotency-Key + Payload) -> Server Detects Prior Result -> Returns Original Response (No Duplicate Side Effect)Worked example
Imagine a made-up team-gifting app called PerkCrate that triggers a $49 credit top-up via `POST /v1/credits/purchase`. On mobile train Wi-Fi, a buyer clicks 'Buy credits', the server charges their card and adds $49, and the connection drops before the JSON receipt reaches the phone. When the client retries `POST /v1/credits/purchase` two seconds later without an idempotency safeguard, the user gets billed $98 and receives two top-ups.
To make the mutation idempotent, PerkCrate's frontend generates a fresh UUID v4 (`Idempotency-Key: 9b2e7c10-...`) per checkout attempt and passes that key down to Stripe as well as its own `idempotency_records` database table. On the retry, PerkCrate sees the matching key scoped to that user, confirms the request parameters match, skips charging or crediting again, and replays the saved `200 OK` receipt cleanly.
Why it matters when you launch
Under RFC 9110 and MDN HTTP semantics, safe methods plus `PUT` and `DELETE` are defined as idempotent, whereas `POST` and `PATCH` are not guaranteed idempotent unless your server enforces it. Networks drop packets on flaky mobile connections, users double-click submit buttons, and payment or email webhook providers automatically retry deliveries whenever a response times out.
Stripe's API documentation recommends client-generated V4 UUID idempotency keys (never PII like emails) on create and update calls so retries never double-charge customers. Applying the same pattern to your own billing routes, credit grants, and webhook event IDs prevents your most stressful launch-week accounting bugs and keeps customer balances accurate.
Common mistakes
- Assuming `POST` endpoints or payment webhook handlers will only be called once, leading to double charges, duplicate welcome emails, or doubled credits.
- Using predictable values or sensitive personal data like user emails as idempotency keys instead of random high-entropy UUIDs.
- Reusing the same idempotency key across completely different request payloads without rejecting parameter mismatches.
- Performing a non-atomic check-then-insert without a database unique constraint, allowing two simultaneous retries arriving 5 ms apart to both execute.
Tools and guides that use it
Free tool
SaaS Payment Fee & MoR CalculatorCompare net take-home across Stripe, Paddle, Dodo Payments, Polar, Creem and a custom rate using verified 2026 fees.Free tool
Launch Day ChecklistEverything to check before, during and after launch day, saved in your browser.Founder guide
Micro-SaaS Pricing Playbook: Free Trials, Lifetime Deals and TiersHow to choose a pricing model for a small SaaS: picking a first price, trials vs freemium, value metrics, tiers, annual plans, raising prices and when lifetime deals make sense.Founder guide
The Next.js Technical SEO Launch Checklist (2026)What to check before and after launch day: crawlability, metadata, canonical URLs, structured data, sitemaps, internal links, Core Web Vitals and AI crawlers.Related glossary terms
Official sources
Pritam Ghosh runs Hauntboard and maintains this glossary.
Published · Updated
Building something real? Launch it in public.
A person reviews every launch on Hauntboard, and every view and visit it sends your site is published on your launch page. Free to submit.