Select A/B Test Winner
curl --request POST \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{
"variant": "B"
}'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner"
payload = { "variant": "B" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({variant: 'B'})
};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner', 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/winner")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": \"B\"\n}"
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/winner",
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([
'variant' => 'B'
]),
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;
}{
"stepId": "stp_V0JHmSpWiO0rxHUkz",
"abTest": "B"
}{
"error": "A winning variant has already been selected for this step",
"code": "SEQUENCE_AB_WINNER_ALREADY_SELECTED"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "No A/B test variant on this step",
"code": "SEQUENCE_AB_NO_VARIANT"
}{
"error": "Bad method"
}Sequences
Select A/B Test Winner
Selects the winning A/B test variant, applied to all remaining leads.
POST
/
sequences
/
{sequenceId}
/
steps
/
{stepId}
/
ab-test
/
winner
Select A/B Test Winner
curl --request POST \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{
"variant": "B"
}'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner"
payload = { "variant": "B" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({variant: 'B'})
};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/ab-test/winner', 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/winner")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": \"B\"\n}"
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/winner",
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([
'variant' => 'B'
]),
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;
}{
"stepId": "stp_V0JHmSpWiO0rxHUkz",
"abTest": "B"
}{
"error": "A winning variant has already been selected for this step",
"code": "SEQUENCE_AB_WINNER_ALREADY_SELECTED"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "No A/B test variant on this step",
"code": "SEQUENCE_AB_NO_VARIANT"
}{
"error": "Bad method"
}A/B testing requires at least the Email Pro plan.
Request Body
| Field | Type | Description |
|---|---|---|
variant | string (required) | The winning variant: A or B |
{
"variant": "B"
}
400. If the step does not run an A/B test, the endpoint returns 404.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
Body
application/json
The winning variant
Available options:
A, B Was this page helpful?