Batch send
Send up to 100 emails in a single request. Partial success is reported per item.
Endpoint
POST
/v1/emails/batch Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
| emails | array | Required | Array of send objects (same shape as POST /emails). Max 100 items. |
Response
200
{
"data": [
{ "id": "em_1", "status": "queued" },
{ "id": null, "status": "failed", "error": { "type": "validation_error", "message": "Invalid to" } }
]
}Examples
Node.js
const result = await xurel.emails.batch({
emails: [
{
from: 'hello@yourdomain.com',
to: 'a@example.com',
subject: 'Hello A',
html: '<p>Hi A</p>',
type: 'transactional',
},
{
from: 'hello@yourdomain.com',
to: 'b@example.com',
subject: 'Hello B',
html: '<p>Hi B</p>',
type: 'transactional',
},
],
}); cURL
curl https://api.xurel.co/v1/emails/batch \
-H "Authorization: Bearer $XUREL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"emails": [
{
"from": "hello@yourdomain.com",
"to": ["a@example.com"],
"subject": "Hello A",
"html": "<p>Hi A</p>",
"type": "transactional"
}
]
}'