Emails
Send Email
Send an email to one or more recipients.
POST
/
emails
Send Email
curl --request POST \
--url https://api.unosend.co/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"template_id": "<string>",
"template_data": {},
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"reply_to": "<string>",
"priority": "<string>",
"attachments": [
{}
],
"headers": {},
"tags": [
{}
],
"scheduled_for": "<string>",
"tracking": {
"tracking.open": true,
"tracking.click": true
}
}
'import requests
url = "https://api.unosend.co/emails"
payload = {
"from": "<string>",
"to": ["<string>"],
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"template_id": "<string>",
"template_data": {},
"cc": ["<string>"],
"bcc": ["<string>"],
"reply_to": "<string>",
"priority": "<string>",
"attachments": [{}],
"headers": {},
"tags": [{}],
"scheduled_for": "<string>",
"tracking": {
"tracking.open": True,
"tracking.click": True
}
}
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({
from: '<string>',
to: ['<string>'],
subject: '<string>',
html: '<string>',
text: '<string>',
template_id: '<string>',
template_data: {},
cc: ['<string>'],
bcc: ['<string>'],
reply_to: '<string>',
priority: '<string>',
attachments: [{}],
headers: {},
tags: [{}],
scheduled_for: '<string>',
tracking: {'tracking.open': true, 'tracking.click': true}
})
};
fetch('https://api.unosend.co/emails', 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",
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([
'from' => '<string>',
'to' => [
'<string>'
],
'subject' => '<string>',
'html' => '<string>',
'text' => '<string>',
'template_id' => '<string>',
'template_data' => [
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'reply_to' => '<string>',
'priority' => '<string>',
'attachments' => [
[
]
],
'headers' => [
],
'tags' => [
[
]
],
'scheduled_for' => '<string>',
'tracking' => [
'tracking.open' => true,
'tracking.click' => true
]
]),
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"
payload := strings.NewReader("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unosend.co/emails")
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 \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\n }\n}"
response = http.request(request)
puts response.read_bodySender email address. Must be from a verified domain. Can include a name:
"John Doe <john@yourdomain.com>".Recipient email address(es).
Email subject line.
HTML content of the email. Required unless
text or template_id is provided.Plain text content of the email.
UUID of a saved template to use. If provided, the template’s content will be used.
Variables to replace in the template. Example:
{"first_name": "John", "order_id": "12345"}.CC recipient(s).
BCC recipient(s).
Reply-to email address.
Email priority:
high (OTP/transactional, fastest delivery), normal (default), or low (bulk/marketing).Array of attachments. Each attachment has
filename, content (base64), and content_type.Custom email headers.
Custom tags for analytics. Each tag has
name and value.ISO 8601 datetime for scheduled sending.
Request
curl -X POST https://api.unosend.co/emails \
-H "Authorization: Bearer un_xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"subject": "Hello World",
"html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
"tracking": {
"open": true,
"click": false
}
}'
await fetch('https://api.unosend.co/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer un_xxxxxxxxxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: 'hello@yourdomain.com',
to: ['user@example.com'],
subject: 'Hello World',
html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
tracking: {
open: true,
click: false
}
})
});
import requests
requests.post('https://api.unosend.co/emails',
headers={'Authorization': 'Bearer un_xxxxxxxxxx'},
json={
'from': 'hello@yourdomain.com',
'to': ['user@example.com'],
'subject': 'Hello World',
'html': '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
'tracking': {
'open': True,
'click': False
}
}
)
payload := map[string]interface{}{
"from": "hello@yourdomain.com",
"to": []string{"user@example.com"},
"subject": "Hello World",
"html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
"tracking": map[string]bool{
"open": true,
"click": false,
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.unosend.co/emails", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer un_xxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
$ch = curl_init('https://api.unosend.co/emails');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer un_xxxxxxxxxx', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'from' => 'hello@yourdomain.com',
'to' => ['user@example.com'],
'subject' => 'Hello World',
'html' => '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
'tracking' => [
'open' => true,
'click' => false
]
])
]);
curl_exec($ch);
require 'net/http'
require 'json'
uri = URI('https://api.unosend.co/emails')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer un_xxxxxxxxxx'
request['Content-Type'] = 'application/json'
request.body = {
from: 'hello@yourdomain.com',
to: ['user@example.com'],
subject: 'Hello World',
html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>'
}.to_json
http.request(request)
Response
200
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"status": "queued",
"created_at": "2024-01-15T10:30:00.000Z"
}
}
⌘I
Send Email
curl --request POST \
--url https://api.unosend.co/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"template_id": "<string>",
"template_data": {},
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"reply_to": "<string>",
"priority": "<string>",
"attachments": [
{}
],
"headers": {},
"tags": [
{}
],
"scheduled_for": "<string>",
"tracking": {
"tracking.open": true,
"tracking.click": true
}
}
'import requests
url = "https://api.unosend.co/emails"
payload = {
"from": "<string>",
"to": ["<string>"],
"subject": "<string>",
"html": "<string>",
"text": "<string>",
"template_id": "<string>",
"template_data": {},
"cc": ["<string>"],
"bcc": ["<string>"],
"reply_to": "<string>",
"priority": "<string>",
"attachments": [{}],
"headers": {},
"tags": [{}],
"scheduled_for": "<string>",
"tracking": {
"tracking.open": True,
"tracking.click": True
}
}
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({
from: '<string>',
to: ['<string>'],
subject: '<string>',
html: '<string>',
text: '<string>',
template_id: '<string>',
template_data: {},
cc: ['<string>'],
bcc: ['<string>'],
reply_to: '<string>',
priority: '<string>',
attachments: [{}],
headers: {},
tags: [{}],
scheduled_for: '<string>',
tracking: {'tracking.open': true, 'tracking.click': true}
})
};
fetch('https://api.unosend.co/emails', 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",
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([
'from' => '<string>',
'to' => [
'<string>'
],
'subject' => '<string>',
'html' => '<string>',
'text' => '<string>',
'template_id' => '<string>',
'template_data' => [
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'reply_to' => '<string>',
'priority' => '<string>',
'attachments' => [
[
]
],
'headers' => [
],
'tags' => [
[
]
],
'scheduled_for' => '<string>',
'tracking' => [
'tracking.open' => true,
'tracking.click' => true
]
]),
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"
payload := strings.NewReader("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unosend.co/emails")
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 \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"html\": \"<string>\",\n \"text\": \"<string>\",\n \"template_id\": \"<string>\",\n \"template_data\": {},\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"reply_to\": \"<string>\",\n \"priority\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"headers\": {},\n \"tags\": [\n {}\n ],\n \"scheduled_for\": \"<string>\",\n \"tracking\": {\n \"tracking.open\": true,\n \"tracking.click\": true\n }\n}"
response = http.request(request)
puts response.read_body