Send bulk email (batch send to multiple recipients)
curl --request POST \
--url https://api.sapt.ai/emails/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipients": [
{
"email": "user1@example.com",
"name": "John Doe"
},
{
"email": "user2@example.com",
"name": "Jane Smith"
}
],
"subject": "Important Update",
"html": "<html><body><h1>Update</h1><p>Important information...</p></body></html>",
"text": "Update: Important information...",
"name": "Monthly Newsletter - November 2024",
"metadata": {
"campaign": "november-newsletter"
}
}
'import requests
url = "https://api.sapt.ai/emails/bulk"
payload = {
"recipients": [
{
"email": "user1@example.com",
"name": "John Doe"
},
{
"email": "user2@example.com",
"name": "Jane Smith"
}
],
"subject": "Important Update",
"html": "<html><body><h1>Update</h1><p>Important information...</p></body></html>",
"text": "Update: Important information...",
"name": "Monthly Newsletter - November 2024",
"metadata": { "campaign": "november-newsletter" }
}
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({
recipients: [
{email: 'user1@example.com', name: 'John Doe'},
{email: 'user2@example.com', name: 'Jane Smith'}
],
subject: 'Important Update',
html: '<html><body><h1>Update</h1><p>Important information...</p></body></html>',
text: 'Update: Important information...',
name: 'Monthly Newsletter - November 2024',
metadata: {campaign: 'november-newsletter'}
})
};
fetch('https://api.sapt.ai/emails/bulk', 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.sapt.ai/emails/bulk",
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([
'recipients' => [
[
'email' => 'user1@example.com',
'name' => 'John Doe'
],
[
'email' => 'user2@example.com',
'name' => 'Jane Smith'
]
],
'subject' => 'Important Update',
'html' => '<html><body><h1>Update</h1><p>Important information...</p></body></html>',
'text' => 'Update: Important information...',
'name' => 'Monthly Newsletter - November 2024',
'metadata' => [
'campaign' => 'november-newsletter'
]
]),
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.sapt.ai/emails/bulk"
payload := strings.NewReader("{\n \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\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.sapt.ai/emails/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/emails/bulk")
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 \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"bulkSendId": "<string>",
"status": "<string>",
"totalRecipients": 123
}{
"message": "<string>",
"code": "<string>"
}Emails
Send bulk email (batch send to multiple recipients)
Queue a bulk email send to multiple recipients. The email will be processed in the background and sent to all recipients with the same content. All sends are tracked individually in the email log.
POST
/
emails
/
bulk
Send bulk email (batch send to multiple recipients)
curl --request POST \
--url https://api.sapt.ai/emails/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipients": [
{
"email": "user1@example.com",
"name": "John Doe"
},
{
"email": "user2@example.com",
"name": "Jane Smith"
}
],
"subject": "Important Update",
"html": "<html><body><h1>Update</h1><p>Important information...</p></body></html>",
"text": "Update: Important information...",
"name": "Monthly Newsletter - November 2024",
"metadata": {
"campaign": "november-newsletter"
}
}
'import requests
url = "https://api.sapt.ai/emails/bulk"
payload = {
"recipients": [
{
"email": "user1@example.com",
"name": "John Doe"
},
{
"email": "user2@example.com",
"name": "Jane Smith"
}
],
"subject": "Important Update",
"html": "<html><body><h1>Update</h1><p>Important information...</p></body></html>",
"text": "Update: Important information...",
"name": "Monthly Newsletter - November 2024",
"metadata": { "campaign": "november-newsletter" }
}
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({
recipients: [
{email: 'user1@example.com', name: 'John Doe'},
{email: 'user2@example.com', name: 'Jane Smith'}
],
subject: 'Important Update',
html: '<html><body><h1>Update</h1><p>Important information...</p></body></html>',
text: 'Update: Important information...',
name: 'Monthly Newsletter - November 2024',
metadata: {campaign: 'november-newsletter'}
})
};
fetch('https://api.sapt.ai/emails/bulk', 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.sapt.ai/emails/bulk",
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([
'recipients' => [
[
'email' => 'user1@example.com',
'name' => 'John Doe'
],
[
'email' => 'user2@example.com',
'name' => 'Jane Smith'
]
],
'subject' => 'Important Update',
'html' => '<html><body><h1>Update</h1><p>Important information...</p></body></html>',
'text' => 'Update: Important information...',
'name' => 'Monthly Newsletter - November 2024',
'metadata' => [
'campaign' => 'november-newsletter'
]
]),
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.sapt.ai/emails/bulk"
payload := strings.NewReader("{\n \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\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.sapt.ai/emails/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/emails/bulk")
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 \"recipients\": [\n {\n \"email\": \"user1@example.com\",\n \"name\": \"John Doe\"\n },\n {\n \"email\": \"user2@example.com\",\n \"name\": \"Jane Smith\"\n }\n ],\n \"subject\": \"Important Update\",\n \"html\": \"<html><body><h1>Update</h1><p>Important information...</p></body></html>\",\n \"text\": \"Update: Important information...\",\n \"name\": \"Monthly Newsletter - November 2024\",\n \"metadata\": {\n \"campaign\": \"november-newsletter\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"bulkSendId": "<string>",
"status": "<string>",
"totalRecipients": 123
}{
"message": "<string>",
"code": "<string>"
}Authorizations
JWT token obtained from /api/auth/token endpoint. Token is verified using JWKS and must include a valid user identifier.
Body
application/json
List of recipients (1-10,000)
Required array length:
1 - 10000 elementsShow child attributes
Show child attributes
Example:
[
{
"email": "user1@example.com",
"name": "John Doe"
},
{
"email": "user2@example.com",
"name": "Jane Smith"
}
]
Email subject line
Required string length:
1 - 200Example:
"Important Update"
HTML email content (max 500KB)
Required string length:
1 - 500000Example:
"<html><body><h1>Update</h1><p>Important information...</p></body></html>"
Plain text fallback (optional)
Maximum string length:
100000Example:
"Update: Important information..."
Optional description/name for this bulk send
Maximum string length:
200Example:
"Monthly Newsletter - November 2024"
Additional metadata
Show child attributes
Show child attributes
Example:
{ "campaign": "november-newsletter" }