Idempotency Key
A client-generated unique value sent with a request so the server can recognise a retry and return the original result instead of acting twice.
The standard mechanism for making a non-idempotent operation safe to retry, and effectively mandatory for any API that moves money or creates resources.
The contract: the client generates the key once per logical operation and reuses it across retries. The server stores the key with the response, atomically with the operation itself — a key stored in a separate transaction can be lost exactly when it is needed. A repeated key returns the stored response; a repeated key with a different payload should be an error, since it means the client has reused a key for a different operation.
Retention is a real decision. The key store must outlive any plausible retry window — hours, not minutes — and it needs a cleanup policy or it grows forever.