Send Batch Emails
Send up to 1,000 emails in a single API call.
POST /api/v1/emails/batch
Sends up to 1,000 emails in one request. Each email is processed independently — failures for individual emails do not abort the batch. Authenticate with an X-API-Key header.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
emails | SendEmailRequest[] | Yes | Array of email objects (max 1,000) |
Each object in emails has the same fields as Send Email.
Response
Returns 200 OK with a emails array and a count:
| Field | Type | Description |
|---|---|---|
emails | EmailSend[] | Array of queued email records |
count | number | Total number of emails in the batch |
{
"emails": [
{
"id": "em_01hx...",
"status": "queued",
"from": "newsletter@yourdomain.com",
"to": "alice@example.com",
"subject": "Our April newsletter",
"created_at": "2024-04-01T09:00:00Z"
},
{
"id": "em_01hy...",
"status": "queued",
"from": "newsletter@yourdomain.com",
"to": "bob@example.com",
"subject": "Our April newsletter",
"created_at": "2024-04-01T09:00:00Z"
}
],
"count": 2
}Code examples
curl https://api.smail.dev/api/v1/emails/batch \
-H "X-API-Key: sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"emails": [
{
"from": "newsletter@yourdomain.com",
"to": ["alice@example.com"],
"subject": "Our April newsletter",
"html": "<p>Hello Alice!</p>",
"type": "marketing"
},
{
"from": "newsletter@yourdomain.com",
"to": ["bob@example.com"],
"subject": "Our April newsletter",
"html": "<p>Hello Bob!</p>",
"type": "marketing"
}
]
}'const result = await smail.emails.batch([
{
from: "newsletter@yourdomain.com",
to: ["alice@example.com"],
subject: "Our April newsletter",
html: "<p>Hello Alice!</p>",
type: "marketing",
},
{
from: "newsletter@yourdomain.com",
to: ["bob@example.com"],
subject: "Our April newsletter",
html: "<p>Hello Bob!</p>",
type: "marketing",
},
]);
console.log(`Sent ${result.count} emails`);result, err := client.Emails.Batch(ctx, []smail.SendEmailRequest{
{
From: "newsletter@yourdomain.com",
To: []string{"alice@example.com"},
Subject: "Our April newsletter",
HTML: "<p>Hello Alice!</p>",
Type: "marketing",
},
{
From: "newsletter@yourdomain.com",
To: []string{"bob@example.com"},
Subject: "Our April newsletter",
HTML: "<p>Hello Bob!</p>",
Type: "marketing",
},
})Error responses
| Status | Error | Description |
|---|---|---|
401 | unauthorized | Missing or invalid API key |
400 | invalid request | Batch exceeds 1,000 emails or missing required fields |