zMailer API Documentation

Send transactional emails with a simple REST API. Enterprise-grade delivery infrastructure.

Base URL

https://zmailer-api.zavecoder.com

Authentication

All API requests require an API key. Create API keys from the dashboard.

API Key Format

zm_live_xxxxxxxxxxxxxxxxxxxx # production
zm_test_xxxxxxxxxxxxxxxxxxxx # testing

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

POST/send

Request Body

FieldTypeRequiredDescription
tostringYesRecipient email address
toNamestringNoRecipient display name
fromstringNoSender email (must be verified domain)
fromNamestringNoSender display name
subjectstringYes*Email subject line
htmlstringYes*HTML content of the email
textstringNoPlain text fallback
templateSlugstringNoTemplate slug to use
variablesobjectNoVariables 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.

GET/stats

Query Parameters

ParameterTypeDefaultDescription
daysinteger30Number 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

EventDescriptionAction
DeliveryEmail successfully delivered to recipientUpdates email log status to "delivered"
BounceEmail bounced (hard or soft)Adds to suppression list, updates project stats
ComplaintRecipient marked email as spamAdds 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.

EndpointLimitWindow
/send100 requestsper minute
/stats60 requestsper minute
Daily sending10,000 emailsper 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.

TypeNameValue
TXT@v=spf1 include:amazonses.com ~all
CNAMExxx._domainkeyxxx.dkim.amazonses.com
TXT_dmarcv=DMARC1; p=quarantine

The exact records will be provided in the dashboard when you add a domain.

Error Codes

CodeDescription
200Success
400Bad request - missing or invalid parameters
401Unauthorized - invalid or missing API key
403Forbidden - domain not verified
500Server error