For the complete documentation index, see llms.txt. This page is also available as Markdown.

Batch send email (including templates)

Batch send email (text, html, text&html, templates). Please note that the endpoint will return a 200-level http status, even when sending for individual messages may fail. Users of this endpoint should check the success and errors for each message in the response (the results are ordered the same as the original messages - requests). Please note that the endpoint accepts up to 500 messages per API call, and up to 50 MB payload size, including attachments.

post
Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Sandbox ID

Example: 4015
Body
Responses
200

Success. Check individual responses if messages have been delivered.

application/json
successbooleanOptional

Indicates whether the was a general error. When false, you should check the errors array for information. When true, you should check individual message responses and their success.

Example: true
errorsstring[]Optional

General request errors.

post/api/batch/{sandbox_id}
curl -X POST https://sandbox.api.mailtrap.io/api/batch/{sandbox_id} \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "base": {"from": {"email": "sender@example.com"}, "subject": "Batch Email"},
    "requests": [{"to": [{"email": "recipient1@example.com"}]}, {"to": [{"email": "recipient2@example.com"}]}]
  }'
{
  "success": true,
  "responses": [
    {
      "success": true,
      "message_ids": [
        "0c7fd939-02cf-11ed-88c2-0a58a9feac02"
      ],
      "errors": [
        "text"
      ]
    }
  ],
  "errors": [
    "text"
  ]
}

Last updated

Was this helpful?