Skip to the page

Send emails in a batch

Sends up to a hundred emails in one request. Every email is checked first and one that is refused refuses the whole batch, unless validation is permissive: then the rest are sent and the refused one is listed with its reason. After that each email is accepted or refused by itself, and the answer says which.

emails_batch
Needs the scopeemails:send
Reaches outside the workspace

Arguments

  • emailsobject[]Required

    The emails to send, up to 100. Each takes the same fields as one email, without attachments or a schedule.

  • emails[].fromstring

    The sender, on a verified domain. An address, or a name and an address as Acme <hello@mail.example.com>. Needed unless a template gives one. Up to 500 characters.

  • emails[].tostring | string[]Required

    Who the email is for: one address, or up to 50. A test address, such as delivered@opensend.test or bounced@opensend.test, reaches nobody and ends the way its name says.

  • emails[].ccstring | string[]

    Who gets a copy: one address, or up to 50.

  • emails[].bccstring | string[]

    Who gets a copy without the others seeing: one address, or up to 50.

  • emails[].replyTostring

    The address replies go to, when it is not the sender. Without it, the one of the template when it has one, then the default of the workspace.

  • emails[].subjectstring

    The subject line. Needed unless a template gives one. Up to 500 characters.

  • emails[].htmlstring

    The message as HTML. Up to 200,000 characters.

  • emails[].textstring

    The message as plain text. Send it with html, or alone. With a template it replaces the plain text of the template. Up to 200,000 characters.

  • emails[].headersRecord<string, string>

    Extra headers for the message, by name. Up to 20, and not the ones the platform writes itself.

  • emails[].tagsRecord<string, string>

    Labels of your own for the email, by name, such as { "campaign": "welcome" }. Up to 10. They come back on the email and in webhooks.

  • emails[].templateobject

    A published template to build the email from, in place of subject, html and text. Its sender and reply address are used when you give none.

  • emails[].template.idstringRequired

    The id or the alias of a published template. Up to 500 characters.

  • emails[].template.variablesRecord<string, string | number>

    A value for each {{NAME}} in the template, by name. A variable with a default in the template can be left out.

  • validationstring

    What one refused email does to the others: strict refuses the whole batch and sends nothing, permissive sends the rest and lists the refused one with its reason. Without it you get strict.

    One ofstrictpermissive

  • idempotencyKeystring

    A key of your own that makes a repeat of this request answer with the first result and send nothing. The Idempotency-Key header does the same.

Returns

The answer comes back under structuredContent, with the same JSON as text in content. A call the API refuses comes back with isError set, and the code and the message under structuredContent.error. MCP shows how to connect a client.

  • object"list"

    Always list.

  • dataobject[]

    One entry for each email you sent, in the same order.

  • data[].indexinteger

    The position of this email in the list you sent, from 0.

  • data[].idstring | null

    The id of the email, or null when it was refused.

  • data[].statusstring | null

    The status of the email, or null when it was refused.

    One ofqueuedsentdelivereddelayedbouncedopenedclickedcomplainedfailedscheduledcanceled

  • data[].errorobject | null

    Why it was refused, or null.

  • data[].error.codestring

    The code of the refusal.

  • data[].error.messagestring

    The refusal in words.

  • sentinteger

    How many were accepted.

  • failedinteger

    How many were refused.