What does it mean for an operation to be idempotent?
Idempotent: applying the operation multiple times has the same effect as applying it once, which makes safe retries possible after network uncertainty.
2 / 5
What is the purpose of an idempotency key in an API?
Idempotency key: a client-generated unique identifier sent with a request so the server recognizes retries and returns the original result instead of performing the action twice.
3 / 5
Which HTTP method is naturally idempotent?
PUT: replacing a resource with the same representation repeatedly yields the same state, so PUT is idempotent. POST typically is not, which is why payment APIs add idempotency keys to it.
4 / 5
How long should a server typically store an idempotency key result?
Retention window: servers cache the key plus its response for a limited period long enough to cover realistic retry timeframes, then expire it to bound storage.
5 / 5
What should the server do if the same key arrives with a different request body?
Key reuse mismatch: a key tied to one payload but reused with a different body indicates a client bug; returning a 4xx conflict prevents accidentally applying the wrong operation.