Generation
Generate Email
Generate a draft email from a natural-language prompt
POST
/
api
/
v1
/
generate
/
email
Generate Email
curl --request POST \
--url https://api.sequenzy.com/api/v1/generate/email \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"applyBranding": true,
"emailType": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/generate/email"
payload = {
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"applyBranding": True,
"emailType": "<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({
prompt: '<string>',
style: '<string>',
tone: '<string>',
applyBranding: true,
emailType: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/generate/email', 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/generate/email",
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([
'prompt' => '<string>',
'style' => '<string>',
'tone' => '<string>',
'applyBranding' => true,
'emailType' => '<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/generate/email"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<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/generate/email")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/generate/email")
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 \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"subject": "Meet your new analytics dashboard",
"previewText": "A clearer way to track what matters",
"blocks": [
{
"id": "block-logo",
"type": "logo",
"alt": "Acme Logo",
"align": "center",
"width": 64
},
{
"id": "block-heading",
"type": "heading",
"level": 1,
"content": "Meet your new analytics dashboard"
},
{
"id": "block-footer",
"type": "footer",
"variant": "full",
"companyName": "Acme",
"address": "123 Main St"
}
],
"message": "Generated a draft email."
}
{
"type": "validation",
"on": "body",
"property": "/prompt",
"message": "Expected string"
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Failed to generate email"
}
Generate Email
Generates a draft email from scratch as structured editor-compatible blocks. By default, Sequenzy wraps the generated content with your company’s email branding: branded presets include a logo and full footer, while minimal presets include a simple footer. Review the returned blocks before creating or sending a campaign.Request
string
required
What you want the email to say or accomplish.
string
Optional style guidance. Pass
designed or plain to force the designed or
plain-text email style; other values, such as minimal, branded, or
promotional, are freeform prompt guidance. Defaults to your company’s email
style preference (designed unless you chose plain text).string
Optional tone guidance, such as
professional, casual, or friendly.boolean
default:"true"
Whether to wrap the generated content with your company logo and footer. Set
this to
false to return only the AI-generated content blocks.string
default:"marketing"
Email type:
marketing or transactional. Transactional emails include a
footer without an unsubscribe link.curl -X POST "https://api.sequenzy.com/api/v1/generate/email" \
-H "Authorization: Bearer seq_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Announce our new analytics dashboard to trial users",
"style": "branded",
"tone": "friendly",
"emailType": "marketing"
}'
Responses
{
"success": true,
"subject": "Meet your new analytics dashboard",
"previewText": "A clearer way to track what matters",
"blocks": [
{
"id": "block-logo",
"type": "logo",
"alt": "Acme Logo",
"align": "center",
"width": 64
},
{
"id": "block-heading",
"type": "heading",
"level": 1,
"content": "Meet your new analytics dashboard"
},
{
"id": "block-footer",
"type": "footer",
"variant": "full",
"companyName": "Acme",
"address": "123 Main St"
}
],
"message": "Generated a draft email."
}
{
"type": "validation",
"on": "body",
"property": "/prompt",
"message": "Expected string"
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Failed to generate email"
}
⌘I
Generate Email
curl --request POST \
--url https://api.sequenzy.com/api/v1/generate/email \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"applyBranding": true,
"emailType": "<string>"
}
'import requests
url = "https://api.sequenzy.com/api/v1/generate/email"
payload = {
"prompt": "<string>",
"style": "<string>",
"tone": "<string>",
"applyBranding": True,
"emailType": "<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({
prompt: '<string>',
style: '<string>',
tone: '<string>',
applyBranding: true,
emailType: '<string>'
})
};
fetch('https://api.sequenzy.com/api/v1/generate/email', 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/generate/email",
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([
'prompt' => '<string>',
'style' => '<string>',
'tone' => '<string>',
'applyBranding' => true,
'emailType' => '<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/generate/email"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<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/generate/email")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/generate/email")
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 \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"tone\": \"<string>\",\n \"applyBranding\": true,\n \"emailType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"subject": "Meet your new analytics dashboard",
"previewText": "A clearer way to track what matters",
"blocks": [
{
"id": "block-logo",
"type": "logo",
"alt": "Acme Logo",
"align": "center",
"width": 64
},
{
"id": "block-heading",
"type": "heading",
"level": 1,
"content": "Meet your new analytics dashboard"
},
{
"id": "block-footer",
"type": "footer",
"variant": "full",
"companyName": "Acme",
"address": "123 Main St"
}
],
"message": "Generated a draft email."
}
{
"type": "validation",
"on": "body",
"property": "/prompt",
"message": "Expected string"
}
{
"error": "Invalid API key"
}
{
"error": "No companies found. Create a company first using the create_company tool."
}
{
"error": "Failed to generate email"
}