Base URL
Authentication
All API requests require an API key. Create API keys from the dashboard.
API Key Format
Using the API Key
# Option 1: X-API-Key header (recommended) curl -H "X-API-Key: zm_live_your_key" ... # Option 2: Bearer token curl -H "Authorization: Bearer zm_live_your_key" ...
Send Email
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient email address |
| toName | string | No | Recipient display name |
| from | string | No | Sender email (must be verified domain) |
| fromName | string | No | Sender display name |
| subject | string | Yes* | Email subject line |
| html | string | Yes* | HTML content of the email |
| text | string | No | Plain text fallback |
| templateSlug | string | No | Template slug to use |
| variables | object | No | Variables for template |
* Required if not using a template
Example Request
curl -X POST https://zmailer-api.zavecoder.com/send \
-H "Content-Type: application/json" \
-H "X-API-Key: zm_live_your_api_key" \
-d '{
"to": "user@example.com",
"subject": "Welcome!",
"html": "<h1>Hello!</h1><p>Welcome to our service.</p>"
}'Success Response
{
"success": true,
"messageId": "0100018d1234abcd-12345678...",
"logId": "550e8400-e29b-41d4-a716-446655440000"
}Code Examples
JavaScript / Node.js
const response = await fetch(
'https://zmailer-api.zavecoder.com/send',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'zm_live_your_api_key',
},
body: JSON.stringify({
to: 'user@example.com',
subject: 'Hello World',
html: '<h1>Hello!</h1>',
}),
}
);
const result = await response.json();
console.log(result);Python
import requests
response = requests.post(
'https://zmailer-api.zavecoder.com/send',
headers={
'Content-Type': 'application/json',
'X-API-Key': 'zm_live_your_api_key',
},
json={
'to': 'user@example.com',
'subject': 'Hello World',
'html': '<h1>Hello!</h1>',
},
)
print(response.json())Templates
Create reusable email templates with dynamic variables using Handlebars syntax.
Variable Syntax
<h1>Hello {{name}}!</h1>
<p>Welcome to {{company}}.</p>
<p>Your order #{{order_id}} is confirmed.</p>Using a Template
{
"to": "user@example.com",
"templateSlug": "order-confirmation",
"variables": {
"name": "John",
"company": "Acme Inc",
"order_id": "12345"
}
}Stats API
Retrieve email sending statistics for your project including delivery rates, bounce rates, and daily counts.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| days | integer | 30 | Number of days to include in stats |
Example Request
curl -X GET "https://zmailer-api.zavecoder.com/stats?days=7" \ -H "X-API-Key: zm_live_your_api_key"
Response
{
"period": {
"days": 7,
"from": "2024-01-01T00:00:00.000Z",
"to": "2024-01-08T00:00:00.000Z"
},
"stats": {
"total": 1250,
"sent": 1200,
"delivered": 1180,
"failed": 35,
"bounced": 15
},
"daily": [
{ "date": "2024-01-01", "total": 150, "delivered": 145, "failed": 5 }
],
"byDomain": {
"example.com": { "total": 1250, "sent": 1200, "failed": 50 }
}
}Webhooks & Notifications
zMailer can receive delivery notifications from AWS SES via SNS webhooks. This enables real-time tracking of bounces, complaints, and successful deliveries.
Supported Events
| Event | Description | Action |
|---|---|---|
| Delivery | Email successfully delivered to recipient | Updates email log status to "delivered" |
| Bounce | Email bounced (hard or soft) | Adds to suppression list, updates project stats |
| Complaint | Recipient marked email as spam | Adds to suppression list, may pause project |
Automatic Suppression
When a bounce or complaint is received, the email address is automatically added to your project's suppression list. Future sends to that address will be blocked to protect your sender reputation.
Auto-Pause Protection
Projects are automatically paused when thresholds are exceeded:
- Bounce rate > 5% — Project sending is paused
- Complaint rate > 0.1% — Project sending is paused
To resume sending, review your email lists and remove invalid addresses, then contact support.
Setup Instructions
Configure AWS SNS to send notifications to your webhook endpoint. Detailed setup instructions are available in your dashboard settings.
Rate Limits
API rate limits help ensure fair usage and system stability.
| Endpoint | Limit | Window |
|---|---|---|
| /send | 100 requests | per minute |
| /stats | 60 requests | per minute |
| Daily sending | 10,000 emails | per project (default) |
Need higher limits? Contact support to increase your project quotas.
Domain Verification
Before sending emails, verify your domain by adding DNS records. zMailer can auto-configure these for Cloudflare-managed domains.
| Type | Name | Value |
|---|---|---|
| TXT | @ | v=spf1 include:amazonses.com ~all |
| CNAME | xxx._domainkey | xxx.dkim.amazonses.com |
| TXT | _dmarc | v=DMARC1; p=quarantine |
The exact records will be provided in the dashboard when you add a domain.
Error Codes
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request - missing or invalid parameters |
| 401 | Unauthorized - invalid or missing API key |
| 403 | Forbidden - domain not verified |
| 500 | Server error |