Emails

Send a batch of emails

POST
/api/v1/emails/batch

Up to 100 DISTINCT emails in one call — each with its own recipient, template and props. One round-trip instead of 100.

This is not a bulk-campaign endpoint: every entry is still a single-recipient message and goes through the same idempotency, suppression, cap and sender checks a single send does. Nothing is skipped for speed.

Entries succeed and fail independently. The response is always 202 with a per-index result array in request order — data[i] corresponds to emails[i]. A success carries id and status; a failure carries an error object with the same codes a single send returns. Check the array, not the status code.

Idempotency: give each entry its own idempotency_key, or pass an Idempotency-Key header and each entry derives <header>:<index>. Retrying a partially-succeeded batch then replays the successes and retries only the failures.

Requires a write-scope key.

Authorization

bearerAuth write
headerAuthorizationBearer <token>

An API key from the dashboard under Settings → API keys, sent as Authorization: Bearer aem_….

Authorization has two independent axes.

The scope is ranked — a key satisfies any requirement at or below its own tier:

  • read — see messages, contacts and metrics. Changes nothing, and cannot send.
  • write — everything read does, plus managing templates, contacts, automations, segments and suppressions. This is what editing a template needs.
  • admin — everything write does, plus sending configuration: domains, senders, webhook registration, kill switch, daily cap, brand.

There is no approve scope. It was a rung once; it is not one now, and a key requested with it is rejected.

The approval grant (can_approve) is a separate boolean, not a rung. Delivering mail to a real inbox needs write and the grant. Keeping them on separate axes is what makes the review gate a control rather than a convention: a key that may propose is not automatically a key that may approve its own proposal.

Give your application the lowest tier that works. Most need write and the grant — the dashboard mints that combination as Send + manage; Manage only is the same rung with the grant withheld.

Scope: write

Header Parameters

Idempotency-Key?string

Namespaces the batch. Each entry derives <key>:<index> unless it sets its own idempotency_key.

Lengthlength <= 256

Request Body

application/json
  1. body
emails*array<>

Up to 100 distinct messages, each with its own recipient and template. Results come back in this order.

Items1 <= items <= 100

Response Body

Accepted. Every entry has a result; read data for per-entry outcomes.

application/json
  1. response
data?array<>

Same order as the request.

queued?integer
failed?integer
Example Request
curl -X POST 'https://sendandretain.com/api/v1/emails/batch' \  -H 'Idempotency-Key: order-confirmations-2026-08-10' \  -H 'Content-Type: application/json' \  -d '{  "emails": [    {      "to": "[email protected]",      "template": "receipt",      "props": {        "total": "£42.00"      }    },    {      "to": "[email protected]",      "template": "welcome",      "props": {        "firstName": "Sam"      }    }  ]}'
Example Response
{  "data": [    {      "index": 0,      "id": "msg_3aF9c1",      "status": "queued"    },    {      "index": 1,      "error": {        "code": "template_not_found",        "message": "No template 'welcom'."      }    }  ],  "queued": 1,  "failed": 1}