Templates
Create Template
Create an email template
POST
/
api
/
v1
/
templates
Create Template
curl --request POST \
--url https://api.sequenzy.com/api/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"subject": "<string>",
"previewText": "<string>",
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"html": "<string>",
"blocks": [
{}
],
"labels": [
{}
]
}
'import requests
url = "https://api.sequenzy.com/api/v1/templates"
payload = {
"name": "<string>",
"subject": "<string>",
"previewText": "<string>",
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"html": "<string>",
"blocks": [{}],
"labels": [{}]
}
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({
name: '<string>',
subject: '<string>',
previewText: '<string>',
prompt: '<string>',
style: '<string>',
tone: '<string>',
html: '<string>',
blocks: [{}],
labels: [{}]
})
};
fetch('https://api.sequenzy.com/api/v1/templates', 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.sequenzy.com/api/v1/templates",
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([
'name' => '<string>',
'subject' => '<string>',
'previewText' => '<string>',
'prompt' => '<string>',
'style' => '<string>',
'tone' => '<string>',
'html' => '<string>',
'blocks' => [
[
]
],
'labels' => [
[
]
]
]),
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.sequenzy.com/api/v1/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\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.sequenzy.com/api/v1/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/templates")
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 \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"template": {
"id": "email_abc123",
"name": "[Template] Welcome",
"subject": "Welcome!",
"labels": ["edm"]
}
}
{
"success": false,
"error": "Provide exactly one of prompt, html, or blocks."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Failed to create template"
}
Create a reusable email template with exactly one content source:
prompt for Sequenzy-generated branded native blocks, blocks for finished caller-supplied content, or html for preserved/imported markup. style and tone are valid only with prompt; subject and preview values may override generated values.
Request
string
required
Template name. Sequenzy stores API-created templates with a
[Template]
prefix.string
Email subject line. Required with
html or blocks; optional with prompt,
where it overrides the generated subject.string
Optional inbox preview override. With
prompt, the generated preview is used
when this field is omitted.string
Natural-language request for Sequenzy to generate branded native template
blocks. Use this instead of
html or blocks.string
Optional generation style. Valid only with
prompt.string
Optional generation tone. Valid only with
prompt.string
Raw HTML body. Use this or
blocks, not both.array
Sequenzy email blocks. Use this or
html, not both. Put block styling under
styles; top-level style keys like backgroundColor, backgroundOpacity,
borderColor, borderWidth, and borderRadius are normalized into styles.array
Label names to assign to the template. Missing labels are created
automatically. The API also accepts
label as a compatibility alias.curl -X POST "https://api.sequenzy.com/api/v1/templates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome",
"prompt": "Welcome new customers and explain the next steps",
"tone": "friendly"
}'
curl -X POST "https://api.sequenzy.com/api/v1/templates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome",
"subject": "Welcome!",
"labels": ["edm"],
"html": "<p>Thanks for joining.</p>"
}'
Responses
{
"success": true,
"template": {
"id": "email_abc123",
"name": "[Template] Welcome",
"subject": "Welcome!",
"labels": ["edm"]
}
}
{
"success": false,
"error": "Provide exactly one of prompt, html, or blocks."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Failed to create template"
}
⌘I
Create Template
curl --request POST \
--url https://api.sequenzy.com/api/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"subject": "<string>",
"previewText": "<string>",
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"html": "<string>",
"blocks": [
{}
],
"labels": [
{}
]
}
'import requests
url = "https://api.sequenzy.com/api/v1/templates"
payload = {
"name": "<string>",
"subject": "<string>",
"previewText": "<string>",
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"html": "<string>",
"blocks": [{}],
"labels": [{}]
}
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({
name: '<string>',
subject: '<string>',
previewText: '<string>',
prompt: '<string>',
style: '<string>',
tone: '<string>',
html: '<string>',
blocks: [{}],
labels: [{}]
})
};
fetch('https://api.sequenzy.com/api/v1/templates', 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.sequenzy.com/api/v1/templates",
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([
'name' => '<string>',
'subject' => '<string>',
'previewText' => '<string>',
'prompt' => '<string>',
'style' => '<string>',
'tone' => '<string>',
'html' => '<string>',
'blocks' => [
[
]
],
'labels' => [
[
]
]
]),
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.sequenzy.com/api/v1/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\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.sequenzy.com/api/v1/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/templates")
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 \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"html\": \"<string>\",\n \"blocks\": [\n {}\n ],\n \"labels\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"template": {
"id": "email_abc123",
"name": "[Template] Welcome",
"subject": "Welcome!",
"labels": ["edm"]
}
}
{
"success": false,
"error": "Provide exactly one of prompt, html, or blocks."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Failed to create template"
}