Every error has the same shape:
{ "error": { "type": "validation_error", "message": "to is not a valid email address: sam@", "field": "to" } }
Show message to your developers as it is: it says what to change. field says which input.
Common errors and fixes
field |
Message | Fix |
|---|---|---|
from, to, subject |
“Add from.” (type missing_required_field) |
These three are required. |
from, to, cc, bcc, reply_to |
”… is not a valid email address: …” | Use name@domain.com or Name <name@domain.com>. Check for spaces and missing parts. |
to |
”… must be an email address or a list of them.” | Send a string or an array of strings, not objects. |
to |
“Send to at most 50 recipients per email, across to, cc and bcc.” | Split into several emails, or use a batch. |
html |
“Add html, text, or both.” | Include at least one body. |
scheduled_at |
“scheduled_at is an ISO 8601 date or text like “in 1 hour”.” | Use 2026-11-20T09:00:00Z or in 2 hours. |
scheduled_at |
“scheduled_at can be at most 30 days ahead.” | Pick a nearer time. |
template |
“Send template or html/text, not both.” | Use one or the other. |
template.variables.NAME |
“Template … needs the variable NAME.” | Give every variable that has no fallback. |
template.id |
“No template with this id on your team.” | Check the id with GET /v1/templates. |
Attachment errors (invalid_attachment)
| Message | Fix |
|---|---|
| “attachments must be a list.” | Send an array of objects. |
| “Each attachment needs a filename without slashes, up to 255 characters.” | Use a plain file name like invoice.pdf. |
| “Add the file for … as base64 in content.” | Put the file’s bytes, base64-encoded, in content. |
| “Send the file as base64 in content. Fetching files by URL is not supported yet.” | You sent path. Download the file yourself and base64 it. |
| “The content of … is not valid base64.” | Encode with standard base64, no data URL prefix. |
| “Attachments add up to more than 40 MB (as base64).” | Link to large files instead. |
import { readFileSync } from 'node:fs';
const attachments = [{ filename: 'invoice.pdf', content: readFileSync('invoice.pdf').toString('base64') }];
Batch errors
POST /v1/emails/batch takes a JSON array of 1 to 100 emails.
| Message | Fix |
|---|---|
| “Send a JSON array of 1 to 100 emails.” | The body must be an array, not an object. |
| “Send at most 100 emails per batch.” | Split into more calls. |
| “Batch sends cannot be scheduled.” | Send scheduled emails one at a time. |
| “Batch sends cannot carry attachments.” | Send emails with attachments one at a time. |
“Email 3: …” with field 3.to |
The fourth email in the array has the problem. |
Other 422s you may meet
- Lists: “limit is a whole number from 1 to 100.”, “Use after or before, not both.”, “That cursor is not an item in this list.”
- Webhooks: “Use an https:// URL.”, “Pick at least one event.”, “Unknown events: …”.
- Suppressions: “Add up to 1000 addresses at a time.”
- API keys: “Name the key in 1 to 50 characters.”, “Only sending keys can be limited to one domain.”
Retrying safely
A 422 sends nothing, so fix the body and send again. If you use an Idempotency-Key, a failed request does not use up the key, so you can send the corrected body with the same key. Only a successful request is remembered: after that, the same key with a different body within 24 hours answers 409 invalid_idempotent_request.
Compatible endpoints
- SendGrid (
POST /v3/mail/send): validation errors come back as400with{"errors": [{"message", "field"}]}. Atemplate_idis refused: send rendered HTML. - Postmark (
POST /email): errors come back in Postmark’s shape withErrorCode: 300and the message. Templates are refused.
If it does not work
- The message names a field you did send. Check the JSON is valid and sent with
Content-Type: application/json. - Only some emails fail. Log
field; it points to the exact input.
Full field rules are in the API reference.