Loading...
Loading...
/api/v1/emails/batchSend multiple emails in a single API request. This is ideal for sending personalised emails to multiple recipients efficiently.
curl -X POST https://notifyn.net/api/v1/emails/batch \
-H "Authorization: Bearer ntfn_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"emails": [
{
"to": "user1@example.com",
"subject": "Hello User 1",
"html": "<h1>Hi User 1!</h1><p>Your personal message.</p>"
},
{
"to": "user2@example.com",
"subject": "Hello User 2",
"html": "<h1>Hi User 2!</h1><p>Your personal message.</p>"
},
{
"to": "user3@example.com",
"subject": "Hello User 3",
"html": "<h1>Hi User 3!</h1><p>Your personal message.</p>"
}
]
}'| Parameter | Type | Description |
|---|---|---|
emailsrequired | array | Array of email objects. Maximum 100 emails per batch. |
| Property | Type | Description |
|---|---|---|
to required | string | string[] | Recipient email address(es) |
subject required | string | Email subject |
html | string | HTML content (html or text required) |
text | string | Plain text content |
replyTo | string | Reply-to address |
{
"data": [
{ "id": "550e8400-e29b-41d4-a716-446655440001" },
{ "id": "550e8400-e29b-41d4-a716-446655440002" },
{ "id": "550e8400-e29b-41d4-a716-446655440003" }
],
"message": "Successfully sent 3 emails to 3 recipients"
}Maximum emails per batch
Send up to 100 individual emails in a single request
Maximum recipients per email
Each email can have up to 50 recipients in the "to" field
// Send personalized emails to multiple users
const users = [
{ email: 'alice@example.com', name: 'Alice' },
{ email: 'bob@example.com', name: 'Bob' },
{ email: 'charlie@example.com', name: 'Charlie' },
];
const emails = users.map(user => ({
to: user.email,
subject: `Hello, ${user.name}!`,
html: `<h1>Welcome, ${user.name}!</h1><p>Thanks for signing up.</p>`,
}));
const response = await fetch(`${API_URL}/api/v1/emails/batch`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.NOTIFYN_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ emails }),
});
const result = await response.json();
console.log(`Sent ${result.data.length} emails`);