Send email using template
curl --request POST \
--url https://api.sendx.io/api/v1/rest/send/template \
--header 'Content-Type: application/json' \
--header 'X-Team-ApiKey: <api-key>' \
--data '
{
"from": {
"email": "from@example.com",
"name": "From Name"
},
"to": [
{
"email": "to@example.com",
"name": "To Name",
"customFields": {}
}
],
"subject": "Your Subject Here",
"template": "template_f3lJvTEhSjKGVb5Lwc5SWS"
}
'import requests
url = "https://api.sendx.io/api/v1/rest/send/template"
payload = {
"from": {
"email": "from@example.com",
"name": "From Name"
},
"to": [
{
"email": "to@example.com",
"name": "To Name",
"customFields": {}
}
],
"subject": "Your Subject Here",
"template": "template_f3lJvTEhSjKGVb5Lwc5SWS"
}
headers = {
"X-Team-ApiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Team-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {email: 'from@example.com', name: 'From Name'},
to: [{email: 'to@example.com', name: 'To Name', customFields: {}}],
subject: 'Your Subject Here',
template: 'template_f3lJvTEhSjKGVb5Lwc5SWS'
})
};
fetch('https://api.sendx.io/api/v1/rest/send/template', 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.sendx.io/api/v1/rest/send/template",
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' => [
'email' => 'from@example.com',
'name' => 'From Name'
],
'to' => [
[
'email' => 'to@example.com',
'name' => 'To Name',
'customFields' => [
]
]
],
'subject' => 'Your Subject Here',
'template' => 'template_f3lJvTEhSjKGVb5Lwc5SWS'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Team-ApiKey: <api-key>"
],
]);
$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.sendx.io/api/v1/rest/send/template"
payload := strings.NewReader("{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Team-ApiKey", "<api-key>")
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.sendx.io/api/v1/rest/send/template")
.header("X-Team-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendx.io/api/v1/rest/send/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Team-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Email queued for delivery"
}Email Sending
Send email using template
Sends emails using a pre-defined template with variable substitution. Per-recipient personalization runs in the worker and is not validated in the API.
The API validates the request synchronously and returns 202 Accepted when the email is queued. Actual sending and personalization happen asynchronously in a worker. A 202 does not guarantee delivery; it means the request was accepted and queued. Per-recipient success/failure is not returned in the API response.
Optional headers: List-Unsubscribe (passed through for list-unsubscribe), X-SendPost-Mock-Email: true (mock send, if supported).
POST
/
send
/
template
Send email using template
curl --request POST \
--url https://api.sendx.io/api/v1/rest/send/template \
--header 'Content-Type: application/json' \
--header 'X-Team-ApiKey: <api-key>' \
--data '
{
"from": {
"email": "from@example.com",
"name": "From Name"
},
"to": [
{
"email": "to@example.com",
"name": "To Name",
"customFields": {}
}
],
"subject": "Your Subject Here",
"template": "template_f3lJvTEhSjKGVb5Lwc5SWS"
}
'import requests
url = "https://api.sendx.io/api/v1/rest/send/template"
payload = {
"from": {
"email": "from@example.com",
"name": "From Name"
},
"to": [
{
"email": "to@example.com",
"name": "To Name",
"customFields": {}
}
],
"subject": "Your Subject Here",
"template": "template_f3lJvTEhSjKGVb5Lwc5SWS"
}
headers = {
"X-Team-ApiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Team-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {email: 'from@example.com', name: 'From Name'},
to: [{email: 'to@example.com', name: 'To Name', customFields: {}}],
subject: 'Your Subject Here',
template: 'template_f3lJvTEhSjKGVb5Lwc5SWS'
})
};
fetch('https://api.sendx.io/api/v1/rest/send/template', 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.sendx.io/api/v1/rest/send/template",
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' => [
'email' => 'from@example.com',
'name' => 'From Name'
],
'to' => [
[
'email' => 'to@example.com',
'name' => 'To Name',
'customFields' => [
]
]
],
'subject' => 'Your Subject Here',
'template' => 'template_f3lJvTEhSjKGVb5Lwc5SWS'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Team-ApiKey: <api-key>"
],
]);
$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.sendx.io/api/v1/rest/send/template"
payload := strings.NewReader("{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Team-ApiKey", "<api-key>")
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.sendx.io/api/v1/rest/send/template")
.header("X-Team-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendx.io/api/v1/rest/send/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Team-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"email\": \"from@example.com\",\n \"name\": \"From Name\"\n },\n \"to\": [\n {\n \"email\": \"to@example.com\",\n \"name\": \"To Name\",\n \"customFields\": {}\n }\n ],\n \"subject\": \"Your Subject Here\",\n \"template\": \"template_f3lJvTEhSjKGVb5Lwc5SWS\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Email queued for delivery"
}🎯 Key Features:
- Use saved email templates
- Variable substitution
- Multiple recipients support
- Tracking and analytics
Authorizations
Team API key for authentication. Find your API key in SendX Settings → Team API Key.
Example:
X-Team-ApiKey: your_team_api_key_here
Body
application/json
Was this page helpful?
⌘I