Documentation
docMay 18, 20262 min read

Sending with the REST API

Send transactional email via HTTP POST. Authenticate with an API key, use templates, and attach files.

By SESMetric Docs

The REST send endpoint is the easiest way to send transactional email from a modern stack. It's available on paid plans only and requires an API key.

Endpoint: https://api.sesmetric.com/v1/send

1. Create an API key

In the dashboard go to API keys → New key. Pick a name, leave the scope as email:send, click Generate. The raw sk_live_… value is shown once — copy it now.

2. Authentication

Pass the key as a bearer token:

Authorization: Bearer sk_live_…

Or, equivalently:

X-API-Key: sk_live_…

3. Basic send

curl -X POST https://api.sesmetric.com/v1/send \
  -H "Authorization: Bearer $SM_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_email": "no-reply@example.com",
    "to": ["alex@customer.com"],
    "subject": "Welcome",
    "html": "<p>Welcome to Example.</p>"
  }'

Response:

{ "id": "msg_a7f0c12e9bd4", "status": "queued" }

4. Send with a system template

The catalog at /templates lists ready-to-use system templates (password reset, invoice issued, payment failed, etc.). Pass the slug and variables:

curl -X POST https://api.sesmetric.com/v1/send \
  -H "Authorization: Bearer $SM_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_email": "no-reply@example.com",
    "to": ["alex@customer.com"],
    "template": "password-reset",
    "variables": {
      "user": { "first_name": "Alex", "email": "alex@customer.com" },
      "reset_url": "https://app.example.com/reset?token=abc123"
    }
  }'

Your branding (logo, colors, footer) is auto-injected from Dashboard → Branding. Subject and body are rendered with Jinja2.

5. Attachments

{
  "attachments": [
    {
      "filename": "invoice-1042.pdf",
      "content_type": "application/pdf",
      "content_base64": "JVBERi0xLjQ..."
    }
  ]
}

Total payload limit: 25 MB.

6. Request fields

FieldTypeNotes
from_emailstringMust be a verified identity in your account.
tostring[]1–50 recipients.
cc, bccstring[]Optional.
reply_tostringOptional.
subjectstringRequired unless template is set.
html, textstringAt least one is required without template.
templatestringSlug of a system template or user template.
variablesobjectJinja2 context for the template.
headersobjectCustom headers (max 16).
tagsstring[]Free-form labels for analytics filtering.
attachmentsobject[]base64-encoded content + content_type.

7. Errors

CodeMeaning
400Validation failed — check error.detail.
401Missing or revoked key.
402Account is not on a paid plan.
403Key missing email:send scope or identity not verified.
429Rate limited — back off + retry.
500Transient. Retry with exponential backoff.
Tagsrest-apisendingreference