Send email via AWS SES
curl --request POST \
--url https://api.sapt.ai/emails/send/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"subject": "Welcome to our service",
"html": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>",
"text": "Hello! Welcome to our service.",
"replyTo": "[email protected]",
"metadata": {
"inquiryId": 123,
"type": "contact-inquiry"
}
}
'import requests
url = "https://api.sapt.ai/emails/send/send"
payload = {
"to": "[email protected]",
"subject": "Welcome to our service",
"html": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>",
"text": "Hello! Welcome to our service.",
"replyTo": "[email protected]",
"metadata": {
"inquiryId": 123,
"type": "contact-inquiry"
}
}
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({
to: '[email protected]',
subject: 'Welcome to our service',
html: '<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>',
text: 'Hello! Welcome to our service.',
replyTo: '[email protected]',
metadata: {inquiryId: 123, type: 'contact-inquiry'}
})
};
fetch('https://api.sapt.ai/emails/send/send', 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/send/send",
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([
'to' => '[email protected]',
'subject' => 'Welcome to our service',
'html' => '<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>',
'text' => 'Hello! Welcome to our service.',
'replyTo' => '[email protected]',
'metadata' => [
'inquiryId' => 123,
'type' => 'contact-inquiry'
]
]),
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/send/send"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\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/send/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/emails/send/send")
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 \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "<string>"
}{
"message": "<string>",
"code": "<string>"
}Emails
Send email via AWS SES
Send transactional emails with automatic tracking. All emails are tracked in the Sapt admin dashboard with delivery, open, and click tracking.
POST
/
emails
/
send
/
send
Send email via AWS SES
curl --request POST \
--url https://api.sapt.ai/emails/send/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"subject": "Welcome to our service",
"html": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>",
"text": "Hello! Welcome to our service.",
"replyTo": "[email protected]",
"metadata": {
"inquiryId": 123,
"type": "contact-inquiry"
}
}
'import requests
url = "https://api.sapt.ai/emails/send/send"
payload = {
"to": "[email protected]",
"subject": "Welcome to our service",
"html": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>",
"text": "Hello! Welcome to our service.",
"replyTo": "[email protected]",
"metadata": {
"inquiryId": 123,
"type": "contact-inquiry"
}
}
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({
to: '[email protected]',
subject: 'Welcome to our service',
html: '<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>',
text: 'Hello! Welcome to our service.',
replyTo: '[email protected]',
metadata: {inquiryId: 123, type: 'contact-inquiry'}
})
};
fetch('https://api.sapt.ai/emails/send/send', 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/send/send",
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([
'to' => '[email protected]',
'subject' => 'Welcome to our service',
'html' => '<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>',
'text' => 'Hello! Welcome to our service.',
'replyTo' => '[email protected]',
'metadata' => [
'inquiryId' => 123,
'type' => 'contact-inquiry'
]
]),
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/send/send"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\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/send/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapt.ai/emails/send/send")
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 \"to\": \"[email protected]\",\n \"subject\": \"Welcome to our service\",\n \"html\": \"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>\",\n \"text\": \"Hello! Welcome to our service.\",\n \"replyTo\": \"[email protected]\",\n \"metadata\": {\n \"inquiryId\": 123,\n \"type\": \"contact-inquiry\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageId": "<string>"
}{
"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
Recipient email address
Example:
Email subject line (max 200 characters)
Required string length:
1 - 200Example:
"Welcome to our service"
HTML email content (max 500KB)
Required string length:
1 - 500000Example:
"<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>"
Plain text fallback (max 100KB, optional)
Maximum string length:
100000Example:
"Hello! Welcome to our service."
Reply-to email address (optional)
Example:
Additional metadata for tracking (optional)
Show child attributes
Show child attributes
Example:
{
"inquiryId": 123,
"type": "contact-inquiry"
}