# Idempotency Key

URL: https://eoxlabs.dev/glossary/idempotency-key
Last updated: 2026-11-26
Publisher: EOXLABS (https://eoxlabs.dev)

Section: [Glossary](https://eoxlabs.dev/glossary)

An idempotency key is a unique value a client attaches to a request so the server can recognize retries of that same request and carry out the operation only once. If a payment request times out and the client sends it again with the same key, the server returns the original result instead of charging the customer a second time.

## Why are idempotency keys needed?

Networks fail in the middle of requests, and when a response never arrives, the client cannot tell whether the server did the work. HTTP already distinguishes methods by this property. [RFC 9110, section 9.2.2](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.2), calls a method idempotent "if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request", and lists PUT, DELETE and the safe methods as idempotent. POST and PATCH are not, and those are the methods that create orders, payments and messages.

The IETF's HTTP APIs working group is standardizing a header for this. Its [Idempotency-Key header draft](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/), still an active Internet-Draft and not yet an RFC, says the header "can be used to make non-idempotent HTTP methods such as POST or PATCH fault-tolerant."

## How does EOXLABS implement idempotency keys?

EOXLABS follows the pattern that payment APIs have made familiar, with each step made explicit:

1. The client generates a random key, such as a version 4 UUID, once per logical operation, not once per attempt.
2. The server records the key and a fingerprint of the request before doing the work, then stores the status and response when the work completes.
3. A retry with the same key and the same fingerprint receives the stored response.
4. A retry with the same key and a different payload is rejected as an error.
5. Keys expire after a stated window, and the window is documented for API clients.

On Cloudflare, a Durable Object named after the account or the key gives a single-threaded place to make the check and the write atomic, even when two copies of a request arrive at once. Idempotency keys also make retries and hedged requests safe for writes, which helps control tail latency without risking duplicates. This discipline is part of EOXLABS's [product engineering](https://eoxlabs.dev/capabilities/product-engineering), and Durable Objects have their own [stack page](https://eoxlabs.dev/stack/durable-objects).

## How does a payment API handle it?

Stripe, part of EOXLABS's published stack, documents its behavior on [idempotent requests](https://docs.stripe.com/api/idempotent_requests). For API v1, Stripe saves "the status code and body of the first request made with a given idempotency key", accepts keys "up to 255 characters long", compares incoming parameters with the original request and "errors if they're not the same", and notes that keys can be removed "automatically after they're at least 24 hours old." Work in [financial services](https://eoxlabs.dev/industries/financial-services) depends on exactly this behavior.

## What are idempotency keys confused with?

- **Idempotent methods.** PUT is idempotent by definition and needs no key. The key is how a non-idempotent POST gains the same safety.
- **Payload deduplication.** Rejecting requests whose bodies match would also reject two legitimate identical orders. A key distinguishes a retry from a repeat.
- **A permanent record.** Keys are kept for a window. After it closes, the same key starts a new operation, as Stripe's documentation notes.
- **Eventual consistency.** Storing keys in an eventually consistent store lets two retries in different locations both miss the earlier key. The check needs a strongly consistent store.

More API and data terms are in the [glossary](https://eoxlabs.dev/glossary).

## Related

- [Financial Services](https://eoxlabs.dev/industries/financial-services): Payment flows, ledgers and records systems built for correctness under failure, durable retention and the incident clocks of the FTC, SEC and NYDFS.
- [Product Engineering](https://eoxlabs.dev/capabilities/product-engineering): Prepare A Launch: EOXLABS designs, builds and deploys a new product from zero, with the architecture, code, pipelines and runbooks a production system needs.
- [Durable Objects](https://eoxlabs.dev/stack/durable-objects): Durable Objects give EOXLABS one single-threaded, authoritative home for each piece of shared state, with clear guarantees, hard limits and cases where another store is better.
- [Tail Latency](https://eoxlabs.dev/glossary/tail-latency): Tail latency measures the slowest requests, usually at p99 or above. Systems that fan out to many services feel their tail far more often than averages suggest.

## More glossary

- [Strangler Fig Pattern](https://eoxlabs.dev/glossary/strangler-fig-migration)
- [Connection Pooling](https://eoxlabs.dev/glossary/connection-pooling)
- [Eventual Consistency](https://eoxlabs.dev/glossary/eventual-consistency)
