Sequences API
POST /api/v1/sequences
Creates an ACTIVE sequence with its ordered steps. Requires the write:sequences scope, and also send:emails when sendMode is SEND.
Request
POST /api/v1/sequences HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
{
"name": "New farm buyers",
"steps": [
{ "type": "EMAIL", "delayDays": 0, "subject": "Quick question, {{firstName}}", "bodyHtml": "<p>Hi {{firstName}}, do you stock lick salt for the herd?</p><p>Kevin</p>" },
{ "type": "TASK", "delayDays": 3, "taskTitle": "Call to follow up" },
{ "type": "EMAIL", "delayDays": 7, "subject": "Following up", "bodyHtml": "<p>Hi {{firstName}}, happy to send a sample if useful.</p><p>Kevin</p>" }
]
}| Field | Required | Notes |
|---|---|---|
name | yes | Up to 200 characters |
steps | yes | 1 to 50 steps, in the order they run. EMAIL steps need subject and bodyHtml; TASK steps need taskTitle. delayDays is 0 to 365, counted from the previous step (or enrollment for the first) |
sendMode | no | DRAFT (default) or SEND |
fromEmail | no | A verified sending identity from GET /api/v1/emails/identities |
offeringId | no | The product this sequence promotes |
businessHoursOnly, exitOnReply, exitOnDealCreated, exitOnStatusChange | no | See the Sequence object for defaults |
asUserEmail | no | The workspace member recorded as the creator. Defaults to the workspace owner |
Every step is validated before anything is written, so a bad step never leaves half a sequence behind.
Response (201)
{ "sequence": { "id": "cmq2seqn0alk34567890", "status": "ACTIVE", "steps": ["..."], "enrollmentCount": 0 } }