Quickstart
Send your first email in under five minutes.
1. Create an account
Sign up for a free ApiMailer account. No credit card required.
2. Add and verify your domain
Add your sending domain in the dashboard and configure the DNS records we provide (SPF and DKIM). Verification is usually instant once the records propagate.
3. Generate an API key
Navigate to Settings → API Keys and create a new key. Copy it somewhere safe — it won't be shown again.
4. Send your first email
curl -X POST https://api.apimailer.com/v1/send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "hello@yourdomain.com", "to": "user@example.com", "subject": "Hello from ApiMailer!", "html": "<h1>It works!</h1><p>Your first email via ApiMailer.</p>" }'
Authentication
All API requests require a valid API key sent in the Authorization header using Bearer token format:
Authorization: Bearer YOUR_API_KEY
API keys can be created and managed from the dashboard. Each key can be scoped with specific permissions:
| Permission | Description |
|---|---|
| send | Send emails via API and SMTP |
| read | Access analytics, events, and logs |
| domains | Add, verify, and manage sending domains |
| templates | Create and manage email templates |
| webhooks | Manage webhook endpoints |
| admin | Full account access including billing |
Base URL
All API requests should be made to:
https://api.apimailer.com/v1
All requests must use HTTPS. HTTP requests will be rejected.
Errors
ApiMailer uses standard HTTP status codes. Errors return a JSON body with a code and message field:
{
"error": {
"code": "validation_error",
"message": "The 'to' field is required.",
"field": "to"
}
}
| Status | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request — check your parameters |
| 401 | Unauthorized — invalid or missing API key |
| 403 | Forbidden — insufficient permissions |
| 404 | Not found |
| 422 | Validation error |
| 429 | Rate limit exceeded |
| 500 | Server error — try again or contact support |
Send Email
Send a single email message.
Parameters
| Field | Type | Description |
|---|---|---|
| from required | string | Sender email address (must be on a verified domain) |
| to required | string | string[] | Recipient email address(es) |
| subject required | string | Email subject line |
| html | string | HTML body content |
| text | string | Plain text body (auto-generated from HTML if omitted) |
| cc | string | string[] | CC recipients |
| bcc | string | string[] | BCC recipients |
| reply_to | string | Reply-to address |
| headers | object | Custom email headers |
| tags | string[] | Tags for analytics and filtering |
| template_id | string | Use a stored template instead of html/text |
| variables | object | Dynamic variables for template rendering |
Response
{
"id": "msg_8f3k2j5n9x",
"status": "queued",
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"created_at": "2026-02-13T10:30:00Z"
}
Batch Send
Send up to 1,000 individual emails in a single API call. Each message can have unique recipients, subjects, and content.
{
"messages": [
{
"from": "hello@yourdomain.com",
"to": "user1@example.com",
"subject": "Welcome!",
"template_id": "tmpl_welcome",
"variables": { "name": "Alice" }
},
{
"from": "hello@yourdomain.com",
"to": "user2@example.com",
"subject": "Welcome!",
"template_id": "tmpl_welcome",
"variables": { "name": "Bob" }
}
]
}
Templates
Create reusable email templates with dynamic variables.
Templates use {{variable}} syntax for dynamic content, with support for conditionals and loops:
<h1>Welcome, {{name}}!</h1> <p>Thanks for joining {{company}}.</p> {{#if has_coupon}} <p>Use code <strong>{{coupon_code}}</strong> for 20% off.</p> {{/if}}
Add Domain
Register a new sending domain with ApiMailer.
{
"domain": "yourdomain.com"
}
{
"id": "dom_abc123",
"domain": "yourdomain.com",
"status": "pending",
"dns_records": [
{ "type": "TXT", "name": "@", "value": "v=spf1 include:_spf.apimailer.com ~all" },
{ "type": "TXT", "name": "am._domainkey", "value": "v=DKIM1; k=rsa; p=MIGf..." }
]
}
Verify Domain
Trigger a verification check for your domain's DNS records.
Webhooks
Receive real-time notifications when email events occur. Configure webhook endpoints in the dashboard or via the API.
{
"event": "delivered",
"timestamp": "2026-02-13T10:30:05Z",
"message_id": "msg_8f3k2j5n9x",
"recipient": "user@example.com",
"tags": ["welcome"],
"metadata": {
"smtp_response": "250 OK"
}
}
All webhook payloads include an X-ApiMailer-Signature header that you should verify to ensure authenticity.
Event Types
| Event | Description |
|---|---|
| queued | Email accepted and queued for delivery |
| delivered | Email successfully delivered to the recipient's server |
| opened | Recipient opened the email |
| clicked | Recipient clicked a link in the email |
| bounced | Email bounced (hard or soft) |
| complained | Recipient marked email as spam |
| unsubscribed | Recipient clicked the unsubscribe link |
SMTP Relay
Use ApiMailer as an SMTP relay for existing applications. Configure your application with these settings:
| Setting | Value |
|---|---|
| Host | smtp.apimailer.com |
| Port | 587 (STARTTLS) or 465 (SSL) or 25 |
| Username | apikey |
| Password | Your API key |
| Encryption | TLS (recommended) |
Rate Limits
API requests are rate limited based on your plan:
| Plan | Requests / second | Batch size |
|---|---|---|
| Starter | 5 | 100 |
| Growth | 20 | 500 |
| Business | 100 | 1,000 |
| Enterprise | Custom | Custom |
When you exceed the rate limit, the API returns a 429 status with a Retry-After header indicating how many seconds to wait.