Campaigns
Generate Section Options
Generate alternative versions of selected sections of an email or variation
POST
/
api
/
v1
/
campaigns
/
{campaignId}
/
variations
/
section-options
Generate Section Options
curl --request POST \
--url https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sectionIds": [
"<string>"
],
"prompt": "<string>",
"variationId": "<string>",
"count": 123,
"style": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options"
payload = {
"sectionIds": ["<string>"],
"prompt": "<string>",
"variationId": "<string>",
"count": 123,
"style": "<string>"
}
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({
sectionIds: ['<string>'],
prompt: '<string>',
variationId: '<string>',
count: 123,
style: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options', 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/campaigns/{campaignId}/variations/section-options",
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([
'sectionIds' => [
'<string>'
],
'prompt' => '<string>',
'variationId' => '<string>',
'count' => 123,
'style' => '<string>'
]),
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/campaigns/{campaignId}/variations/section-options"
payload := strings.NewReader("{\n \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\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/campaigns/{campaignId}/variations/section-options")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options")
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 \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"options": [
{
"name": "Shorter headline",
"summary": "Cut the headline to five words.",
"replacements": [
{ "id": "h1", "type": "heading", "content": "Pricing, simplified", "level": 1 }
]
}
]
}
{
"error": "These sectionIds are not top-level blocks of the variation: h9"
}
{
"error": "Invalid API key"
}
{
"error": "Variation not found"
}
{
"error": "This variation has no content yet"
}
{
"error": "Couldn't make options for these sections. Try again."
}
Generates 1 to 4 alternative versions of selected sections (top-level blocks) of the email or of one variation. Nothing is saved: each option holds replacement blocks that keep the selected blocks’ ids. To apply an option, swap those blocks into the variation’s
blocks by id and call Update Variation.
Changes the AI makes outside the selected sections are dropped, and options that change nothing are left out, so you can get fewer options than count. If none change anything, you get a 400 with the AI’s explanation. Emails that are a single raw HTML block can’t be varied by section. The request runs synchronously and can take up to a minute; a 500 means generation failed and can be retried.
Request
string
required
Campaign ID. Email campaigns only.
string[]
required
Ids of top-level blocks to vary, 1 to 50.
string
required
What should change, in any language. Up to 2,000 characters.
string
Vary this variation’s sections. It must be
ready. Omit to vary the email’s
saved content.integer
default:"3"
How many options to generate, from 1 to 4.
string
How far the options move from the selected sections:
close keeps its style and
structure, fresh takes clearly different directions, and bold designs each
option anew with its own layout, colors and fonts (a theme of its own).
Defaults to fresh.curl -X POST "https://api.sequenzy.com/api/v1/campaigns/camp_abc123/variations/section-options" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "variationId": "var_9xk2", "sectionIds": ["h1"], "prompt": "Punchier headline" }'
Response
array
{
"success": true,
"options": [
{
"name": "Shorter headline",
"summary": "Cut the headline to five words.",
"replacements": [
{ "id": "h1", "type": "heading", "content": "Pricing, simplified", "level": 1 }
]
}
]
}
{
"error": "These sectionIds are not top-level blocks of the variation: h9"
}
{
"error": "Invalid API key"
}
{
"error": "Variation not found"
}
{
"error": "This variation has no content yet"
}
{
"error": "Couldn't make options for these sections. Try again."
}
⌘I
Generate Section Options
curl --request POST \
--url https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sectionIds": [
"<string>"
],
"prompt": "<string>",
"variationId": "<string>",
"count": 123,
"style": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options"
payload = {
"sectionIds": ["<string>"],
"prompt": "<string>",
"variationId": "<string>",
"count": 123,
"style": "<string>"
}
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({
sectionIds: ['<string>'],
prompt: '<string>',
variationId: '<string>',
count: 123,
style: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options', 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/campaigns/{campaignId}/variations/section-options",
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([
'sectionIds' => [
'<string>'
],
'prompt' => '<string>',
'variationId' => '<string>',
'count' => 123,
'style' => '<string>'
]),
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/campaigns/{campaignId}/variations/section-options"
payload := strings.NewReader("{\n \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\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/campaigns/{campaignId}/variations/section-options")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options")
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 \"sectionIds\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"variationId\": \"<string>\",\n \"count\": 123,\n \"style\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"options": [
{
"name": "Shorter headline",
"summary": "Cut the headline to five words.",
"replacements": [
{ "id": "h1", "type": "heading", "content": "Pricing, simplified", "level": 1 }
]
}
]
}
{
"error": "These sectionIds are not top-level blocks of the variation: h9"
}
{
"error": "Invalid API key"
}
{
"error": "Variation not found"
}
{
"error": "This variation has no content yet"
}
{
"error": "Couldn't make options for these sections. Try again."
}