Send Email Template
curl --request POST \
--url https://api-ai.zixflow.com/api/ingest/email/v1/template/send \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--data '
{
"recipient": "<string>",
"template_name": "<string>",
"variables": {},
"from_email": "<string>",
"from_name": "<string>",
"subject": "<string>",
"pre_header": "<string>",
"reply_to_email": "<string>",
"reply_to_name": "<string>",
"attachments": [
{}
],
"track_opens": true,
"track_clicks": true,
"post_back_url": "<string>",
"post_back_data": "<string>"
}
'import requests
url = "https://api-ai.zixflow.com/api/ingest/email/v1/template/send"
payload = {
"recipient": "<string>",
"template_name": "<string>",
"variables": {},
"from_email": "<string>",
"from_name": "<string>",
"subject": "<string>",
"pre_header": "<string>",
"reply_to_email": "<string>",
"reply_to_name": "<string>",
"attachments": [{}],
"track_opens": True,
"track_clicks": True,
"post_back_url": "<string>",
"post_back_data": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-id": "<x-workspace-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-workspace-id': '<x-workspace-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: '<string>',
template_name: '<string>',
variables: {},
from_email: '<string>',
from_name: '<string>',
subject: '<string>',
pre_header: '<string>',
reply_to_email: '<string>',
reply_to_name: '<string>',
attachments: [{}],
track_opens: true,
track_clicks: true,
post_back_url: '<string>',
post_back_data: '<string>'
})
};
fetch('https://api-ai.zixflow.com/api/ingest/email/v1/template/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-ai.zixflow.com/api/ingest/email/v1/template/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([
'recipient' => '<string>',
'template_name' => '<string>',
'variables' => [
],
'from_email' => '<string>',
'from_name' => '<string>',
'subject' => '<string>',
'pre_header' => '<string>',
'reply_to_email' => '<string>',
'reply_to_name' => '<string>',
'attachments' => [
[
]
],
'track_opens' => true,
'track_clicks' => true,
'post_back_url' => '<string>',
'post_back_data' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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-ai.zixflow.com/api/ingest/email/v1/template/send"
payload := strings.NewReader("{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
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-ai.zixflow.com/api/ingest/email/v1/template/send")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.zixflow.com/api/ingest/email/v1/template/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Email request queued successfully",
"request_id": "f8df74d1-11fa-4485-b164-b9a65358f4fc"
}
{
"success": false,
"message": "Invalid template or missing variables"
}
{
"success": false,
"message": "Unauthorised"
}
Email
Send Email Template
Send an email using a predefined template
POST
/
api
/
ingest
/
email
/
v1
/
template
/
send
Send Email Template
curl --request POST \
--url https://api-ai.zixflow.com/api/ingest/email/v1/template/send \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--data '
{
"recipient": "<string>",
"template_name": "<string>",
"variables": {},
"from_email": "<string>",
"from_name": "<string>",
"subject": "<string>",
"pre_header": "<string>",
"reply_to_email": "<string>",
"reply_to_name": "<string>",
"attachments": [
{}
],
"track_opens": true,
"track_clicks": true,
"post_back_url": "<string>",
"post_back_data": "<string>"
}
'import requests
url = "https://api-ai.zixflow.com/api/ingest/email/v1/template/send"
payload = {
"recipient": "<string>",
"template_name": "<string>",
"variables": {},
"from_email": "<string>",
"from_name": "<string>",
"subject": "<string>",
"pre_header": "<string>",
"reply_to_email": "<string>",
"reply_to_name": "<string>",
"attachments": [{}],
"track_opens": True,
"track_clicks": True,
"post_back_url": "<string>",
"post_back_data": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-id": "<x-workspace-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-workspace-id': '<x-workspace-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: '<string>',
template_name: '<string>',
variables: {},
from_email: '<string>',
from_name: '<string>',
subject: '<string>',
pre_header: '<string>',
reply_to_email: '<string>',
reply_to_name: '<string>',
attachments: [{}],
track_opens: true,
track_clicks: true,
post_back_url: '<string>',
post_back_data: '<string>'
})
};
fetch('https://api-ai.zixflow.com/api/ingest/email/v1/template/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-ai.zixflow.com/api/ingest/email/v1/template/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([
'recipient' => '<string>',
'template_name' => '<string>',
'variables' => [
],
'from_email' => '<string>',
'from_name' => '<string>',
'subject' => '<string>',
'pre_header' => '<string>',
'reply_to_email' => '<string>',
'reply_to_name' => '<string>',
'attachments' => [
[
]
],
'track_opens' => true,
'track_clicks' => true,
'post_back_url' => '<string>',
'post_back_data' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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-ai.zixflow.com/api/ingest/email/v1/template/send"
payload := strings.NewReader("{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
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-ai.zixflow.com/api/ingest/email/v1/template/send")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.zixflow.com/api/ingest/email/v1/template/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": \"<string>\",\n \"template_name\": \"<string>\",\n \"variables\": {},\n \"from_email\": \"<string>\",\n \"from_name\": \"<string>\",\n \"subject\": \"<string>\",\n \"pre_header\": \"<string>\",\n \"reply_to_email\": \"<string>\",\n \"reply_to_name\": \"<string>\",\n \"attachments\": [\n {}\n ],\n \"track_opens\": true,\n \"track_clicks\": true,\n \"post_back_url\": \"<string>\",\n \"post_back_data\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Email request queued successfully",
"request_id": "f8df74d1-11fa-4485-b164-b9a65358f4fc"
}
{
"success": false,
"message": "Invalid template or missing variables"
}
{
"success": false,
"message": "Unauthorised"
}
Description
This endpoint allows you to send an email using a predefined template. Templates can include variables that are replaced with actual values when the email is sent.Headers
Body
Key-value pairs for template variables. Keys should match the variable names in the template, and values will replace the placeholders.
(Optional) To receive post-back notifications about the sent message as it is delivered or failed. When a message status changes (delivered, failed, etc.), a notification will be sent to this URL. See Postback Notifications for the payload format and field descriptions.
(Optional) The data that will be sent back on the post_back_url with the notification. This can be used as an identifier for the sent message if the client wants to track or correlate messages with their own system. See Postback Notifications for how it appears in the notification.
Response
Indicates whether the request was successful. true if the request was accepted and queued, false otherwise.
Present only when success is true. Unique identifier for this request; use it for tracking and for correlating with postback notifications.
{
"success": true,
"message": "Email request queued successfully",
"request_id": "f8df74d1-11fa-4485-b164-b9a65358f4fc"
}
{
"success": false,
"message": "Invalid template or missing variables"
}
{
"success": false,
"message": "Unauthorised"
}