Idempotency
Definition
An operation is idempotent if applying it more than once leaves the system in the same state as applying it once.
In practice
Retries and at-least-once delivery make duplicates unavoidable, so any operation with side effects needs to be safe to repeat. Some operations are naturally idempotent (setting a value, deleting by id); others such as "add 10 to the balance" are not.
Non-idempotent operations are made safe with an idempotency key: the client sends a unique key, the server records the key with the result, and repeats return the stored result instead of acting again. The key and the side effect must be stored atomically.
Example
A payment API receives Idempotency-Key: 7f3c… twice after a client timeout and returns the original 201 response the second time without charging again.