Personalize Step for Lead
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>"
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization"
payload = { "message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<p>Hi {{firstName}}, a quick follow-up on my last email.</p>\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"leadId": "lea_Example6F7g8H9i0J",
"stepId": "stp_Example1K2l3M4n5O",
"variant": "A",
"emailTemplateId": "etp_Example6P7q8R9s0T",
"content": {
"subject": "",
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>",
"cc": [
"jane@example.com"
]
}
}{
"error": "Validation error",
"code": "VALIDATION_ERROR"
}The authentication you supplied is incorrect{
"error": "Lead not found in this campaign",
"code": "REVIEW_DRAFT_LEAD_NOT_FOUND"
}{
"error": "The lead already reached this step: its message can no longer be personalized",
"code": "REVIEW_DRAFT_STEP_ALREADY_REACHED"
}{
"error": "This A/B variant is not available on the step (no variant B, or the other variant won)",
"code": "REVIEW_DRAFT_VARIANT_UNAVAILABLE"
}Leads
Personalize Step for Lead
Personalizes the message of one campaign step for a single lead.
PUT
/
campaigns
/
{campaignId}
/
leads
/
{leadIdOrEmail}
/
steps
/
{stepId}
/
personalization
Personalize Step for Lead
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>"
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization"
payload = { "message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<p>Hi {{firstName}}, a quick follow-up on my last email.</p>\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"leadId": "lea_Example6F7g8H9i0J",
"stepId": "stp_Example1K2l3M4n5O",
"variant": "A",
"emailTemplateId": "etp_Example6P7q8R9s0T",
"content": {
"subject": "",
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>",
"cc": [
"jane@example.com"
]
}
}{
"error": "Validation error",
"code": "VALIDATION_ERROR"
}The authentication you supplied is incorrect{
"error": "Lead not found in this campaign",
"code": "REVIEW_DRAFT_LEAD_NOT_FOUND"
}{
"error": "The lead already reached this step: its message can no longer be personalized",
"code": "REVIEW_DRAFT_STEP_ALREADY_REACHED"
}{
"error": "This A/B variant is not available on the step (no variant B, or the other variant won)",
"code": "REVIEW_DRAFT_VARIANT_UNAVAILABLE"
}The lead receives this version of the step instead of its shared content, which
stays unchanged for every other lead. Same as Personalize in the lemlist
review page.
Every body field is optional and overlays the lead’s current version: its
existing personalization, otherwise the step’s content. Fields you leave out
are kept; the response returns the full personalized content. Sending only
variant puts the lead on that version as is.
- A/B tests: a personalized step is no longer A/B tested for that lead. It
pins the lead to the variant it is written on (before the campaign starts,
it also decides which sequence variant the lead follows). Switching
variantreplaces the lead’s personalization of the other variant. - Email threads: on a follow-up email, a non-empty
subjectstarts a new thread. Leavesubjectout to stay in the thread. - Cc:
cc: []removes the step’s cc for this lead. - LinkedIn, SMS and WhatsApp: messages are plain text; HTML you send is converted to text.
- Supported steps: email, LinkedIn message, LinkedIn invitation, SMS and
WhatsApp message. Voice notes and conditions answer
422, and so do steps in a wait-until fallback or in a branch several conditions lead to. - Reached steps: once the lead reached the step (sent, skipped or ignored),
the request answers
409.
Authorizations
Path Parameters
Body
application/json
Response
The step is personalized for the lead. content is the full personalized content, the fields you did not send included.
A lead's personalized version of one campaign step. It pins the lead to the A/B variant it is written on.
Was this page helpful?