POST
/api/v1/emails
Send Email
Send a transactional email to one or more recipients.
Request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| from | string | required | Sender email address. Must be from a verified domain. |
| to | string | required | Recipient email address. |
| subject | string | required | Email subject line. |
| body | string | optional | Plain text email body. |
| text_body | string | optional | Plain text body (alias for body). |
| html_body | string | optional | HTML email body. |
| attachments | array | optional | Array of attachment objects. |
Attachment Object
| Field | Type | Description |
|---|---|---|
| filename | string | Name of the attachment file. |
| io | string | Base64-encoded file content. |
| content_type | string | MIME type (e.g., application/pdf). |
Examples
Simple email
cURL
curl -X POST https://eml.dev/api/v1/emails \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "hello@yourdomain.com", "to": "user@example.com", "subject": "Welcome!", "body": "Thanks for signing up." }'
HTML email
cURL
curl -X POST https://eml.dev/api/v1/emails \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "hello@yourdomain.com", "to": "user@example.com", "subject": "Order Confirmed", "text_body": "Your order #1234 has been confirmed.", "html_body": "<h1>Order Confirmed</h1><p>Your order #1234 has been confirmed.</p>" }'
Email with attachment
cURL
curl -X POST https://eml.dev/api/v1/emails \ -H "Authorization: Token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "hello@yourdomain.com", "to": "user@example.com", "subject": "Your Invoice", "text_body": "Please find your invoice attached.", "attachments": [{ "filename": "invoice.pdf", "io": "JVBERi0xLjQKJeLjz9...", "content_type": "application/pdf" }] }'
Note: Attachment content must be Base64-encoded. In most languages, you can use built-in functions like base64.b64encode() (Python) or Buffer.from().toString('base64') (Node.js).
Response
Success (200)
JSON
{
"id": "msg_abc123...",
"status": "queued"
}
Error (422)
JSON
{
"error": "Validation failed",
"messages": ["to is required", "subject is required"]
}