Create an email
curl --request POST \
--url https://api.tented.ai/v1/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"template_id": "<string>",
"token_data": {},
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<string>"
}
'import requests
url = "https://api.tented.ai/v1/emails"
payload = {
"name": "<string>",
"prompt": "<string>",
"template_id": "<string>",
"token_data": {},
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<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({
name: '<string>',
prompt: '<string>',
template_id: '<string>',
token_data: {},
subject: '<string>',
preview_text: '<string>',
from_name: '<string>',
from_address: '<string>',
reply_to_email: '<string>'
})
};
fetch('https://api.tented.ai/v1/emails', 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.tented.ai/v1/emails",
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>',
'prompt' => '<string>',
'template_id' => '<string>',
'token_data' => [
],
'subject' => '<string>',
'preview_text' => '<string>',
'from_name' => '<string>',
'from_address' => '<string>',
'reply_to_email' => '<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.tented.ai/v1/emails"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<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.tented.ai/v1/emails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tented.ai/v1/emails")
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 \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"email_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"current_version": 123,
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<string>",
"approved_version": 123,
"number_of_iterations": 123,
"plain_text_overridden": true,
"plain_text_overridden_at": "2023-11-07T05:31:56Z",
"plain_text_stale_after_html_iteration": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_name": "<string>",
"latest_generation_status": "generating",
"content_path": "<string>",
"plain_text_path": "<string>"
}{
"email_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"generation_id": "<string>",
"status": "<string>",
"message_id": "<string>"
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}Emails
Create an email
Create an email. With a prompt, AI generation starts asynchronously (202 — poll the returned generation). Without a prompt you get a blank draft (201), optionally seeded from an approved email template via template_id. Emails are reusable content assets: approve one, then attach it to blasts and flows.
POST
/
v1
/
emails
Create an email
curl --request POST \
--url https://api.tented.ai/v1/emails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"template_id": "<string>",
"token_data": {},
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<string>"
}
'import requests
url = "https://api.tented.ai/v1/emails"
payload = {
"name": "<string>",
"prompt": "<string>",
"template_id": "<string>",
"token_data": {},
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<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({
name: '<string>',
prompt: '<string>',
template_id: '<string>',
token_data: {},
subject: '<string>',
preview_text: '<string>',
from_name: '<string>',
from_address: '<string>',
reply_to_email: '<string>'
})
};
fetch('https://api.tented.ai/v1/emails', 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.tented.ai/v1/emails",
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>',
'prompt' => '<string>',
'template_id' => '<string>',
'token_data' => [
],
'subject' => '<string>',
'preview_text' => '<string>',
'from_name' => '<string>',
'from_address' => '<string>',
'reply_to_email' => '<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.tented.ai/v1/emails"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<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.tented.ai/v1/emails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tented.ai/v1/emails")
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 \"prompt\": \"<string>\",\n \"template_id\": \"<string>\",\n \"token_data\": {},\n \"subject\": \"<string>\",\n \"preview_text\": \"<string>\",\n \"from_name\": \"<string>\",\n \"from_address\": \"<string>\",\n \"reply_to_email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"email_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"current_version": 123,
"subject": "<string>",
"preview_text": "<string>",
"from_name": "<string>",
"from_address": "<string>",
"reply_to_email": "<string>",
"approved_version": 123,
"number_of_iterations": 123,
"plain_text_overridden": true,
"plain_text_overridden_at": "2023-11-07T05:31:56Z",
"plain_text_stale_after_html_iteration": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_name": "<string>",
"latest_generation_status": "generating",
"content_path": "<string>",
"plain_text_path": "<string>"
}{
"email_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"generation_id": "<string>",
"status": "<string>",
"message_id": "<string>"
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}{
"error": "<string>",
"error_code": "<string>",
"message": "<string>",
"code": "<string>",
"details": {},
"limit": 123,
"current": 123
}Authorizations
Headers
Body
application/json
Response
Draft created (no prompt supplied).
Full email object.