Reorder Condition Branches
curl --request PATCH \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"order": [
"seq_xzrGLxhZwoo5oxukc",
"seq_jacL5GNH3YpNnuNQ2"
]
}
'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches"
payload = { "order": ["seq_xzrGLxhZwoo5oxukc", "seq_jacL5GNH3YpNnuNQ2"] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({order: ['seq_xzrGLxhZwoo5oxukc', 'seq_jacL5GNH3YpNnuNQ2']})
};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches', 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}/branches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order\": [\n \"seq_xzrGLxhZwoo5oxukc\",\n \"seq_jacL5GNH3YpNnuNQ2\"\n ]\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}/branches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'order' => [
'seq_xzrGLxhZwoo5oxukc',
'seq_jacL5GNH3YpNnuNQ2'
]
]),
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;
}[
{
"sequenceId": "seq_xzrGLxhZwoo5oxukc",
"index": 0,
"key": "customLeadInfo",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CTO"
]
},
{
"sequenceId": "seq_jacL5GNH3YpNnuNQ2",
"index": 1,
"key": "customLeadInfo",
"name": "Decision makers",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CEO",
"Founder"
]
},
{
"sequenceId": "seq_Kd8pQrLm3Nv6Tz0Wy",
"fallback": true
}
]{
"error": "order must list every branch of this step exactly once, excluding the Else branch",
"code": "SEQUENCE_BRANCH_ORDER_INVALID"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Condition branches are not enabled for this team",
"code": "SEQUENCE_BRANCH_BETA_REQUIRED"
}{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}{
"error": "You cannot add, remove or reorder branches once leads have entered the campaign",
"code": "SEQUENCE_BRANCH_CAMPAIGN_RUNNING"
}Sequences
Reorder Condition Branches
Rewrites the execution priority of a condition step’s branches.
PATCH
/
sequences
/
{sequenceId}
/
steps
/
{stepId}
/
branches
Reorder Condition Branches
curl --request PATCH \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"order": [
"seq_xzrGLxhZwoo5oxukc",
"seq_jacL5GNH3YpNnuNQ2"
]
}
'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches"
payload = { "order": ["seq_xzrGLxhZwoo5oxukc", "seq_jacL5GNH3YpNnuNQ2"] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({order: ['seq_xzrGLxhZwoo5oxukc', 'seq_jacL5GNH3YpNnuNQ2']})
};
fetch('https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches', 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}/branches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order\": [\n \"seq_xzrGLxhZwoo5oxukc\",\n \"seq_jacL5GNH3YpNnuNQ2\"\n ]\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}/branches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'order' => [
'seq_xzrGLxhZwoo5oxukc',
'seq_jacL5GNH3YpNnuNQ2'
]
]),
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;
}[
{
"sequenceId": "seq_xzrGLxhZwoo5oxukc",
"index": 0,
"key": "customLeadInfo",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CTO"
]
},
{
"sequenceId": "seq_jacL5GNH3YpNnuNQ2",
"index": 1,
"key": "customLeadInfo",
"name": "Decision makers",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CEO",
"Founder"
]
},
{
"sequenceId": "seq_Kd8pQrLm3Nv6Tz0Wy",
"fallback": true
}
]{
"error": "order must list every branch of this step exactly once, excluding the Else branch",
"code": "SEQUENCE_BRANCH_ORDER_INVALID"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Condition branches are not enabled for this team",
"code": "SEQUENCE_BRANCH_BETA_REQUIRED"
}{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}{
"error": "You cannot add, remove or reorder branches once leads have entered the campaign",
"code": "SEQUENCE_BRANCH_CAMPAIGN_RUNNING"
}New to condition branches? Start with
List Condition Branches, which explains
how a step branches and how a branch is addressed.
order must list every non-fallback branch of the step exactly once, by sequenceId. Leave the
Else branch out: it is not orderable and always stays last. A list that repeats a branch, omits one,
or names an id that is not a branch of this step is refused with SEQUENCE_BRANCH_ORDER_INVALID.
Sending the order the step already has changes nothing and still returns the branches.
Reordering is refused with
409 once leads have entered the campaign: leads already sitting in a
branch were routed there under the old priority. See
Editing a running campaign.Why PATCH on the collection
The reorder is aPATCH on …/branches rather than on a …/branches/order sub-path, which would
collide with the {branchSequenceId} segment. PATCH …/branches reorders; PATCH …/branches/{id}
edits one branch.Authorizations
Path Parameters
Body
application/json
Response
The branches, in their new order.
customLeadInfo only - the tested field, normalized: a lead variable reads back as variables.<name>, a contact field as fields.<name>, a company field as company.<field> (e.g. company.name), or as variables.company<Field> (e.g. variables.companyName) on a step that already tested it that way, which tests the same value. Every branch of the step tests the same field.
Was this page helpful?