Skip to content

Send Email

POST /api/v1/messages

Required permission: send

Sends a single transactional email. The message is queued immediately and delivered asynchronously. You receive a message_id to track delivery status.


Request body

{
"from_email": "hello@yourdomain.com",
"from_name": "Your App",
"to_email": "user@example.com",
"to_name": "John Doe",
"subject": "Your order is confirmed",
"body": "<h1>Order confirmed</h1><p>Thanks for your purchase.</p>",
"reply_to": "support@yourdomain.com",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQK...",
"content_type": "application/pdf"
}
]
}

Fields

FieldTypeRequiredDescription
from_emailstringSender address. Must belong to a verified domain on your account.
from_namestringSender display name shown in email clients.
to_emailstringRecipient email address.
to_namestringRecipient display name.
subjectstringEmail subject line (max 998 characters).
bodystringHTML email body. Dangerous tags (<script>, <iframe>, on* handlers) are automatically stripped.
reply_tostringReply-To address. Recipients’ mail clients direct replies here instead of from_email.
attachmentsarrayFile attachments (see below).

Attachment object

FieldTypeRequiredDescription
filenamestringFilename shown to the recipient (max 255 chars).
contentstringBase64-encoded file content.
content_typestringMIME type, e.g. application/pdf, image/png.

Response

HTTP 202 Accepted

{
"status": "success",
"data": {
"message_id": "550e8400-e29b-41d4-a716-446655440000"
}
}

The message_id is a UUID you can use to:

  • Query message status via GET /api/v1/messages/{id}
  • Correlate webhook events

Code examples

Terminal window
curl -X POST https://api.emitlo.com/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from_email": "hello@yourdomain.com",
"from_name": "Your App",
"to_email": "user@example.com",
"subject": "Your order is confirmed",
"body": "<h1>Order confirmed</h1><p>Thanks for your purchase.</p>"
}'

With attachment

import { readFileSync } from 'fs';
const pdf = readFileSync('./invoice.pdf');
const response = await fetch('https://api.emitlo.com/api/v1/messages', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
from_email: 'billing@yourdomain.com',
to_email: 'customer@example.com',
subject: 'Your invoice #1042',
body: '<p>Please find your invoice attached.</p>',
attachments: [
{
filename: 'invoice-1042.pdf',
content: pdf.toString('base64'),
content_type: 'application/pdf',
},
],
}),
});

Common errors

ErrorCauseFix
UNAUTHENTICATEDInvalid API keyCheck your Authorization header
FORBIDDENCredential missing send permissionCreate a credential with send permission
VALIDATION_ERROR on from_emailDomain not verifiedVerify your domain first
RATE_LIMITEDToo many requestsRespect the Retry-After header
ATTACHMENT_TOO_LARGEFile exceeds plan limitCompress the file or upgrade your plan