Pular para o conteúdo
Esc
↑↓navegar↵abrir⌘Jpré-visualizar

Send a batch of emails

POST/emails/batch
Autorização
AuthorizationToken Bearer · headerobrigatório

A BillionSend API key (bs_…).

Parâmetros de cabeçalho
Idempotency-Keystring

1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.

comprimento mín. 1 · comprimento máx. 256
x-batch-validationstring

strict (default): any invalid email rejects the whole batch with that email's error, sending nothing. permissive: invalid emails are listed in errors by index and the valid ones are sent.

Valores permitidos:strictpermissive
Corpo da requisição
obrigatórioapplication/json
Array de SendEmailRequest
fromstringobrigatório

Sender, "Name <user@domain>" or bare address; the domain must be verified for the team

tostring | string[]obrigatório

Recipient address or list of up to 50

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
subjectstringobrigatório

Subject line

comprimento mín. 1 · comprimento máx. 998
htmlstring

HTML body; at least one of html/text is required

textstring

Plain-text body; at least one of html/text is required

ccstring | string[]

Cc address or list

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
bccstring | string[]

Bcc address or list

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
reply_tostring | string[]

Reply-To address or list

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
scheduled_atstring

Deliver later: ISO 8601 with offset, or relative like "in 2 hours" (an ISO 8601 datetime with offset (e.g. "2026-09-01T12:00:00Z") or a relative time like "in 5 mins", "in 2 hours", or "in 1 day"); max 30 days ahead

tagsobject[]

Key/value labels attached to the email for filtering; names starting with billionsend_, in any letter case, are reserved

Mostrar propriedades
Array de object
namestringobrigatório
comprimento mín. 1
valuestringobrigatório
topic_idstring<uuid> | null

Topic id: recipients opted out of the topic are skipped; a send to one address that is a contact also gets that contact's unsubscribe link. A topic bound to a domain (domain_id) can be sent only from that domain (422 otherwise)

attachmentsobject[]

Attachments with base64 content (no remote paths)

Mostrar propriedades
Array de object
filenamestring | boolean | null
Mostrar propriedades
Pelo menos um de:
string
string
boolean
boolean
null
null
contentstring
content_typestring
content_idstring

Inline part: the HTML shows it with <img src="cid:<content_id>">

comprimento mín. 1 · comprimento máx. 255
pathstring
headersobject

Extra message headers (transport headers are rejected)

templateany

Not supported: any value is a 422; an email takes html and/or text

Respostas
200

Batch accepted

dataobject[]obrigatório
Mostrar propriedades
Array de object
idstring<uuid>obrigatório
errorsobject[]
Mostrar propriedades
Array de object
indexintegerobrigatório
messagestringobrigatório
400

Idempotency-Key is not 1 to 256 characters

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
401

Missing, malformed, unknown or revoked API key

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
403

Restricted API key

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
404

Not found

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
409

Idempotency conflict

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
422

Validation error

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
429

Sending quota exceeded, or the rate limit (rate_limit_exceeded, with Retry-After)

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
Experimentar
Servidor
Autorização
Parâmetros
Corpoapplication/json
Requisição
curl -X POST 'https://api.billionsend.com/emails/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "from": "Acme <onboarding@acme.dev>",
    "to": [
      "success@simulator.amazonses.com"
    ],
    "subject": "string",
    "html": "string",
    "text": "string",
    "cc": "string",
    "bcc": "string",
    "reply_to": "string",
    "scheduled_at": "string",
    "tags": [
      {
        "name": "string",
        "value": "string"
      }
    ],
    "topic_id": "646807af-5da6-43aa-83d3-8ac1d15ab4e5",
    "attachments": [
      {
        "filename": "string",
        "content": "string",
        "content_type": "string",
        "content_id": "string",
        "path": "string"
      }
    ],
    "headers": {
      "property1": "string",
      "property2": "string"
    },
    "template": null
  }
]'
Resposta
{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    }
  ],
  "errors": [
    {
      "index": 0,
      "message": "string"
    }
  ]
}

Esta página foi útil?