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 incorrect""route 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"
}Reorder Condition Branches
Rewrites the execution priority of a condition step’s 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 incorrect""route 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"
}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.
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
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 holding the condition step
The unique identifier of the condition step, from GET /campaigns/{campaignId}/sequences
Body
Every branch of the step by sequenceId, in the new execution order, excluding the Else branch.
Response
The branches, in their new order.
The branch's sub-sequence id, and its address on every branch endpoint. Pass it to POST /sequences/{sequenceId}/steps to add steps inside the branch.
Execution rank among the non-fallback branches, starting at 0. The first branch whose test matches takes the lead. Absent on the Else branch, which always runs last.
true on the Else branch - the one that catches every lead no other branch matched. Absent on the others.
The condition the step tests. Every branch of a step shares it: a branch never carries a condition of its own.
The branch's display name, present only when someone has set one. lemlist labels the unnamed ones "Branch 1", "Branch 2", … and "Else"; those defaults are not stored and are not returned here.
Length of the time window the condition waits on the lead's action, in days. Only on the lead-action conditions that store one.
How the condition waits: within branches once the window is over, waitUntil parks the lead until the action happens, with no time bound.
within, waitUntil hasScore only - how the lead's score is compared to scoreThreshold.
$gte, $lt hasScore only - the score this branch tests against.
hasEmailAddress only - the email statuses this branch matches.
deliverable, risky, undeliverable, unverified aircallDone only - the call-status keys this branch matches.
customLeadInfo only - the tested field, normalized: a lead variable reads back as variables.<name>, a contact field as fields.<name>. Every branch of the step tests the same field.
customLeadInfo only - how the field is compared to the tested values.
equal, contains, empty, notEmpty customLeadInfo only - every value this branch tests; the branch matches when any of them does. Empty for the empty and notEmpty operators.
The raw stored condition selector, as JSON. Returned only when none of the fields above could describe the branch.
Was this page helpful?