curl --request POST \
--url https://api.inflection.io/v1/email-versions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assetId": "6a60ee387b78bbc9a263aba0",
"email": "contact@example.com",
"subject": "A note just for you",
"preheader": "Personalized for you",
"html": "<!doctype html>…<a href=\"{{unsubscribe_url}}\">Unsubscribe</a>…",
"expiresAt": "2030-01-01T00:00:00Z"
}
'import requests
url = "https://api.inflection.io/v1/email-versions"
payload = {
"assetId": "6a60ee387b78bbc9a263aba0",
"email": "contact@example.com",
"subject": "A note just for you",
"preheader": "Personalized for you",
"html": "<!doctype html>…<a href=\"{{unsubscribe_url}}\">Unsubscribe</a>…",
"expiresAt": "2030-01-01T00:00:00Z"
}
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({
assetId: '6a60ee387b78bbc9a263aba0',
email: 'contact@example.com',
subject: 'A note just for you',
preheader: 'Personalized for you',
html: '<!doctype html>…<a href="{{unsubscribe_url}}">Unsubscribe</a>…',
expiresAt: '2030-01-01T00:00:00Z'
})
};
fetch('https://api.inflection.io/v1/email-versions', 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.inflection.io/v1/email-versions",
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([
'assetId' => '6a60ee387b78bbc9a263aba0',
'email' => 'contact@example.com',
'subject' => 'A note just for you',
'preheader' => 'Personalized for you',
'html' => '<!doctype html>…<a href="{{unsubscribe_url}}">Unsubscribe</a>…',
'expiresAt' => '2030-01-01T00:00:00Z'
]),
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.inflection.io/v1/email-versions"
payload := strings.NewReader("{\n \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\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.inflection.io/v1/email-versions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.inflection.io/v1/email-versions")
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 \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"status": "stored"
},
"pagination": {
"pageNumber": 1,
"pageSize": 20,
"totalElements": 151,
"totalPages": 8
},
"errors": [
{
"errorCode": "<string>",
"message": "<string>",
"detail": "<string>"
}
],
"meta": {
"status": "SUCCESS",
"timestamp": "2023-11-07T05:31:56Z"
}
}Set a personalized email version
Stores the personalized version of a Personalized Email Asset for one contact. One version per contact per asset; re-posting for the same contact replaces their version. At send time the contact receives their version if it’s ready; contacts without one get the asset’s default email.
Validation on arrival: email must resolve to an existing contact, and html must contain the literal {{unsubscribe_url}} token, contain no other {{…}} tokens, and stay within 500 KB. A version that fails validation is rejected with a reason (visible on the asset’s Activity tab) and the default email sends instead.
curl --request POST \
--url https://api.inflection.io/v1/email-versions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assetId": "6a60ee387b78bbc9a263aba0",
"email": "contact@example.com",
"subject": "A note just for you",
"preheader": "Personalized for you",
"html": "<!doctype html>…<a href=\"{{unsubscribe_url}}\">Unsubscribe</a>…",
"expiresAt": "2030-01-01T00:00:00Z"
}
'import requests
url = "https://api.inflection.io/v1/email-versions"
payload = {
"assetId": "6a60ee387b78bbc9a263aba0",
"email": "contact@example.com",
"subject": "A note just for you",
"preheader": "Personalized for you",
"html": "<!doctype html>…<a href=\"{{unsubscribe_url}}\">Unsubscribe</a>…",
"expiresAt": "2030-01-01T00:00:00Z"
}
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({
assetId: '6a60ee387b78bbc9a263aba0',
email: 'contact@example.com',
subject: 'A note just for you',
preheader: 'Personalized for you',
html: '<!doctype html>…<a href="{{unsubscribe_url}}">Unsubscribe</a>…',
expiresAt: '2030-01-01T00:00:00Z'
})
};
fetch('https://api.inflection.io/v1/email-versions', 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.inflection.io/v1/email-versions",
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([
'assetId' => '6a60ee387b78bbc9a263aba0',
'email' => 'contact@example.com',
'subject' => 'A note just for you',
'preheader' => 'Personalized for you',
'html' => '<!doctype html>…<a href="{{unsubscribe_url}}">Unsubscribe</a>…',
'expiresAt' => '2030-01-01T00:00:00Z'
]),
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.inflection.io/v1/email-versions"
payload := strings.NewReader("{\n \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\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.inflection.io/v1/email-versions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.inflection.io/v1/email-versions")
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 \"assetId\": \"6a60ee387b78bbc9a263aba0\",\n \"email\": \"contact@example.com\",\n \"subject\": \"A note just for you\",\n \"preheader\": \"Personalized for you\",\n \"html\": \"<!doctype html>…<a href=\\\"{{unsubscribe_url}}\\\">Unsubscribe</a>…\",\n \"expiresAt\": \"2030-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"status": "stored"
},
"pagination": {
"pageNumber": 1,
"pageSize": 20,
"totalElements": 151,
"totalPages": 8
},
"errors": [
{
"errorCode": "<string>",
"message": "<string>",
"detail": "<string>"
}
],
"meta": {
"status": "SUCCESS",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Personal Access Token or OAuth 2.1 access token, sent as a bearer credential. READ permission for GET, WRITE for POST/PATCH/DELETE.
Body
ID of the Personalized Email Asset. Copy it from the asset URL (…/assets/email/per-user/<ASSET_ID>/versions) or its How to add versions tab.
The contact's email. Must match an existing contact.
The personalized subject line.
The inbox preview text.
Full HTML of the personalized email. Must include the literal {{unsubscribe_url}} token; no other {{…}} tokens are allowed. Max 500 KB.
Optional ISO-8601 expiry. After this moment the contact falls back to the default email. Omit for a version that never expires.
Was this page helpful?