Create A/B Test Variant
curl --request POST \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test', 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/sequences/{sequenceId}/steps/{stepId}/ab-test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"stepId": "stp_V0JHmSpWiO0rxHUkz",
"abTest": true,
"emailTemplateBId": "etp_9aZ2k1QwErTyUiOp3",
"subject": "Quick question, {{firstName}}",
"message": "<div>Hi {{firstName}}, ...</div>"
}{
"error": "A/B test already exists on this step",
"code": "SEQUENCE_AB_ALREADY_EXISTS"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}{
"error": "Bad method"
}Sequences
Create A/B Test Variant
Creates variant B of an A/B test on a step, prefilled from variant A.
POST
/
sequences
/
{sequenceId}
/
steps
/
{stepId}
/
ab-test
Create A/B Test Variant
curl --request POST \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test', 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/sequences/{sequenceId}/steps/{stepId}/ab-test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"stepId": "stp_V0JHmSpWiO0rxHUkz",
"abTest": true,
"emailTemplateBId": "etp_9aZ2k1QwErTyUiOp3",
"subject": "Quick question, {{firstName}}",
"message": "<div>Hi {{firstName}}, ...</div>"
}{
"error": "A/B test already exists on this step",
"code": "SEQUENCE_AB_ALREADY_EXISTS"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}{
"error": "Bad method"
}A/B testing requires at least the Email Pro plan.
Scope and constraints
- A/B testing is supported on email, LinkedIn invite (
linkedinInvite) and LinkedIn message (linkedinSend) steps. Any other step type is rejected with400. - The step must have a template (variant A) and must not already run an A/B test.
- Variant A’s template must have a message, except on LinkedIn invite steps (where an empty message means “invite without a note”) — variant B starts as a copy of it.
- As with other step edits, the test cannot be created while the campaign is running on a non-editable sequence.
- This endpoint covers A/B testing on a single step only.
subject, message, config) along
with the abTest flag and the new emailTemplateBId.Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
The unique identifier of the sequence
The unique identifier of the step
Response
Variant B created
Email template ID of variant B
Variant B subject
Variant B body (HTML)
Variant B's LinkedIn note, same meaning as the step-level altMessage: the premium invitation note on a linkedinInvite step, the out-of-network note on a linkedinSend one
Variant B's premium variant of the out-of-network note, on linkedinSend steps only
Was this page helpful?