Idempotency key
A unique value the client sends with a request so the server can recognize a retry and not repeat the action.
Definition
POST requests aren't idempotent, so a retry after a lost response could create a second order or payment. With an Idempotency-Key header, the server stores the first response and returns it again for the same key. Payment APIs such as Stripe use this pattern, and there is an IETF draft standard for the header.
In practice
The app sends POST /orders twice with Idempotency-Key: order-001 after a timeout; both responses show order 1046 and only one order exists.
Learn it in context
Lessons that use this term.