Send Email
Send transactional emails using our REST API.
Endpoint
POST https://getmailer.co/api/emailsRequest Body
{
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Your subject line",
"html": "<h1>Hello!</h1>",
"text": "Hello! (plain text fallback)",
"cc": ["cc@example.com"],
"bcc": ["bcc@example.com"],
"replyTo": "reply@yourdomain.com",
"tags": ["welcome", "onboarding"],
"headers": {
"X-Custom-Header": "value"
}
}Parameters
| Field | Type | Description |
|---|---|---|
from | string | Sender email address (required) |
to | string | string[] | Recipient(s) (required) |
subject | string | Email subject (required) |
html | string | HTML content (html or text required) |
text | string | Plain text content |
cc | string | string[] | CC recipients |
bcc | string | string[] | BCC recipients |
replyTo | string | Reply-to address |
tags | string[] | Tags for filtering (max 10) |
headers | object | Custom email headers |
templateId | string | Template ID to use |
variables | object | Template variables |
scheduledAt | string | ISO 8601 datetime to send (max 7 days) |
Response
{
"id": "clx1abc123def456",
"from": "sender@yourdomain.com",
"to": ["recipient@example.com"],
"subject": "Your subject line",
"status": "sent",
"tags": ["welcome", "onboarding"]
}cURL Example
curl -X POST https://getmailer.co/api/emails \
-H "Authorization: Bearer gm_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello from GetMailer",
"html": "<h1>It works!</h1><p>Your email was sent successfully.</p>"
}'Using Templates
Instead of providing html/text, use a template:
{
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"templateId": "your-template-id",
"variables": {
"name": "John",
"orderNumber": "12345"
}
}See Templates for more information.