Skip to main content
PATCH
Reorder Condition Branches
New to condition branches? Start with List Condition Branches, which explains how a step branches and how a branch is addressed.
Order is priority: lemlist tests the branches in array order and the first match wins. Reordering is therefore a behaviour change, not cosmetics — a lead matching two branches follows whichever comes first. 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 a PATCH 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

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

sequenceId
string
required

The unique identifier of the sequence holding the condition step

stepId
string
required

The unique identifier of the condition step, from GET /campaigns/{campaignId}/sequences

Body

application/json
order
string[]
required

Every branch of the step by sequenceId, in the new execution order, excluding the Else branch.

Response

The branches, in their new order.

sequenceId
string

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.

index
integer

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.

fallback
boolean

true on the Else branch - the one that catches every lead no other branch matched. Absent on the others.

key
string

The condition the step tests. Every branch of a step shares it: a branch never carries a condition of its own.

name
string

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.

delay
integer

Length of the time window the condition waits on the lead's action, in days. Only on the lead-action conditions that store one.

delayType
enum<string>

How the condition waits: within branches once the window is over, waitUntil parks the lead until the action happens, with no time bound.

Available options:
within,
waitUntil
scoreComparator
enum<string>

hasScore only - how the lead's score is compared to scoreThreshold.

Available options:
$gte,
$lt
scoreThreshold
integer

hasScore only - the score this branch tests against.

emailStatusFilter
enum<string>[]

hasEmailAddress only - the email statuses this branch matches.

Available options:
deliverable,
risky,
undeliverable,
unverified
callStatusFilter
string[]

aircallDone only - the call-status keys this branch matches.

customField
string

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.

customOperator
enum<string>

customLeadInfo only - how the field is compared to the tested values.

Available options:
equal,
contains,
empty,
notEmpty
customValues
string[]

customLeadInfo only - every value this branch tests; the branch matches when any of them does. Empty for the empty and notEmpty operators.

selector
string

The raw stored condition selector, as JSON. Returned only when none of the fields above could describe the branch.