Documentation Index
Fetch the complete documentation index at: https://support.jetemail.com/llms.txt
Use this file to discover all available pages before exploring further.
Idempotency Keys
Network errors, timeouts, and worker restarts can leave your code unsure whether aPOST /email request actually went through. Sending an Idempotency-Key header lets you retry safely: a repeat with the same key and body replays the original response instead of sending a duplicate email.
How it works
- Generate a unique key on your side (e.g. a UUID v4) for each logical send.
- Pass it in the
Idempotency-KeyHTTP header onPOST /email. - If the request is retried with the same key and same body, JetEmail returns the original response and does not send a second email.
- If the same key is reused with a different body, the request is rejected with
409 Conflict.
Header reference
| Header | Required | Notes |
|---|---|---|
Idempotency-Key | No | Opaque string, 1 to 256 characters. |
Example request
Idempotency-Key and body will return the original 201 Created (or 202 Accepted for scheduled sends) without triggering another delivery.
Conflict responses
A409 Conflict indicates one of two situations:
| Error code | Meaning |
|---|---|
IDEMPOTENCY_IN_FLIGHT | A request with this key is still being processed. Retry shortly. |
IDEMPOTENCY_BODY_MISMATCH | This key was already used with a different request body. Use a new key. |
Idempotency-Key.
Best practices
- Generate the key before the first attempt, not on retry, so retries can reuse it.
- Persist the key alongside the work item that triggered the send (e.g. order ID, job row) so the same retry path always reaches for the same key.
- One key per logical send. Do not reuse the same key for unrelated emails.
- Pair with scheduled sends when the call that schedules an email may itself be retried.