Skip to main content
POST
If you want to get the main sequence or a list of sequences for a campaign, you can call /api/campaigns/{campaignId}/sequences.

Adding Steps

To add a new step to a sequence, call the API with the sequence ID in the parameters and the step details in the request body. For example, adding a LinkedIn invite step:

Adding Conditions

To add a condition to a sequence, you must provide the conditionKey and type conditional along with the required fields. The API will return a condition with an array of condition sequences, where you can call the same API again to add steps to those sequences. For example, creating a LinkedIn invite condition:
This will return:
Then you can call /api/sequences/seq_jacL5GNH3YpNnuNQ2/steps to add a send step if the invite is accepted:

Branching on a lead variable

The customLeadInfo condition branches on a lead variable or a contact field instead of on a lead action. It takes three extra fields:
customField reads a bare name as a lead variable — jobTitle becomes variables.jobTitle. Prefix it with fields. to test a contact field instead. customOperator is one of equal, contains, empty, notEmpty. The first two need a customValue; the last two refuse one.
A condition step created here has one branch plus the Else fallback. To give it more branches — “CEO or Founder here, CTO there, everyone else in Else” — use the condition branch endpoints.

Step Types and Required Fields

The table below summarizes the required and optional fields for each step type. Note that all step requests must include a common type field.
In conditional steps, if the delayType is not "within", the delay field is not required.
linkedinVoiceNote steps are created as skeletons via the API: the audio payload itself is not accepted here and must be added afterwards from the lemlist UI. The recordMode field controls how the audio is sourced — with manual (default), a user records the note themselves; with ai, a user provides a text template that lemlist converts to audio at send time.

All Request Body Fields

What happens to the transferred lead

A sendToAnotherCampaign step adds the lead to the target campaign. leadAction decides what the source campaign then does with it.
A transfer that fails always pauses the lead, whatever leadAction says, so a lead that never moved does not walk on as if it had. A transfer fails when the target campaign is missing or archived, when it has reached its 40,000-lead limit, when the lead’s email address is unsubscribed, and when the lead is already in the target campaign — a re-run of the same step, or two campaigns feeding one target, both land there.
Omitting leadAction leaves the step without a value, which the runtime reads as continue. A step added from the lemlist UI defaults to stop instead; that default belongs to the editor, not to the API.
leadAction is read when the step runs, not when the lead reaches it. Updating it applies to every lead still waiting at that step, including leads whose transfer is already queued.

LinkedIn invitation notes

Three LinkedIn step types carry a second note besides message, and altMessage does not mean the same thing on each of them.
LinkedIn caps a connection-request note at 200 characters on a free account and 300 on Premium or Sales Navigator. These endpoints do not enforce those caps, but an over-long note is a blocking step error: the campaign refuses to launch until you shorten it. Sending either field here on a step type that does not take it is rejected with 400 Invalid request body.

Running campaigns

A campaign that leads have entered still accepts new steps. Where the step lands decides who receives it:
  • Appended after the last step of a sequence leads finish on: the leads parked on that last step move on to the new one.
  • Inserted before an existing step (with index): the leads waiting on that step are moved onto the new one and run it first. Leads already past that position never receive it.
The move is applied to the campaign’s leads right after the response. While it runs, another structural change on the same campaign answers 409 campaign-reroute-in-progress; nothing is written and the same call succeeds a minute later. Inserting before an existing step on a running campaign is being rolled out progressively. A team that does not have it yet gets 409 SEQUENCE_STEP_INSERT_ON_SEQUENCE_IN_USE on a non-tail index and 409 SEQUENCE_STEP_ADD_ON_LOCKED_SEQUENCE on a branch no lead can reach anymore; calling again without index appends the step.

LinkedIn media constraints

When you pass images or videos to a linkedinInvite or linkedinSend step, each URL must be a publicly reachable HTTPS URL. lemlist fetches the file, validates it, and re-hosts it before attaching it to the LinkedIn message. If ingestion fails, the API returns a 4xx/5xx status with one of the following error codes:

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

Body

application/json
type
enum<string>

The type of step to create

Available options:
email,
manual,
phone,
api,
linkedinVisit,
linkedinInvite,
linkedinSend,
linkedinVoiceNote,
linkedinFollow,
linkedinLikeLastPost,
linkedinCommentLastPost,
linkedinEndorse,
linkedinWithdrawInvitation,
sendToAnotherCampaign,
conditional,
whatsappMessage,
sms
index
integer

