Sign inGet Started

Create a batch of email messages

POST
/v1/email/batches
const batch = await bird.email.sendBatch({
  messages: [
    {
      from: { email: "onboarding@messagebird.dev", name: "Bird" },
      to: ["alice@example.com"],
      subject: "Your receipt",
      html: "<p>Thanks, Alice.</p>",
    },
    {
      from: { email: "onboarding@messagebird.dev", name: "Bird" },
      to: ["bob@example.com"],
      subject: "Your receipt",
      html: "<p>Thanks, Bob.</p>",
    },
  ],
});
for (const item of batch.data) console.log(item.id, item.status);
Réponse202
{
  "data": [
    {
      "id": "em_01krdgeqcxet5s7t44vh8rt9mg",
      "status": "accepted",
      "category": "marketing",
      "requested_language": "pt-BR",
      "resolved_language": "pt-BR",
      "template_id": "emt_01krdgeqcxet5s7t44vh8rt9mg",
      "template_version_id": "emv_01krdgeqcxet5s7t44vh8rt9mg"
    },
    {
      "id": "em_01krdgeqcxet5s7t44vh8rt9mh",
      "status": "accepted",
      "category": "transactional",
      "scheduled_at": "2026-05-22T09:00:00Z"
    }
  ]
}

Accepts up to 100 independent email messages and queues them for delivery. All items are validated before any are queued: if one fails validation, the entire batch is rejected. Field-level validation failures and business-rule failures, such as sending from a domain that is not verified, both return 422. An item can set scheduled_at to send it later, on the same terms as a single scheduled send, and one batch can mix scheduled and immediate messages. Cancel a scheduled item before it sends with Cancel an email message. Suppression is evaluated per recipient after acceptance, never as a synchronous error. The 202 response returns one entry per message in submission order, each with its own id you can use to fetch that message or match it against webhook events. Attachments are allowed per message. Each message must stay within the 20 MB estimated generated message-size cap, and the serialized JSON request body for the whole batch has a hard 20 MB cap.

Corps de la requête

messages
array of object
obligatoire

Email message send requests, up to 100. All items are validated before any are queued. Attachments are allowed on individual messages. Each message must stay within the 20 MB estimated generated message-size cap. The serialized JSON request body for the batch has a hard 20 MB cap.

Afficher les paramètres enfants

Contenu de la réponse

data
array of object
obligatoire

One entry per message in the batch, in submission order.

Afficher les attributs enfants

Poursuivez avec la documentation, les guides et les exemples sur ce sujet.