Skip to content
Glossary · System design

Idempotency

Also called idempotent, idempotency key.

Definition

The property of an operation that has the same effect whether it runs once or several times, so it is safe to retry.

Last updated

What it is.

In HTTP, RFC 9110 calls a method idempotent if several identical requests have the same intended effect as one. PUT and DELETE are idempotent by definition; POST is not. Setting a value to 5 is idempotent. Adding 5 is not.

For actions that are not naturally idempotent, such as charging a card, APIs use an idempotency key: a unique ID the client sends with the request. The server stores the result for that key and returns it again if the same key comes back, instead of charging twice.

Why it matters

Networks drop responses, users double-click and systems retry. Without idempotency, each retry can create a duplicate order, payment or email. Retries are built into webhooks, queues and mobile apps, so this matters everywhere money or messages move.

In a product build

We give every create action that matters an idempotency key, store keys with their results for a set period, and make queue consumers and ETL steps safe to re-run. Database unique constraints back this up, so duplicates fail even if code gets it wrong.

Watch out

Common mistakes.

  1. 01

    Generating a new key on each retry, which defeats the point.

  2. 02

    Checking for duplicates in code without a unique constraint, which fails under load.

  3. 03

    Treating the key as done before the action finishes, so a crash mid-way loses it.

Sources

Read the official text.

Primary sources this definition is based on.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab