QamoosTech
Architecture & DesignReliabilityIntermediate

Idempotency Key

Pronunciationeye-dem-POH-ten-see KEE

Definition

An idempotency key is a unique value the client sends with a request so the server can recognise a retry and return the original result instead of doing the action twice.

Where you hear it

In payment APIs (Stripe, PayPal), order creation endpoints and any API where a timeout could cause a retry.

Examples

  • Send an Idempotency-Key header so a retry doesn't charge the card twice.
  • The server stores the key and the response for 24 hours.
  • The client sends the same idempotency key on retry, so a second payment is not created.

Common mistake

Generating a new key on each retry. The server then sees separate requests and repeats the action.

Don't confuse with

Idempotency in general, which is the property. The key is one technique to achieve it for non-idempotent actions like POST.

Say it at work

  • In a meeting or chatDoes this endpoint support idempotency keys?
  • In an email or ticketReuse the same key when retrying.