Emails
Send Batch Emails
Send multiple emails in a single API call (up to 100 emails).
POST
/
emails
/
batch
Send Batch Emails
curl --request POST \
--url https://api.unosend.co/emails/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
{}
]
}
'import requests
url = "https://api.unosend.co/emails/batch"
payload = { "emails": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({emails: [{}]})
};
fetch('https://api.unosend.co/emails/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.unosend.co/emails/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emails' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.unosend.co/emails/batch"
payload := strings.NewReader("{\n \"emails\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.unosend.co/emails/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unosend.co/emails/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyarray
required
Array of email objects. Each email has the same structure as the single send endpoint, including
from, to, subject, html, text, and tracking.Each email in the batch can have its own tracking settings. See Email Tracking for details.
Request
curl -X POST https://api.unosend.co/emails/batch \
-H "Authorization: Bearer un_xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"emails": [
{
"from": "hello@yourdomain.com",
"to": ["user1@example.com"],
"subject": "Welcome User 1",
"html": "<p>Hello User 1!</p>",
"tracking": {
"open": true,
"click": false
}
},
{
"from": "hello@yourdomain.com",
"to": ["user2@example.com"],
"subject": "Welcome User 2",
"html": "<p>Hello User 2!</p>",
"tracking": {
"open": true,
"click": true
}
}
]
}'
await fetch('https://api.unosend.co/emails/batch', {
method: 'POST',
headers: {
'Authorization': 'Bearer un_xxxxxxxxxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
emails: [
{
from: 'hello@yourdomain.com',
to: ['user1@example.com'],
subject: 'Welcome User 1',
html: '<p>Hello User 1!</p>',
tracking: { open: true, click: false }
},
{
from: 'hello@yourdomain.com',
to: ['user2@example.com'],
subject: 'Welcome User 2',
html: '<p>Hello User 2!</p>',
tracking: { open: true, click: true }
}
]
})
});
import requests
requests.post('https://api.unosend.co/emails/batch',
headers={'Authorization': 'Bearer un_xxxxxxxxxx'},
json={
'emails': [
{
'from': 'hello@yourdomain.com',
'to': ['user1@example.com'],
'subject': 'Welcome User 1',
'html': '<p>Hello User 1!</p>',
'tracking': {'open': True, 'click': False}
},
{
'from': 'hello@yourdomain.com',
'to': ['user2@example.com'],
'subject': 'Welcome User 2',
'html': '<p>Hello User 2!</p>',
'tracking': {'open': True, 'click': True}
}
]
}
)
Response
200
{
"success": true,
"data": {
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440001"
},
{
"id": "550e8400-e29b-41d4-a716-446655440002"
}
]
}
}
⌘I
Send Batch Emails
curl --request POST \
--url https://api.unosend.co/emails/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
{}
]
}
'import requests
url = "https://api.unosend.co/emails/batch"
payload = { "emails": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({emails: [{}]})
};
fetch('https://api.unosend.co/emails/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.unosend.co/emails/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emails' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.unosend.co/emails/batch"
payload := strings.NewReader("{\n \"emails\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.unosend.co/emails/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unosend.co/emails/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body