Docs
API · emails

Send a batch

Queue up to 100 emails in one request. Each item is an independent send — the batch returns a result per item, in order, so a single bad recipient never fails the rest.

POST/v1/emails/batch

The body is an emails array, where each element is exactly the same shape as a single POST /v1/emails body. Counts as one request against your rate limit.

01 Body parameters

emailsobject[]Required
Between 1 and 100 send objects. Each item accepts the full send-email body from, to, subject, html/text or templateId + data, attachments, tags, and so on.

02 Headers

X-Drin-ProductheaderOptional
Names the sending project for account-wide keys (alias: X-Drin-Sender). Project-scoped keys may omit it.

03 Request

curl https://api.drin.run/v1/emails/batch \
  -H "Authorization: Bearer $DRIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "emails": [
      {
        "from": { "email": "hello@yourdomain.com" },
        "to": [{ "email": "a@example.com" }],
        "subject": "Receipt #1",
        "html": "<p>Thanks!</p>"
      },
      {
        "from": { "email": "hello@yourdomain.com" },
        "to": [{ "email": "b@example.com" }],
        "subject": "Receipt #2",
        "html": "<p>Thanks!</p>"
      }
    ]
  }'

04 Response

207 Multi-Status — a data array aligned to your input order. Each element either carries an id (the message was queued) or an error with the usual { type, message, param? } envelope. Always inspect every element; a 207 does not mean every send succeeded.

207 Multi-Status
{
  "data": [
    { "id": "msg_01HZX9K3T2QF7P0M4N8B6C5D" },
    {
      "error": {
        "type": "suppressed",
        "message": "Recipient is on the suppression list.",
        "param": "to"
      }
    }
  ]
}
Per-item, not all-or-nothingThe batch isn't transactional. Items that validate are queued even when siblings fail. Match results to inputs by array index, and retry only the failed items.
One template, many recipientsTo send the same template to many people, set the same templateId on each item and vary to and data. See Batch & scheduled.