List Condition Branches
curl --request GET \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
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::Get.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}/branches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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;
}[
{
"sequenceId": "seq_jacL5GNH3YpNnuNQ2",
"index": 0,
"key": "customLeadInfo",
"name": "Decision makers",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CEO",
"Founder"
]
},
{
"sequenceId": "seq_xzrGLxhZwoo5oxukc",
"index": 1,
"key": "customLeadInfo",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CTO"
]
},
{
"sequenceId": "seq_Kd8pQrLm3Nv6Tz0Wy",
"fallback": true
}
]{
"error": "This step is not a condition step",
"code": "SEQUENCE_BRANCH_STEP_NOT_CONDITIONAL"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}Sequences
List Condition Branches
Lists the branches of a condition step, in execution order.
GET
/
sequences
/
{sequenceId}
/
steps
/
{stepId}
/
branches
List Condition Branches
curl --request GET \
--url https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/sequences/{sequenceId}/steps/{stepId}/branches"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
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::Get.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}/branches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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;
}[
{
"sequenceId": "seq_jacL5GNH3YpNnuNQ2",
"index": 0,
"key": "customLeadInfo",
"name": "Decision makers",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CEO",
"Founder"
]
},
{
"sequenceId": "seq_xzrGLxhZwoo5oxukc",
"index": 1,
"key": "customLeadInfo",
"customField": "variables.jobTitle",
"customOperator": "contains",
"customValues": [
"CTO"
]
},
{
"sequenceId": "seq_Kd8pQrLm3Nv6Tz0Wy",
"fallback": true
}
]{
"error": "This step is not a condition step",
"code": "SEQUENCE_BRANCH_STEP_NOT_CONDITIONAL"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Step not found",
"code": "SEQUENCE_STEP_NOT_FOUND"
}How a condition step branches
A condition step (type: "conditional") holds an ordered list of branches. Each branch owns a
sub-sequence — the steps a lead walks once it matches — and the last entry is the Else branch,
which catches every lead no other branch matched.
Order is execution priority: lemlist tests the branches top to bottom and the first match wins.
The Else branch always runs last and is never part of that race.
A branch is addressed by its sequenceId, never by its position. A reorder moves positions around;
the sub-sequence id is what the runtime routes leads to, and what every branch endpoint takes as its
branchSequenceId. That same id is also the one you pass to
POST /sequences/{sequenceId}/steps to
put steps inside the branch.
Reading a branch
Thekey is the condition the step tests — every branch of a step shares it, so a branch never
carries a condition of its own. What differs from one branch to the next is the value it tests,
returned as structured parameters rather than as a raw Mongo selector:
| Condition | Fields returned |
|---|---|
customLeadInfo | customField, customOperator, customValues |
hasScore | scoreComparator, scoreThreshold |
hasEmailAddress | emailStatusFilter |
aircallDone | callStatusFilter |
lead-action conditions (emailsOpened, linkedinInviteAccepted, …) | delay, delayType |
selector comes back only when none of those could describe the branch — an unknown or hand-written
shape. Everything else is expressed as parameters you can send straight back to the write endpoints.
customValues is an array because a customLeadInfo branch may test several values: it matches
when any one of them does. The write endpoints currently take a single customValue; a branch
testing several values is built from the lemlist campaign editor.Names
name is the name someone gave the branch, and it is only present when someone did. lemlist labels
the unnamed branches “Branch 1”, “Branch 2”, … by rank, and the last one “Else” — those defaults are
display copy, not stored data, so this endpoint does not invent them for you.
Access
Reading branches is open to everyone. Writing them — add, rename, re-select, reorder, delete — is in closed beta and answers403 unless the beta is enabled for your team.
Editing a running campaign
Once leads have entered the campaign, lemlist locks the part of the tree they walk. Adding, removing and reordering branches, and changing what a branch tests, are then refused with409 SEQUENCE_BRANCH_CAMPAIGN_RUNNING — re-routing live leads would strand those already sent down
the old path.
Two things stay editable on a running campaign:
- renaming a branch, which never re-routes anyone;
- the
delayvalue of a lead-action condition (hasScore,aircallDone) — how long it waits, not what it waits for. ChangingdelayType, or anything else about the selector, still locks.
Authorizations
Path Parameters
Response
The step's branches, ordered.
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?