Send email
curl --request POST \
--url https://api.thepurplebox.io/v1/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"body": "<string>",
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"username": "<string>",
"reply_to": "<string>",
"headers": {},
"attachments": [
{}
]
}
'import requests
url = "https://api.thepurplebox.io/v1/send"
payload = {
"from": "<string>",
"to": ["<string>"],
"subject": "<string>",
"body": "<string>",
"cc": ["<string>"],
"bcc": ["<string>"],
"username": "<string>",
"reply_to": "<string>",
"headers": {},
"attachments": [{}]
}
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>',
body: JSON.stringify('<string>'),
cc: ['<string>'],
bcc: ['<string>'],
username: '<string>',
reply_to: '<string>',
headers: {},
attachments: [{}]
})
};
fetch('https://api.thepurplebox.io/v1/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.thepurplebox.io/v1/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([
'from' => '<string>',
'to' => [
'<string>'
],
'subject' => '<string>',
'body' => '<string>',
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'username' => '<string>',
'reply_to' => '<string>',
'headers' => [
],
'attachments' => [
[
]
]
]),
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.thepurplebox.io/v1/send"
payload := strings.NewReader("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\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.thepurplebox.io/v1/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thepurplebox.io/v1/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 \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"message": "250 OK queued as 12345",
"email_id": "12345"
},
],
"timestamp": "1970-01-01T00:00:00.000Z"
}
Transactional
Send email
Send emails with a single API call.
POST
/
v1
/
send
Send email
curl --request POST \
--url https://api.thepurplebox.io/v1/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"body": "<string>",
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"username": "<string>",
"reply_to": "<string>",
"headers": {},
"attachments": [
{}
]
}
'import requests
url = "https://api.thepurplebox.io/v1/send"
payload = {
"from": "<string>",
"to": ["<string>"],
"subject": "<string>",
"body": "<string>",
"cc": ["<string>"],
"bcc": ["<string>"],
"username": "<string>",
"reply_to": "<string>",
"headers": {},
"attachments": [{}]
}
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>',
body: JSON.stringify('<string>'),
cc: ['<string>'],
bcc: ['<string>'],
username: '<string>',
reply_to: '<string>',
headers: {},
attachments: [{}]
})
};
fetch('https://api.thepurplebox.io/v1/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.thepurplebox.io/v1/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([
'from' => '<string>',
'to' => [
'<string>'
],
'subject' => '<string>',
'body' => '<string>',
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'username' => '<string>',
'reply_to' => '<string>',
'headers' => [
],
'attachments' => [
[
]
]
]),
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.thepurplebox.io/v1/send"
payload := strings.NewReader("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\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.thepurplebox.io/v1/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.thepurplebox.io/v1/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 \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"username\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"headers\": {},\n \"attachments\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"message": "250 OK queued as 12345",
"email_id": "12345"
},
],
"timestamp": "1970-01-01T00:00:00.000Z"
}
Headers
string
application/jsonBody
string
required
Your verified sender email address.Using
username <email> format is also supported.string[]
required
A single email address or an array of email addresses.
string
required
The subject of the email.
string
required
The body of the email.
string[]
Carbon copy recipients. A single email address or an array of email addresses.
string[]
Blind carbon copy recipients. A single email address or an array of email addresses.
string
Optional: The name to display as the sender.
string
Override the reply_to address. Defaults to the from address or your verified email if the from address is not set.
object
Additional headers to include in the email.
array
Up to 5 file attachments
Response
boolean
Indicates whether the call was successful.
datetime
The timestamp of the event.
{
"success": true,
"data": [
{
"message": "250 OK queued as 12345",
"email_id": "12345"
},
],
"timestamp": "1970-01-01T00:00:00.000Z"
}
⌘I