Skip to content

Idempotency key

An idempotency key identifies retries of the same intended request. Scope, retention and API rules determine its effect.

APIs & Integration

An idempotency key is an identifier chosen by the client that lets a service recognise repeats of the same intended request. The aim is to avoid performing an already completed business action again on a retry. The API contract determines its precise effect.

Revisit a request with an uncertain outcome

In a fictional portal, the connection breaks after a request to create an order. Whether the ERP has already created the order is unclear. If the service supports this safeguard, the portal uses the same key for an appropriate retry. A new key could trigger another creation.

Follow the API's rules

Stripe describes different idempotency rules for API v1 and v2. The Idempotency-Key header is a provider-specific example. Check scope, retention and the handling of changed request data. The same key does not authorise arbitrary new content and is not, on its own, evidence of completed processing.

Sources

Articles on this topic

APIs & Integration with ASES

ERP, CRM and shop cleanly connected