Skip to main content
POST
/
api
/
v1
/
personalize
/
preview
Sync preview of a personalized email for a single lead
curl --request POST \
  --url https://api.example.com/api/v1/personalize/preview \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "lead_data": {},
  "sender_profile_id": "<string>",
  "sender_data": {},
  "custom_prompt": "<string>",
  "research_context": "<string>",
  "dataset_id": "<string>",
  "row_index": 1,
  "force_refresh_research": false
}
'
import requests

url = "https://api.example.com/api/v1/personalize/preview"

payload = {
"lead_data": {},
"sender_profile_id": "<string>",
"sender_data": {},
"custom_prompt": "<string>",
"research_context": "<string>",
"dataset_id": "<string>",
"row_index": 1,
"force_refresh_research": False
}
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({
lead_data: {},
sender_profile_id: '<string>',
sender_data: {},
custom_prompt: '<string>',
research_context: '<string>',
dataset_id: '<string>',
row_index: 1,
force_refresh_research: false
})
};

fetch('https://api.example.com/api/v1/personalize/preview', 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.example.com/api/v1/personalize/preview",
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([
'lead_data' => [

],
'sender_profile_id' => '<string>',
'sender_data' => [

],
'custom_prompt' => '<string>',
'research_context' => '<string>',
'dataset_id' => '<string>',
'row_index' => 1,
'force_refresh_research' => false
]),
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.example.com/api/v1/personalize/preview"

payload := strings.NewReader("{\n \"lead_data\": {},\n \"sender_profile_id\": \"<string>\",\n \"sender_data\": {},\n \"custom_prompt\": \"<string>\",\n \"research_context\": \"<string>\",\n \"dataset_id\": \"<string>\",\n \"row_index\": 1,\n \"force_refresh_research\": false\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.example.com/api/v1/personalize/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lead_data\": {},\n \"sender_profile_id\": \"<string>\",\n \"sender_data\": {},\n \"custom_prompt\": \"<string>\",\n \"research_context\": \"<string>\",\n \"dataset_id\": \"<string>\",\n \"row_index\": 1,\n \"force_refresh_research\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/personalize/preview")

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 \"lead_data\": {},\n \"sender_profile_id\": \"<string>\",\n \"sender_data\": {},\n \"custom_prompt\": \"<string>\",\n \"research_context\": \"<string>\",\n \"dataset_id\": \"<string>\",\n \"row_index\": 1,\n \"force_refresh_research\": false\n}"

response = http.request(request)
puts response.read_body
{
  "subject": "<string>",
  "email_body": "<string>",
  "commonality": {
    "text": "<string>",
    "confidence_score": 123,
    "rarity_score": 123,
    "relevance_score": 123,
    "supporting_evidence": [
      "<string>"
    ]
  },
  "prompt_source": "<string>",
  "model_used": "<string>",
  "latency_ms": 123,
  "research_sources": [
    {
      "name": "<string>",
      "status": "<string>",
      "summary": "",
      "meta": {},
      "from_cache": false
    }
  ],
  "research_chars": 0,
  "research_latency_ms": 0,
  "research_from_cache": false,
  "research_cached_at": "<string>",
  "research_meta": {}
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Input for the sync personalization preview.

lead_data
Lead Data · object
required

The lead fields to personalize against (company, role, linkedin_url, etc.)

sender_profile_id
string | null

ID of a saved sender profile. If omitted, sender_data must be provided.

sender_data
Sender Data · object | null

Inline sender profile data. Ignored if sender_profile_id is provided.

custom_prompt
string | null

Optional prompt override. Must be 100-5000 characters if provided.

research_context
string | null

Optional pre-fetched research context (overrides enrichment). Max 20000 chars.

Maximum string length: 20000
dataset_id
string | null

Optional dataset id for research cache persistence. Paired with row_index.

row_index
integer | null

Row index within the dataset. Required when dataset_id is set.

Required range: x >= 0
force_refresh_research
boolean
default:false

Bypass the research cache and fetch fresh (e.g. user hit 'Refresh research').

Response

Successful Response

subject
string
required
email_body
string
required
commonality
PersonalizationPreviewCommonality · object
required
prompt_source
string
required

Which prompt was used: 'default', 'sender_profile_custom', or 'custom_override'.

model_used
string
required
latency_ms
integer
required
research_sources
PersonalizationPreviewResearchSource · object[]

Which enrichment sources ran and whether they succeeded.

research_chars
integer
default:0
research_latency_ms
integer
default:0
research_from_cache
boolean
default:false
research_cached_at
string | null
research_meta
Research Meta · object

Aggregate research metadata. Currently exposes zero_research_reason (one of the ZERO_RESEARCH_REASON_* enum values) when the joined research_chars was below the useful threshold. Used by ops sweep scripts to derive a per-cohort distribution of why some leads return empty research.