The position within the sequence to insert the new step (≥ -1). If omitted or greater than the number of steps, the new step is added to the end. On a campaign leads have entered, a step inserted before an existing one moves the leads waiting on that step onto the new one; leads already past that position never receive it. Teams without live campaign editing can only append once leads have entered, and a non-tail index is refused with 409 SEQUENCE_STEP_INSERT_ON_SEQUENCE_IN_USE

delay
integer

Delay in days before executing this step. Defaults to 0 for the first step and 1 for subsequent steps

subject
string

Email subject line (for email steps). Optional: omit it or send an empty string on a follow-up so the email replies in the thread of the previous one. If no email has been sent to the lead in this campaign yet, it goes out with an empty subject.

message
string

Content of the email or message (used for email, linkedinInvite, linkedinSend, manual, phone, whatsappMessage, sms steps, and as the AI script of a linkedinVoiceNote step in ai record mode). Required for linkedinSend, whatsappMessage, and sms

altMessage
string

The LinkedIn note sent instead of message in specific cases, with a meaning that depends on the step type. On linkedinInvite: the premium invitation note attached to the connection request, used when the sending account has LinkedIn Premium. On linkedinSend and linkedinVoiceNote: the out-of-network note, sent as a connection request when the lead is not a 1st-degree connection. Rejected with 400 on any other step type. LinkedIn caps a connection-request note at 200 characters on a free account and 300 on Premium or Sales Navigator. This endpoint does not enforce those caps, but an over-long note is a blocking step error: the campaign refuses to launch until it is shortened

altMessagePremium
string

For linkedinSend steps only. The premium variant of the out-of-network note, sent instead of altMessage when the sending LinkedIn account is Premium or Sales Navigator (300-character LinkedIn cap). Rejected with 400 on any other step type

title
string

Title or label for manual steps

method
enum<string>

HTTP method for API steps

Available options:
GET,
POST,
PUT,
DELETE,
PATCH
url
string

URL of the API endpoint to call (required for api steps). Must start with http:// or https://

conditionKey
enum<string>

Condition key for conditional steps

Available options:
hasEmailAddress,
hasLinkedinUrl,
hasPhoneNumber,
customLeadInfo,
hasScore,
emailsOpened,
emailsClicked,
emailsUnsubscribed,
meetingBooked,
linkedinInviteAccepted,
linkedinOpened,
aircallDone,
linkedinNetworkCheck,
hasWhatsappAccount
delayType
enum<string>

Delay type for conditional steps

Available options:
within,
waitUntil
customField
string

For conditional steps keyed customLeadInfo only. The field to test. A bare name reads as a lead variable (jobTitle becomes variables.jobTitle); prefix with fields. to test a contact field. $ and the reserved keys _id, teamId, campaignId, leadId, __proto__, constructor and prototype are refused.

customOperator
enum<string>

For conditional steps keyed customLeadInfo only. How the field is compared.

Available options:
equal,
contains,
empty,
notEmpty
customValue
string

For conditional steps keyed customLeadInfo only. The value the field is compared to. Required for equal and contains, and refused for empty and notEmpty.

campaignId
string

Target campaign ID for sendToAnotherCampaign steps. The campaign must exist and not be archived

leadAction
enum<string>

Applies to sendToAnotherCampaign steps only. What happens to the lead in the SOURCE campaign once it has been moved to the target one. continue keeps it running the remaining steps, pause pauses it, stop ends the source campaign for it. Omitted leaves the step without a value, which behaves as continue; a step added from the lemlist UI defaults to stop. A transfer that fails always pauses the lead, whatever this says.

Available options:
continue,
pause,
stop
images
string<uri>[]

Public HTTPS URLs of images to attach to a linkedinInvite or linkedinSend step. lemlist downloads each file and re-hosts it. Allowed MIME types: image/png, image/jpeg, image/gif. Up to 20 MB per file, and up to 6 items total combined with videos.

videos
string<uri>[]

Public HTTPS URLs of videos to attach to a linkedinInvite or linkedinSend step. lemlist downloads each file and re-hosts it. Allowed MIME types: video/mp4, video/quicktime. Up to 20 MB per file, and up to 6 items total combined with images.

skillName
string

Name of the LinkedIn skill to endorse on the lead's profile. Applies to linkedinEndorse steps only.

endorseAnyFallback
boolean

Applies to linkedinEndorse steps only. When true and the named skill is not on the lead's profile, lemlist falls back to endorsing any available skill.

recordMode
enum<string>

Applies to linkedinVoiceNote steps only. Determines how the audio is sourced. manual (default) means the user records the audio themselves from the lemlist UI after step creation; ai means lemlist generates the audio from a text template provided in the lemlist UI.

Available options:
manual,
ai

Response

Success

_id
string
type
string
delay
integer
emailTemplateId
string
message
string