Errors and limits
One error shape, stable codes, and the limits of every request.
Errors have one shape. code is stable (build on it); message is a sentence for a person and may be reworded; param names the field at fault. A mistake in the request is a 400; a valid request your account cannot carry out yet is a 422.
Error
{
"error": {
"type": "invalid_request_error",
"code": "domain_not_verified",
"message": "The domain acme.com is not verified yet.",
"param": "from",
"request_id": "req_3f9a1c2b7d4e8a0f6b5c9d1e"
}
}Error codes
| Status | Codes | When |
|---|---|---|
| 400 | invalid_jsonjson_too_deepjson_too_complexunknown_parameterrepeated_parametertoo_many_parametersquery_too_long | The body or query string cannot be read: not JSON, nested too deep or too many values, a field or parameter we do not know, or one given twice. |
| 400 | requiredinvalid_typeinvalid_valueinvalid_formatinvalid_characterstoo_longtoo_few_itemstoo_many_itemsout_of_rangeinvalid_key | A field has the wrong type, is missing or empty, is too long or too short, is not one of the allowed values, or holds a character that cannot be stored (NUL, a broken Unicode surrogate). param names the field. |
| 400 | invalid_frominvalid_subjectmissing_recipienttoo_many_recipientsmissing_bodyinvalid_headerinvalid_taginvalid_scheduleinvalid_attachmentattachments_too_largeattachments_not_supported | The email itself is not valid: see the message, which says what to change. |
| 400 | invalid_cursorinvalid_idempotency_key | A cursor from another list or filter, or an Idempotency-Key that is not 1 to 255 visible ASCII characters. |
| 400 | conflicting_bodyvariables_without_templatetoo_many_templatestoo_many_variablesvariables_too_deepvariables_too_largeinvalid_variable | Templates: both template_id and html / text, variables without a template_id, too many different templates in one batch, or variables over a limit. |
| 401 | invalid_api_key | No key, or a key that is unknown, revoked or of a suspended account (one answer for all of them). |
| 403 | browser_request_refused | The request came from a web page (it had an Origin header). Call the API from your server. |
| 403 | insufficient_scope | The key lacks the permission. Create a key with it under API keys. |
| 403 | sandbox_recipientaccount_inactive | In the sandbox, a recipient who is not on your team; or the account cannot send. |
| 403 | payment_method_required | Campaigns: add a payment method before sending marketing email. |
| 404 | not_found | No such email (or one of another account), or no such endpoint. |
| 405 | method_not_allowed | The path does not take this method. The Allow header lists the ones it does. |
| 409 | not_schedulednot_cancellable | The email has started sending (or was sent, failed or cancelled), so it can no longer be rescheduled or cancelled. |
| 409 | idempotency_key_reusedidempotency_in_progress | The Idempotency-Key was used for a different request, or the first request with it is still running (retry after Retry-After). |
| 409 | campaign_not_draftcampaign_not_cancellable | Campaigns: it was already sent or scheduled (a campaign is sent once), or there is nothing to cancel. |
| 413 | body_too_large | The request body is over the limit of the endpoint. |
| 422 | domain_not_founddomain_not_verified | The request is valid, but the From domain is not one of your sending domains, or is not verified yet. |
| 422 | template_not_foundtemplate_not_transactionaltemplate_unusabletemplate_render_failedmissing_subject | Templates: no template of yours has this id; it is a marketing template (use a transactional one); its HTML cannot be sent (fix it in the app); filled in with these variables it would be too large; or it has no subject and the request gives none. |
| 422 | sender_not_foundaudience_not_foundtopic_not_foundinvalid_htmlunsupported_htmlmailing_address_missingno_recipients | Campaigns: the sender, a list or segment, or the topic is not one of yours; the HTML cannot be sent as it is (the message lists what to change); the account has no postal address; or nobody in the audience can be emailed (the message says why). |
| 429 | rate_limitedsandbox_daily_limit | Too many requests for this key this minute (wait Retry-After), or the sandbox's daily emails are used. |
| 500 / 503 | internal_errorattachments_unavailable | Something failed on our side. Retry with the same Idempotency-Key. |
An email that was accepted but could not be sent has status: "failed" and a plain-language error. This is rare: a message SES rejects for its content, or a send interrupted midway (never retried, so nobody gets it twice). An error's type is one of invalid_request_error, authentication_error, permission_error, rate_limit_error, idempotency_error and api_error.
Limits
- A request body up to 15 MiB (6 MiB for a batch); JSON nested at most 12 levels and at most 60,000 values.
- HTML and text up to 1,048,576 characters each; a subject up to 998 characters, on one line, without control characters. Lengths are counted in UTF-16 code units, as JavaScript's
.lengthdoes: most emoji count as 2. - Up to 15 custom headers; a header's name (up to 76 characters) and value together at most 996 characters. An
X-…value may use any language; List-Unsubscribe, List-Id, In-Reply-To, References and the like must be plain ASCII. - 10 tags; reply_to up to 10 addresses; an
Idempotency-Keyof 1 to 255 visible ASCII characters; a query string up to 2,048 characters. - Recipients are plain addresses (no names), lower-cased, with repeats dropped. The From name may not contain an email address or quotes. An optional field may be left out or given as
null. - Dates are ISO 8601 with an offset; in a query string, write the
+of an offset as%2B(or useZ). - Your account has a rolling 24-hour sending limit that grows as your sending stays healthy; an email over it waits in the queue rather than failing.