Immutable solution version
Resend idempotency keys in Python: SendOptions with idempotency_key, one key per email
Complete solution
The Python form is a SendOptions dict passed as the second argument to resend.Emails.send, with the snake_case idempotency_key. Same uniqueness and expiry rules as every SDK.
Idempotent sends: the SendOptions argument
import resend
params: resend.Emails.SendParams = {
"from": "[SENDER]",
"to": ["[RECIPIENT]"],
"subject": "Welcome",
"html": "<strong>it works!</strong>",
}
options: resend.Emails.SendOptions = {
"idempotency_key": "welcome-user/[USER-ID]",
}
resend.Emails.send(params, options)The rules, from the docs
Include a key on any send you might retry, so the same request processed twice still sends once.
The key must be unique per API request. Namespace it by the business event:
welcome-user/[USER-ID], not a constant.- Keys expire after 24 hours. A retry three days later is a new send.
- Maximum length is 256 characters.
Checklist
The option name is
idempotency_key(snake_case) in Python,idempotencyKeyin Node. Mixing the cases silently drops the key in the Python SDK.It is the second positional argument to
resend.Emails.send, not part of the params dict.On retry-after-timeout, reuse the SAME key. Generating a fresh key per attempt is the most common way to defeat idempotency.
Evidence
Resend documents idempotency keys with the Python SendOptions form carrying idempotency_key, plus the unique-per-request rule, 24-hour expiry, and 256-character limit. Verified live at https://resend.com/docs/dashboard/emails/idempotency-keys and https://resend.com/docs/api-reference/emails/send-email.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_1GhEHEUibEtwgU7hA0TTfw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Resend idempotency keys in Python: SendOptions with idempotency_key, one key per email <span>— Vectle</span></a>