API Reference
Complete reference for all SendMailOS API endpoints.
Base URL
Endpoints
/sendSend Email
Send transactional or marketing emails with templates and personalization.
/campaigns/sendSend Campaign
Queue bulk email campaigns to subscribers based on tags.
/subscribersCreate Subscriber
Add or update a subscriber in your email list.
/subscribersList Subscribers
Retrieve all subscribers with pagination.
/domainsAdd Domain
Register a new sending domain with AWS SES verification.
/domainsList Domains
Get all verified sending domains for your organization.
/workflowsList Workflows
Get all automation workflows for your organization.
/workflowsCreate Workflow
Create a new email automation workflow.
/workflows/:id/activateActivate Workflow
Activate a workflow to start processing triggers.
/workflows/:id/pausePause Workflow
Pause a workflow to stop processing new triggers.
/webhooksList Webhooks
Get all registered webhook endpoints.
/webhooksCreate Webhook
Register a new webhook endpoint for event notifications.
/webhooks/:idTest Webhook
Send a test payload to verify webhook configuration.
/pixelsList Pixels
Get all tracking pixels for email open and click tracking.
/ghost/inboxesCreate Test Inbox
Create a temporary inbox for testing email delivery.
/api/v1/sendSend Email
Send transactional or marketing emails. Supports raw HTML content or saved templates with Handlebars variable interpolation.
Rate Limits
Transactional: 5/sec (300/min) soft limit, auto-demotes to marketing if exceeded.
Marketing: 500/sec (30,000/min) hard limit.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string | Required | Recipient email address |
| subject | string | Required | Email subject line |
| html | string | Optional* | HTML content (required if no templateId) |
| templateId | uuid | Optional* | Template ID (required if no html) |
| from_name | string | Optional | Sender display name (default: "System") |
| from_email | string | Optional | Sender email (must be from verified domain) |
| variables | object | Optional | Handlebars template variables |
| type | string | Optional | "transactional" or "marketing" (default: transactional) |
| attachments | array | Optional | File attachments (max 5 files, 7MB total) |
| external_id | string | Optional | Your system's ID for correlation |
| metadata | object | Optional | Custom key-value data to store with email |
Attachments
Attach files using Base64 content or a URL (fetched at send time).
| Field | Type | Required | Description |
|---|---|---|---|
| filename | string | Required | Filename shown to recipient |
| content | string | Optional* | Base64-encoded file content (required if no url) |
| url | string | Optional* | URL to fetch file from (required if no content) |
| contentType | string | Required | MIME type (e.g., "application/pdf") |
| cid | string | Optional | Content-ID for inline images (use cid:value in HTML) |
Attachment Limits
Max 5 attachments per email • Max 5MB per file • Max 7MB total
Example Request
curl -X POST https://sendmailos.com/api/v1/send \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"to": "[email protected]",
"from_email": "[email protected]",
"from_name": "Your Company",
"subject": "Your order has shipped!",
"html": "<h1>Order Shipped</h1><p>Your order #{{order_id}} is on the way.</p>",
"variables": {
"order_id": "12345",
"tracking_url": "https://track.example.com/12345"
}
}'Response
{
"success": true,
"message": "Email queued (policy: transactional 5/sec)",
"id": "550e8400-e29b-41d4-a716-446655440000"
}/api/v1/campaigns/sendSend Campaign
Queue a bulk email campaign to subscribers. Filter by tags or send to all subscribers.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| subject | string | Required | Email subject line |
| from_name | string | Required | Sender display name |
| from_email | string | Required | Sender email (must be from verified domain) |
| html | string | Optional* | HTML content (required if no templateId) |
| templateId | uuid | Optional* | Template ID to use |
| name | string | Optional | Campaign name (auto-generated if omitted) |
| tags | string[] | Optional | Filter subscribers by tags |
| variables | object | Optional | Template variables |
| external_id | string | Optional | Your system's ID for tracking |
| metadata | object | Optional | Custom key-value data to store with campaign |
Example Request
curl -X POST https://sendmailos.com/api/v1/campaigns/send \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "January Newsletter",
"subject": "What'\''s new this month",
"from_name": "Your Company",
"from_email": "[email protected]",
"html": "<h1>January Updates</h1><p>Check out our latest features...</p>",
"tags": ["newsletter", "active"]
}'Response (202 Accepted)
{
"success": true,
"message": "Campaign queued with 1,234 subscribers",
"campaignId": "550e8400-e29b-41d4-a716-446655440000"
}/api/v1/subscribersCreate Subscriber
Add or update a subscriber. Uses upsert logic to handle existing emails gracefully.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Required | Subscriber email address | |
| first_name | string | Optional | First name |
| last_name | string | Optional | Last name |
| tags | string[] | Optional | Custom tags for segmentation |
| domain_id | uuid | Optional | Primary domain association |
| external_id | string | Optional | Your system's user/contact ID |
| metadata | object | Optional | Custom key-value data (e.g., source, plan) |
Example Request
curl -X POST https://sendmailos.com/api/v1/subscribers \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"tags": ["newsletter", "premium"]
}'Response (201 Created)
{
"success": true,
"subscriber": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "[email protected]",
"status": "subscribed",
"created_at": "2024-01-15T10:30:00Z",
"source": "api"
}
}/api/v1/subscribersList Subscribers
Retrieve all subscribers with pagination support.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | number | 20 | Results per page |
| offset | number | 0 | Pagination offset |
| external_id | string | - | Filter by your system's ID |
Example Request
curl -X GET "https://sendmailos.com/api/v1/subscribers?limit=50&offset=0" \
-H "Authorization: Bearer sk_live_..."Response
{
"success": true,
"subscribers": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"status": "subscribed",
"tags": ["newsletter", "premium"],
"source": "api",
"created_at": "2024-01-15T10:30:00Z",
"primary_domain": {
"id": "...",
"domain_name": "yourcompany.com"
}
}
],
"total": 1234,
"limit": 50,
"offset": 0
}/api/v1/domainsAdd Domain
Register a new sending domain. Returns DNS records for DKIM verification.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| domain | string | Required | Domain name to register |
| external_id | string | Optional | Your system's domain/client ID |
| metadata | object | Optional | Custom key-value data (e.g., client_name) |
Example Request
curl -X POST https://sendmailos.com/api/v1/domains \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"domain": "yourcompany.com",
"external_id": "client_123",
"metadata": { "client_name": "Acme Corp" }
}'Response (201 Created)
{
"success": true,
"domain": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"domain_name": "yourcompany.com",
"status": "pending",
"dkim_tokens": ["abc123...", "def456...", "ghi789..."],
"created_at": "2024-01-15T10:30:00Z",
"dns_records": [
{
"type": "CNAME",
"name": "abc123._domainkey.yourcompany.com",
"value": "abc123.dkim.amazonses.com"
},
{
"type": "CNAME",
"name": "def456._domainkey.yourcompany.com",
"value": "def456.dkim.amazonses.com"
},
{
"type": "CNAME",
"name": "ghi789._domainkey.yourcompany.com",
"value": "ghi789.dkim.amazonses.com"
}
]
}
}Error Responses
The API uses standard HTTP status codes to indicate success or failure.
| Status | Description |
|---|---|
200 | Success |
201 | Created - Resource created successfully |
202 | Accepted - Request queued for processing |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Domain not verified or restricted |
409 | Conflict - Resource already exists |
429 | Rate Limited - Too many requests |
500 | Server Error - Try again later |
{
"success": false,
"error": "Invalid email format",
"code": "VALIDATION_ERROR"
}