Skip to content

MailerSendBulk

POST mailer/email/bulk

Queues an email for every address in the list. Use it for a one-off blast to a known list; for a managed rollout over a CRM segment use campaigns, which keep counters, a cursor and the ability to resume.

A recipient that cannot be queued — suppressed, unsubscribed, invalid address — does not abort the batch. It lands in failed with its reason while the rest is queued.

Access Control

Allowed roles: admin, leader.

Request

POST https://{broker_domain}/mailer/email/bulk
{
  "templateId": 4,
  "kind": "MARKETING",
  "recipients": [
    {
      "to": "[email protected]",
      "sendToParentType": "CUSTOMER",
      "sendToParentId": 140,
      "data": {
        "name": "John"
      }
    },
    {
      "to": "[email protected]",
      "sendToParentType": "LEAD",
      "sendToParentId": 77,
      "data": {
        "name": "Anna"
      }
    }
  ]
}
{
  "command": "MailerSendBulk",
  "extID": "1",
  "data": {
    "templateId": 4,
    "kind": "MARKETING",
    "recipients": [
      {
        "to": "[email protected]",
        "sendToParentType": "CUSTOMER",
        "sendToParentId": 140,
        "data": {
          "name": "John"
        }
      },
      {
        "to": "[email protected]",
        "sendToParentType": "LEAD",
        "sendToParentId": 77,
        "data": {
          "name": "Anna"
        }
      }
    ]
  }
}
const res = await platform.MailerSendBulk({
  templateId: 4,
  kind: "MARKETING",
  recipients: [
    {
      to: "[email protected]",
      sendToParentType: "CUSTOMER",
      sendToParentId: 140,
      data: {
        name: "John"
      }
    },
    {
      to: "[email protected]",
      sendToParentType: "LEAD",
      sendToParentId: 77,
      data: {
        name: "Anna"
      }
    }
  ]
});

Request Data

Field Type Required Description
recipients array Yes Recipients, 1..10000 items: { to, sendToParentType?, sendToParentId?, data? }
templateId int No Template to render; use it instead of passing content
subject string No Subject, up to 512 characters
html string No HTML body
text string No Plain-text part; generated from the HTML when omitted
structure array No Email builder tree; the HTML is rendered from it
data object No Placeholder values
profileId int No Explicit provider profile for the whole batch
kind enum No TRANSACTIONAL or MARKETING
sendAt string No Start the batch later
campaignId int No Attach the emails to an existing campaign for reporting

Behavior

  • Emails are queued, not sent inside the request. The queue paces them at the profile rate limit, so a large batch cannot burn the provider quota in one burst.
  • Content is assembled per recipient, because the unsubscribe link and the placeholders differ for each one.

Response Data

{
  "queued": 2,
  "failed": [
    { "to": "[email protected]", "error": "Address [email protected] is suppressed: HARD_BOUNCE" }
  ],
  "emails": [
    { "emailId": 814, "to": "[email protected]" },
    { "emailId": 815, "to": "[email protected]" }
  ]
}

Errors

Code Error Description
400 VALIDATION_ERROR Empty recipient list or no content and no template
409 BULK_TOO_LARGE More recipients than the configured bulk limit
404 NOT_FOUND Template, profile, or campaign not found
409 NO_ROUTE_AVAILABLE No profile of the brand can send to these recipients