Questions · Published 2026-11-11 · Updated 2026-11-11 · AgentiSend
missing_required_field (400/422): what it means and the fix
An email API returns missing_required_field when a request leaves out a field the call cannot run without, such as to on a send; add the field the error names and send again.
An email API returns missing_required_field when a request leaves out a field the call cannot run without, such as to on a send; add the field the error names and send again. On AgentiSend a send with no recipient is refused with HTTP 400: the top-level name is missing_required_field, the name Resend's SDK branches on, and error.details names the field by its path. retryable is false, because sending the same body again gets the same answer.
The body you get back
This is POST /emails with an empty body, as the API answers it:
{
"statusCode": 400,
"name": "missing_required_field",
"message": "Error in one or more fields.",
"error": {
"code": "validation_error",
"message": "Error in one or more fields.",
"fix": "Correct the fields listed in the error details and retry the request.",
"docs_url": "https://agentisend.com/docs/errors#validation_error",
"retryable": false,
"details": [{ "path": "body.to", "message": "Required: one address or a list of addresses." }]
}
}Read error.details, not message. Each entry has the path of the field and a sentence for it. Two fields are named in one response when two are wrong.
Why the name and the code differ
error.code is the code in the error catalogue; name is the matching name from Resend's error list, so a switch (error.name) written for Resend keeps working after the base URL changes (Resend compatibility). name is missing_required_field when a detail says the field is required. A body that has every required field but no content, such as no html, text or template_id, comes back with name validation_error and a detail per field, for example "Add a subject, or send a template that has one."
When the code itself is missing_required_field
A few calls refuse with error.code missing_required_field and HTTP 422. The catalogue message is "Body is missing required fields." and the fix is "Include from, to and subject in POST /emails." The message on the wire names what is missing for that call.
The fix, as a request
curl -sS -X POST https://api.agentisend.com/emails \
-H "Authorization: Bearer $AGENTISEND_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"from":"billing@yourdomain.com","to":"delivered@simulator.agentisend.com","subject":"Your receipt","text":"Thanks — the details are attached."}'201
{
"id": "9c8f8f0e-3d1a-4d3f-9a1e-2b7c1a0f5e42",
"simulated": true,
"warnings": []
}from must be on a verified domain, to takes one address or a list, and the body needs html, text or a template_id. POST /emails/preflight checks the same body without sending, so a form or an agent can find the missing field before the real call.
Related
- How do I handle rate limits? for the refusal a client can wait out.
- The error catalogue lists every code with its message and fix.