Send Email
Send a single email to one or multiple recipients. Supports templates, variables, attachments, scheduling, and tracking.
/emailsHeaders
AuthorizationstringRequiredBearer token for authentication.
Idempotency-KeystringUnique key (max 256 chars, alphanumeric/dash/underscore) to prevent duplicate sends for 24 hours.
Request Body
fromstringRequiredSender email in RFC format: email@domain.com or Display Name <email@domain.com>.
tostring | string[]RequiredRecipient email address(es). Maximum 50 recipients.
subjectstringEmail subject line. Required unless template provides it.
htmlstringHTML content of the email. Required unless template provides it or text is provided.
textstringPlain text content of the email.
reply_tostring | string[]Reply-to email address(es).
ccstring | string[]CC recipients. Maximum 50 recipients.
bccstring | string[]BCC recipients. Maximum 50 recipients.
templatestringTemplate alias or ID (tem_xxx format).
variablesobjectVariables for template substitution using {{'{'}variable{'}'}} syntax.
attachmentsarrayArray of attachment objects (see Attachment Object below).
headersobjectCustom email headers as key-value pairs.
metaobjectMetadata as key-value string pairs. Stored and returned with the email.
scheduled_atstringSchedule send time. Accepts ISO 8601, Unix timestamp, or natural language like tomorrow at 9am.
trackingboolean | objectOverride domain tracking defaults. Can be a boolean or object with loads and clicks properties.
Attachment Object
filenamestringRequiredFile name with extension.
contentstringBase64 encoded content. Mutually exclusive with url.
urlstringURL to fetch attachment from. Mutually exclusive with content.
content_typestringMIME type. Required when using content.
content_idstringContent-ID for inline images (cid:).
encodingstringContent encoding (default: base64).
Allowed Attachment File Types
| Category | Extensions |
|---|---|
| Text | .txt, .csv, .log, .css, .ics, .xml |
| Images | .jpg, .jpe, .jpeg, .gif, .png, .bmp, .psd, .tif, .tiff, .svg, .indd, .ai, .eps |
| Documents | .doc, .docx, .rtf, .odt, .ott, .pdf, .pub, .pages, .mobi, .epub |
| Audio | .mp3, .m4a, .m4v, .wma, .ogg, .flac, .wav, .aif, .aifc, .aiff |
| Video | .mp4, .mov, .avi, .mkv, .mpeg, .mpg, .wmv |
| Spreadsheets | .xls, .xlsx, .ods, .numbers |
| Presentations | .odp, .ppt, .pptx, .pps, .key |
| Archives | .zip, .vcf |
.eml | |
| Cryptographic | .p7c, .p7m, .p7s, .pgp, .asc, .sig |
Rate Limit Headers
The following headers are included in every response:
| Header | Description |
|---|---|
| ratelimit-limit | Maximum requests per second |
| ratelimit-remaining | Remaining requests in current second |
| ratelimit-reset | Seconds until rate limit resets |
| ratelimit-daily-limit | Maximum daily requests |
| ratelimit-daily-remaining | Remaining daily requests |
| ratelimit-daily-reset | Seconds until daily limit resets |
const response = await fetch('https://api.emailit.com/v2/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'hello@yourdomain.com',
to: 'user@example.com',
template: 'welcome_email',
variables: {
name: 'John Doe',
company: 'Acme Inc',
activation_url: 'https://example.com/activate?token=abc123'
}
})
});
const result = await response.json(); curl -X POST https://api.emailit.com/v2/emails \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@yourdomain.com",
"to": "user@example.com",
"template": "welcome_email",
"variables": {
"name": "John Doe",
"company": "Acme Inc",
"activation_url": "https://example.com/activate?token=abc123"
}
}' const response = await fetch('https://api.emailit.com/v2/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'invoices@yourdomain.com',
to: 'customer@example.com',
subject: 'Your Invoice #12345',
html: '<p>Please find your invoice attached.</p>',
attachments: [
{
filename: 'invoice-12345.pdf',
content: 'JVBERi0xLjQKJcOkw7zDqc...', // base64 encoded
content_type: 'application/pdf'
}
]
})
});
const result = await response.json(); curl -X POST https://api.emailit.com/v2/emails \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"from": "invoices@yourdomain.com",
"to": "customer@example.com",
"subject": "Your Invoice #12345",
"html": "<p>Please find your invoice attached.</p>",
"attachments": [
{
"filename": "invoice-12345.pdf",
"content": "JVBERi0xLjQKJcOkw7zDqc...",
"content_type": "application/pdf"
}
]
}' const response = await fetch('https://api.emailit.com/v2/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'reminders@yourdomain.com',
to: 'user@example.com',
subject: 'Appointment Reminder',
html: '<p>Your appointment is tomorrow at 2 PM.</p>',
scheduled_at: 'tomorrow at 9am'
})
});
const result = await response.json(); curl -X POST https://api.emailit.com/v2/emails \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"from": "reminders@yourdomain.com",
"to": "user@example.com",
"subject": "Appointment Reminder",
"html": "<p>Your appointment is tomorrow at 2 PM.</p>",
"scheduled_at": "2026-01-10T09:00:00Z"
}' {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"ids": {
"recipient1@example.com": "em_abc123xyz789def456ghi012jkl345",
"recipient2@example.com": "em_def456abc789ghi012jkl345mno678"
},
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "hello@yourdomain.com",
"to": ["recipient1@example.com", "recipient2@example.com"],
"cc": ["cc@example.com"],
"bcc": ["bcc@example.com"],
"subject": "Hello World",
"status": "pending",
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
}
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"subject": "Appointment Reminder",
"status": "scheduled",
"scheduled_at": "2026-01-10T09:00:00.000Z",
"created_at": "2026-01-08T12:00:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
}
} {
"error": "Validation failed",
"validation_errors": [
"Missing required field: from",
"Invalid to email address at index 0: invalid-email"
]
} {
"error": "Template not found",
"details": "Template 'welcome_email' not found or not published"
} {
"error": "Message too large",
"details": "Message size (45MB) exceeds maximum allowed size of 40MB"
} {
"error": "From/Sender domain is not valid or not verified",
"details": "The domain from email address 'sender@unverified.com' is not verified in your workspace"
} {
"error": "Rate limit exceeded",
"message": "Too many requests. Maximum 10 messages per second allowed.",
"limit": 10,
"current": 11,
"retry_after": 1
} List Emails
List emails in your workspace with pagination and optional filtering by type.
/emailsQuery Parameters
pageintegerPage number. Minimum: 1. Default: 1.
limitintegerNumber of results per page. Range: 1–100. Default: 10.
typestringFilter by email type: inbound or outbound.
{
"data": [
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:01:00.123456Z",
"meta": null
},
{
"object": "email",
"id": "em_def456ghi789jkl012mno345pqr678",
"type": "inbound",
"from": "external@otherdomain.com",
"to": "inbox@yourdomain.com",
"subject": "Re: Your inquiry",
"status": "delivered",
"size": 2891,
"scheduled_at": null,
"created_at": "2026-01-08T11:30:00.123456Z",
"updated_at": "2026-01-08T11:30:00.123456Z",
"meta": null
}
],
"next_page_url": "/v2/emails?page=2&limit=10",
"previous_page_url": null
} Get Email
Retrieve a single email by its ID, including headers, parsed body content, and attachments.
/emails/{id}Path Parameters
idstringRequiredThe email ID in em_xxx format.
Response Fields
| Field | Type | Description |
|---|---|---|
object | string | Always "email" |
id | string | Email ID in em_xxx format |
type | string | "inbound" or "outbound" |
token | string | Email token |
message_id | string | SMTP Message-ID |
from | string | Sender email address |
to | string | Recipient email address |
subject | string | Email subject line |
status | string | Current email status |
size | integer | Email size in bytes |
scheduled_at | string | null | Scheduled delivery time (ISO 8601) |
created_at | string | Creation timestamp (ISO 8601) |
updated_at | string | Last update timestamp (ISO 8601) |
tracking | object | null | Tracking settings (omitted for inbound emails) |
meta | object | null | Custom metadata |
headers | object | Parsed email headers |
body | object | Parsed body with text and html fields |
attachments | array | Parsed attachments with base64-encoded content |
Body Object
| Field | Type | Description |
|---|---|---|
text | string | null | Plain text content |
html | string | null | HTML content |
Attachment Object
| Field | Type | Description |
|---|---|---|
filename | string | Attachment filename |
content_type | string | MIME type |
size | integer | Attachment size in bytes |
content_id | string | null | Content-ID for inline attachments |
content_disposition | string | "attachment" or "inline" |
content | string | Base64-encoded attachment content |
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 12345,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
},
"meta": {
"campaign": "summer",
"type": "marketing"
},
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"body": {
"text": "Welcome!",
"html": "<html><body><h1>Welcome!</h1></body></html>"
},
"attachments": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment",
"content": "JVBERi0xLjQKJcOkw7zDqc..."
}
]
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "inbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@externaldomain.com>",
"from": "external@externaldomain.com",
"to": "inbox@yourdomain.com",
"subject": "Re: Your inquiry",
"status": "delivered",
"size": 8234,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"meta": null,
"headers": {
"From": "external@externaldomain.com",
"To": "inbox@yourdomain.com",
"Subject": "Re: Your inquiry",
"Content-Type": "text/plain; charset=utf-8"
},
"body": {
"text": "Thanks for reaching out...",
"html": null
},
"attachments": []
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Appointment Reminder",
"status": "scheduled",
"size": 8234,
"scheduled_at": "2026-01-10T15:00:00.000000Z",
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"tracking": {
"loads": true,
"clicks": true
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Appointment Reminder",
"Content-Type": "text/html; charset=utf-8"
},
"body": {
"text": "Appointment Reminder...",
"html": "<html>..."
},
"attachments": []
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} Get Email Raw
Returns the full raw MIME message string along with email metadata.
/emails/{id}/rawPath Parameters
idstringRequiredThe email ID in em_xxx format.
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "text/html; charset=utf-8"
},
"raw": "From: sender@yourdomain.com\r\nTo: recipient@example.com\r\nSubject: Hello World\r\nContent-Type: text/html; charset=utf-8\r\n\r\n<html><body><h1>Welcome!</h1></body></html>"
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} Get Email Attachments
Returns only the attachment list for an email, with base64-encoded content.
/emails/{id}/attachmentsPath Parameters
idstringRequiredThe email ID in em_xxx format.
Response Fields
| Field | Type | Description |
|---|---|---|
object | string | Always "list" |
data | array | Array of attachment objects |
Attachment Object
| Field | Type | Description |
|---|---|---|
filename | string | Attachment filename |
content_type | string | MIME type |
size | integer | Attachment size in bytes |
content_id | string | null | Content-ID for inline attachments |
content_disposition | string | "attachment" or "inline" |
content | string | Base64-encoded attachment content |
{
"object": "list",
"data": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment",
"content": "JVBERi0xLjQKJcOkw7zDqc..."
},
{
"filename": "logo.png",
"content_type": "image/png",
"size": 5678,
"content_id": "logo@yourdomain.com",
"content_disposition": "inline",
"content": "iVBORw0KGgoAAAANSUhEUg..."
}
]
} {
"object": "list",
"data": []
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} Get Email Body
Returns only the parsed body content (text and HTML) for an email.
/emails/{id}/bodyPath Parameters
idstringRequiredThe email ID in em_xxx format.
{
"text": "Plain text content of the email",
"html": "<html><body><h1>Welcome!</h1><p>HTML content of the email</p></body></html>"
} {
"text": "Plain text content of the email",
"html": null
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} Get Email Meta
Returns email metadata with attachment information, but without attachment content. Useful for inspecting an email without downloading potentially large attachment data.
/emails/{id}/metaPath Parameters
idstringRequiredThe email ID in em_xxx format.
Response Fields
The response includes all email metadata fields plus an attachments array with attachment info (without the content field).
Attachment Object (Meta)
| Field | Type | Description |
|---|---|---|
filename | string | Attachment filename |
content_type | string | MIME type |
size | integer | Attachment size in bytes |
content_id | string | null | Content-ID for inline attachments |
content_disposition | string | "attachment" or "inline" |
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"attachments": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment"
}
]
} {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "text/html; charset=utf-8"
},
"attachments": []
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} Update Scheduled Email
Update a scheduled email’s send time. Only works for emails with status “scheduled” and only if the current scheduled time is at least 3 minutes in the future.
/emails/{id}Path Parameters
idstringRequiredThe email ID in em_xxx format.
Request Body
scheduled_atstringRequiredNew scheduled time. Accepts ISO 8601 format, Unix timestamp, or natural language like tomorrow at 9am. Must be at least 3 minutes in the future.
curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456 \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"scheduled_at": "tomorrow at 3pm"
}' {
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"status": "scheduled",
"scheduled_at": "2026-01-10T15:00:00.000Z",
"updated_at": "2026-01-08T12:00:00.123456Z",
"message": "Email schedule has been updated successfully"
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} {
"error": "Cannot update email",
"message": "Scheduled emails can only be updated at least 3 minutes before the scheduled time. This email is scheduled to send in 2 minute(s)."
} {
"error": "Invalid scheduled_at",
"message": "The new scheduled time must be at least 3 minutes in the future."
} Cancel Email
Cancel a scheduled or pending email. For scheduled emails, cancellation is only allowed if the scheduled time is at least 3 minutes in the future.
/emails/{id}/cancelPath Parameters
idstringRequiredThe email ID in em_xxx format.
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"status": "canceled",
"message": "Email has been canceled successfully"
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} {
"error": "Cannot cancel email",
"message": "Email cannot be canceled. Current status: 'sent'. Only 'scheduled' or 'pending' emails can be canceled."
} {
"error": "Cannot cancel email",
"message": "Scheduled emails can only be canceled at least 3 minutes before the scheduled time. This email is scheduled to send in 2 minute(s)."
} Cancelable Email Statuses
| Status | Can Cancel? | Notes |
|---|---|---|
| pending | ✅ Yes | Email is queued but not yet processed |
| scheduled | ✅ Yes | Only if scheduled time is 3+ minutes away |
| sent | ❌ No | Email already sent to mail server |
| delivered | ❌ No | Email already delivered to recipient |
| bounced | ❌ No | Email already processed |
| canceled | ❌ No | Email already canceled |
Retry Email
Retry an email that hard failed, errored, or was held. This creates a duplicate of the original email and sends it again. The new email gets its own ID.
/emails/{id}/retryPath Parameters
idstringRequiredThe email ID in em_xxx format.
{
"object": "email",
"id": "em_new789xyz456abc123",
"original_id": "em_abc123xyz789def456",
"status": "pending",
"message": "Email has been queued for retry"
} {
"error": "Email not found",
"message": "Email with ID 'em_abc123' not found in your workspace"
} {
"error": "Cannot retry email",
"message": "Email cannot be retried. Current status: 'delivered'. Only 'failed', 'errored', or 'held' emails can be retried."
} Retryable Email Statuses
| Status | Can Retry? | Notes |
|---|---|---|
| failed | ✅ Yes | Email hard bounced |
| errored | ✅ Yes | Email errored during processing |
| held | ✅ Yes | Email was held for review |
| pending | ❌ No | Email is already queued |
| sent | ❌ No | Email already sent |
| delivered | ❌ No | Email already delivered |
Important Notes
- Billing: Retried emails are billed as new emails based on standard pricing
- New ID: The retried email gets a new ID, the original email remains unchanged
- Original reference: The response includes
original_idto link back to the original email