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.
Pass the API token in the Api-Token
Sandbox ID
4015Success. Check individual responses if messages have been delivered.
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.
trueGeneral request errors.
Bad request. Fix errors listed in response before retrying.
Unauthorized. Make sure you are sending correct credentials with the request before retrying.
Internal error. Messages were not delivered. Retry later or contact support.
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?

