Send a batch of messages
Requires scope: send. Sends up to 100 messages in one request. Per-message failures are returned inline in data[] and do not fail the batch; the HTTP status is still 201. Each failure is the error a single send would answer: a message a send limit refused carries resets_at and retry_after_seconds, one the email service would not take for now (503 upstream_unavailable) retry_after_seconds, and a plan refusal upgrade_url. With an Idempotency-Key, a batch in which no message was stored and no mail went out frees the key, so sending it again with the same key sends it; any other batch's answer is kept on the key. A scheduled message is its result once stored, even if announcing it then fails: with a key the batch answers that error, and the retry with the same key gets the batch (201) and raises the message.scheduled. A batch cannot send attachments: an item carrying attachments refuses the whole batch with 422 invalid_field (param attachments), so send that message on its own with POST /v1/messages.
Request
- Base URL: https://api.mails.ai
- URL: https://api.mails.ai/v1/messages/batch
- Auth: HTTP bearer
Headers
Replays the stored response for a repeated key (kept 24 hours), so a retried request never double-sends; the replay carries Idempotent-Replay: true. An error is kept on the key only once the mail has gone out, so a replayed error means it was sent. Once a scheduled send is stored, a failure after that keeps the message's answer on the key instead: the retry answers with the message (201) and raises its message.scheduled if the first request did not. After a failure before either, the same key sends again, as it does after a batch that stored no message and sent no mail.
Request body
Response
Per-message results (success or error objects) plus the submitted batch size.
Changes
No recorded changes to this operation across all 1 revision of this API.