Esc
  • Jump to
  • The board
  • All launchesSort and filter by week or category
  • Open statsEvery number, in public
  • Maker storiesApps that stopped hiding
  • Submit a launch
  • AICategory
  • AnalyticsCategory
  • API & BackendCategory
  • Audio & VoiceCategory
  • AutomationCategory
  • CommunityCategory
↑↓ to move↵ to openPress / anywhere
Sign in

What is 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.

Updated · Building

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.

Formula / syntaxClient 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

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.

Launch free →

On the board

All →

Still hiding your app?

Put it on the board. Reviewed by a person, free to launch.

Launch free
Submit a launch