Send a batch of emails
Queues up to 100 emails in one request. Each email is handled exactly as by POST /v1/emails (sender checks, suppressions, scheduling, attachments, tracking), but the batch is all or nothing: if any email is invalid, or any from is not a verified domain (live keys), nothing is stored and the error names the email (e.g. emails.3.to). One Idempotency-Key covers the whole batch. The emails' recipients are charged against the send quota together, so a batch with more recipients than the quota allows at once is refused (quota_exceeded without Retry-After): split it. The request body shares the 40 MB limit of a single send.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
Idempotency-Key?stringMakes retries safe: a repeated request with the same key and body returns the original email (with its current status) instead of sending again, for 24 hours. 1-256 characters.
1 <= length <= 256Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"application/json- body
- body
- …
emails*array<>Up to 100 emails, each accepted by POST /v1/emails. The batch is accepted or rejected as a whole.
1 <= items <= 100The batch, accepted for delivery, with its emails in request order. A replay returns the original batch with the emails' current statuses.
application/json- response
- response
- …
object*"email_batch""email_batch"id*stringdata*array<>The batch's emails, in the order of the request.
created_at*stringdate-timeimport { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.email.sendBatch([ { from: "Acme <notifications@acme.com>", to: "ada@example.com", subject: "Your weekly summary", html: "<p>Hi Ada, here is your week.</p>", category: "digest", }, { from: "Acme <notifications@acme.com>", to: "grace@example.com", subject: "Your weekly summary", html: "<p>Hi Grace, here is your week.</p>", category: "digest", },]);{ "object": "email_batch", "id": "batch_01k8d0n6x5f3w2e1r9t7y4u6i8", "data": [ { "object": "email", "id": "email_01k7c8m4q2f3e9v6t5r1n0p8yz", "from": "Acme <notifications@acme.com>", "to": [ "ada@example.com" ], "cc": [], "bcc": [], "reply_to": [], "subject": "Your weekly summary", "html": "<p>Hi Ada, here is your week.</p>", "text": null, "headers": {}, "tags": [], "category": "digest", "stream": "transactional", "status": "queued", "failure": null, "recipients": [ { "address": "ada@example.com", "type": "to", "status": "queued", "last_event_at": null } ], "sandbox": false, "tracking": { "opens": false, "clicks": false, "unsubscribe": false, "open_count": 0, "first_opened_at": null, "last_opened_at": null, "click_count": 0, "first_clicked_at": null, "last_clicked_at": null }, "attachments": [], "created_at": "2026-10-10T12:00:00.000Z", "sent_at": null, "scheduled_at": null, "batch_id": "batch_01k8d0n6x5f3w2e1r9t7y4u6i8", "template": null, "broadcast_id": null, "subaccount_id": null, "content_storage": { "mode": "store", "discarded_at": null } } ], "created_at": "2026-10-10T12:00:00.000Z"}