# Idempotency keys

> Retry any request safely, without sending the same email twice.

Networks fail. When a request times out you can't know if the email was accepted. An idempotency key makes retrying safe: Sendtern remembers the key and returns the original result instead of sending again.

## How to use it

Send a unique value in the `Idempotency-Key` header. Generate it once per logical email, for example from your own order id, and reuse it on every retry.

```
Idempotency-Key: order-1042-receipt
```

## Rules

| Situation | Result |
| --- | --- |
| Same key, same body, within 24 hours | The original response, no new email |
| Same key, different body | 409 idempotency_conflict |
| Key older than 24 hours | Treated as a new request |

> **tip:** Keys can be up to 256 characters. Prefer meaningful ones like `user-81-password-reset-2026-11-21` over random UUIDs, they make logs easier to read.
