Resend
raw JSON → 2.23.0 verified Tue May 12 auth: yes python install: verified quickstart: verified
Official Python SDK for the Resend transactional email API. Active, frequently updated. v2.0 (May 2024) added TypedDict-based type hinting. Module-level api_key pattern is the primary auth method. No class instantiation — all methods are called as class methods on resend.Emails, resend.Contacts, etc.
pip install resend Common errors
error ModuleNotFoundError: No module named 'resend' ↓
cause The 'resend' package is not installed in your current Python environment.
fix
pip install resend
error resend.exceptions.ResendError: {'name': 'unauthorized', 'message': 'Unauthorized'} ↓
cause The Resend API key is either missing, incorrect, or not properly set before making an API call.
fix
Set
resend.api_key with a valid API key, preferably from an environment variable: import os; resend.api_key = os.environ.get("RESEND_API_KEY") error AttributeError: module 'resend' has no attribute 'send' ↓
cause The `send` method is not directly available on the top-level `resend` module; it must be called via the `resend.Emails` class.
fix
Call the method on the correct class:
resend.Emails.send(...) error resend.exceptions.ResendError: {'message': 'The `from` field is required.', 'name': 'missing_required_field', 'statusCode': 422} ↓
cause A required field (like `from`, `to`, or `subject`) is missing or empty in the dictionary payload for the email.
fix
Ensure all mandatory fields (
from, to, subject, html or text) are present and correctly populated in the email payload dictionary. Warnings
gotcha No client class to instantiate — resend.api_key is set at the module level, then all API calls are made as class methods (resend.Emails.send(), resend.Contacts.list(), etc.). Code from other SDKs that tries to instantiate a client object fails. ↓
fix import resend; resend.api_key = 'YOUR_KEY'; resend.Emails.send(params)
gotcha The 'to' field must always be a list, even for a single recipient. Passing a string raises a validation error. ↓
fix 'to': ['user@example.com'] # not 'to': 'user@example.com'
gotcha The 'from' field must use a domain verified in the Resend dashboard. Using unverified domains or personal email addresses returns 403. The address 'onboarding@resend.dev' works only in testing with the test API key. ↓
fix Verify your domain at resend.com/domains before sending. Format: 'Name <email@yourdomain.com>'
gotcha Module-level api_key is global state — in multi-tenant or async applications with different API keys, setting resend.api_key is not thread-safe. Concurrent requests may use the wrong key. ↓
fix For multi-key scenarios, serialize key setting + API call, or use separate processes/containers per API key.
gotcha Pip warnings detected in the test output, indicating 'Running pip as root' which can cause permission issues, and an 'outdated pip version'. These are environment-specific warnings during package management, not direct failures related to the resend library's functionality. ↓
fix It is recommended to use a virtual environment for pip operations (e.g., `python -m venv .venv && source .venv/bin/activate`) and to keep pip updated (`pip install --upgrade pip`).
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.65s 22.3M
3.10 slim (glibc) - - 0.46s 23M
3.11 alpine (musl) - - 0.87s 24.5M
3.11 slim (glibc) - - 0.72s 25M
3.12 alpine (musl) - - 0.73s 16.2M
3.12 slim (glibc) - - 0.73s 17M
3.13 alpine (musl) - - 0.72s 15.9M
3.13 slim (glibc) - - 0.71s 16M
3.9 alpine (musl) - - 0.64s 21.6M
3.9 slim (glibc) - - 0.51s 22M
Imports
- resend wrong
from resend import Resend client = Resend(api_key='...')correctimport resend import os resend.api_key = os.environ['RESEND_API_KEY'] params: resend.Emails.SendParams = { 'from': 'Acme <onboarding@resend.dev>', 'to': ['user@example.com'], 'subject': 'Hello', 'html': '<strong>Hello!</strong>' } email = resend.Emails.send(params) print(email['id'])
Quickstart verified last tested: 2026-05-12
import os
import resend
resend.api_key = os.environ['RESEND_API_KEY']
params: resend.Emails.SendParams = {
'from': 'Acme <onboarding@resend.dev>',
'to': ['delivered@resend.dev'],
'subject': 'Hello from Resend',
'html': '<strong>It works!</strong>'
}
email = resend.Emails.send(params)
print(email['id']) # e.g. '49a3999c-0ce1-4ea6-ab68-b08b6e9a5fe2'