REST API
Error Handling
HTTP status codes and error response format for the Emailens API.
Error response format
All errors return a JSON object with an error field:
{
"error": "Description of what went wrong."
}Some errors include additional fields for context.
Status codes
| Code | Meaning | When |
|---|---|---|
200 | Success | Request processed successfully |
400 | Bad Request | Missing or invalid html field, invalid clients array, empty content |
413 | Payload Too Large | Request body exceeds 1MB |
422 | Unprocessable Entity | JSX or MJML compilation failed |
429 | Too Many Requests | Rate limit or daily quota exceeded |
500 | Internal Server Error | Unexpected server error |
Specific errors
Invalid input (400)
{ "error": "Missing or invalid 'html' field. Provide the email HTML, JSX, or MJML as a string." }{ "error": "Content must not be empty." }{ "error": "Content exceeds 500KB limit." }{ "error": "'clients' must be an array of client ID strings." }Compilation failure (422)
When format is "jsx" or "mjml" and compilation fails:
{
"error": "Failed to compile React Email component.",
"phase": "transform"
}The phase field indicates where compilation failed (transform or render).
Rate limit (429)
See Rate Limiting for details.
Content too large (413)
The API enforces a 1MB hard limit on request body size and a 500KB limit on the html field content.