IdempotencyKey
IdempotencyKey is a client-supplied value used by APIs to recognize duplicate requests and apply them only once. It helps ensure that repeated operations, such as retries after a timeout or network interruption, do not produce unintended side effects like duplicate charges or multiple resource creations.
How it works: when a client initiates a state-changing operation, it generates a unique idempotency key and
Usage and scope: idempotency keys are commonly used for POST or PUT operations that modify server state,
Design considerations: keys should be generated with sufficient entropy to avoid collisions, yet remain stable for
Limitations: idempotency is effective within a centralization boundary; it may not prevent duplicates across distributed services
Examples: Stripe uses an Idempotency-Key header to achieve these guarantees; many cloud and payment APIs offer