URL: /code/apps/sequences · Id: `page:/code/apps/sequences`

# Sequences

> Timed series of emails and tasks for one Contact at a time, enrolled by one call, stopped on any reply, and ended by an unsubscribe.

Timed series of emails and tasks for one [Contact](https://startupbuilder.dev/business/nouns/contact) at a time, enrolled by one call, stopped on any reply, and ended by an unsubscribe.

- **System:** [Sequences](https://startupbuilder.dev/systems/sequences)
- **Nouns:** 3
- **Verbs:** 8
- **Events:** 6

```text title="Run it · Ask"
Put Maya Chen at Cedar Hollow Rentals on the personal first touch, the first of today’s 12.
```

```ts title="Run it · SDK"
import { $ } from 'startup-builder'

const result = await $.try.Contact.enroll({ contact: 'contact_Mc7yH2kD9s', sequence: 'sequence_Ft2mR6hW8c' })
```

```json title="Run it · Response"
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_Mc7yH2kD9s",
    "$type": "Contact",
    "name": "Maya Chen",
    "email": "maya@cedar-hollow-rentals.example"
  },
  "enrollment": {
    "$type": "Enrollment",
    "sequence": "https://api.sb/leaseline.app/sequences/sequence_Ft2mR6hW8c",
    "status": "active",
    "step": "email-1",
    "nextAt": "2026-10-27T14:12:00Z",
    "branches": [],
    "exitReason": null
  },
  "firstStep": {
    "from": "dana@tryleaseline.app",
    "subject": "64 new units at Cedar Hollow",
    "body": "Maya, saw Cedar Hollow added 64 units this month. Are renewal notices for the new leases still tracked by hand? Leaseline sends each one 60 days out, per owner. Worth a look?"
  },
  "action": {
    "operation": "Contact.enroll",
    "mode": "try",
    "status": "done"
  }
}
```

## Nouns
| Noun | What it is |
| --- | --- |
| [Sequence](https://startupbuilder.dev/business/nouns/sequence) | A Sequence is a timed series of steps run for one Contact at a time: send a Message, wait, branch, or stop. |
| [Enrollment](https://startupbuilder.dev/business/nouns/enrollment) | An Enrollment is one person’s run through one Sequence: the current step, when the next fires, the branches taken, and why it ended. |
| [Funnel](https://startupbuilder.dev/business/nouns/funnel) | A Funnel is a designed path to an offer: a landing page, an opt-in that makes a lead, a Sequence, then the offer. |

## Properties
The hub defines each Noun’s core Properties; Sequences adds the ones a sale needs.

### Sequence
| Property | Type | What it holds | Defined by |
| --- | --- | --- | --- |
| `steps` | `json` | The steps, waits, and branches. | The hub |
| `exitOn` | `string` | The Events that end it from any step, such as a reply or a purchase. | The hub |
| `from` | `Mailbox[]` | The Mailboxes it sends from; a cold Sequence takes only warmed second-domain Mailboxes. | Sequences |
| `sendDays` | `string[]` | The days a step may send, such as Monday to Thursday. | Sequences |
| `stopOn` | `string[]` | What ends every run at once: any reply, a booked Meeting, an unsubscribe. | Sequences |

### Enrollment
| Property | Type | What it holds | Defined by |
| --- | --- | --- | --- |
| `status` | `string` | Where the run stands. | The hub |
| `step` | `string` | The Sequence step the person is on. | The hub |
| `nextAt` | `datetime` | When the next step fires; empty while paused or exited. | The hub |
| `branches` | `string[]` | The branches taken so far, in order. | The hub |
| `exitReason` | `string` | Why the run ended. | The hub |
| `mailbox` | `Mailbox` | The one Mailbox every step of this run sends from, so the thread holds. | Sequences |
| `opened` | `boolean` | Never used to time a step: opens are unreliable, so steps wait on days, not opens. | Sequences |

### Funnel
| Property | Type | What it holds | Defined by |
| --- | --- | --- | --- |
| `steps` | `json` | The pages, Forms, and Sequences in order. | The hub |

## Lifecycle
Every move names the Verb that makes it, or the Event it waits on.

### Enrollment
| State | What it means | Moves to |
| --- | --- | --- |
| `active` (first) | The Contact is on a step, and the next one fires at `nextAt`. | `paused` by [`Enrollment.pause`](https://startupbuilder.dev/business/nouns/enrollment/pause); `exited` by [`Enrollment.cancel`](https://startupbuilder.dev/business/nouns/enrollment/cancel); `exited` on `Message.created`; `exited` on `Order.placed`; `exited` on `Contact.unsubscribed`; `exited` on `Contact.suppressed`; `exited` on `Enrollment.finished` |
| `paused` | No step fires, and `nextAt` stays empty until it resumes. | `active` by [`Enrollment.resume`](https://startupbuilder.dev/business/nouns/enrollment/resume); `exited` by [`Enrollment.cancel`](https://startupbuilder.dev/business/nouns/enrollment/cancel); `exited` on `Contact.suppressed` |
| `exited` | Ended, with its `exitReason`; enrolling the Contact again starts a new Enrollment. | None: it ends here. |

## Verbs
| Verb | What it does | Approval | On each site | Limits |
| --- | --- | --- | --- | --- |
| [`Contact.enroll`](/code/apps/sequences/enroll) | Starts one person on a Sequence that sends from your Mailbox and stops the moment they reply. | Goes out on its own | Gmail, LinkedIn, Outlook | Cold first touches send only from a warmed second domain: 2 Mailboxes at 25 a day each after a 14-day ramp, 50 a day in all. Warm intros and replies send from your primary domain. |
| [`Enrollment.pause`](https://startupbuilder.dev/business/nouns/enrollment/pause) | Holds one person’s run through a Sequence at its current step, without ending it. | Runs on its own | None. | None. |
| [`Enrollment.resume`](https://startupbuilder.dev/business/nouns/enrollment/resume) | Restarts a paused run at the step it stopped on and sets when that step sends. | Runs on its own | None. | None. |
| [`Enrollment.cancel`](https://startupbuilder.dev/business/nouns/enrollment/cancel) | Ends one person’s run through a Sequence for good, with the reason. | Runs on its own | None. | None. |
| [`Lead.nurture`](https://startupbuilder.dev/business/nouns/lead/nurture) | Takes a lead that is not ready to buy off its owner’s queue and onto a Sequence, until it raises a hand again. | Goes out on its own | None. | None. |
| [`Sequence.create`](https://startupbuilder.dev/business/nouns/sequence/create) | Saves a timed series of emails and tasks: the steps, the waits between them and what ends a run. | Runs on its own | None. | None. |
| [`Sequence.update`](https://startupbuilder.dev/business/nouns/sequence/update) | Changes a Sequence’s steps or waits; a run under way keeps the step it is on. | Runs on its own | None. | None. |
| [`Funnel.create`](https://startupbuilder.dev/business/nouns/funnel/create) | Saves your path from landing page to opt-in to Sequence to offer, so each drop between steps is one number. | Runs on its own | None. | None. |

## Events
| Event | Emitted by |
| --- | --- |
| `Contact.enrolled` | [`Contact.enroll`](/code/apps/sequences/enroll) |
| `Enrollment.paused` | [`Enrollment.pause`](https://startupbuilder.dev/business/nouns/enrollment/pause) |
| `Enrollment.resumed` | [`Enrollment.resume`](https://startupbuilder.dev/business/nouns/enrollment/resume) |
| `Enrollment.canceled` | [`Enrollment.cancel`](https://startupbuilder.dev/business/nouns/enrollment/cancel) |
| `Lead.nurtured` | [`Lead.nurture`](https://startupbuilder.dev/business/nouns/lead/nurture) |
| `Sequence.created` | [`Sequence.create`](https://startupbuilder.dev/business/nouns/sequence/create) |

A [Trigger](https://startupbuilder.dev/business/nouns/trigger) can start a Workflow on any of them, and a Watch delivers each to your endpoint, signed ([Events and webhooks](/code/events)).

## Who operates it
| Part | Sequences |
| --- | --- |
| Accountable | [Prospector](https://startupbuilder.dev/agents/sales/prospector) |
| Also calls its Verbs | [Marketing lead](https://startupbuilder.dev/agents/marketing/marketing-lead), [Success Manager](https://startupbuilder.dev/agents/customer/success-manager) |
| Seat | An agent holds each seat until you seat a person in it. |
| Asks you first | None of its Verbs: each runs within its seat’s Limits |

## Integrations
[Gmail](/code/integrations/gmail) · [Outlook](/code/integrations/outlook) · [LinkedIn](/code/integrations/linkedin)

## Import and export
| Direction | What | How |
| --- | --- | --- |
| Import | A Sequence written elsewhere | `Sequence.create` with its steps; each step’s copy is checked for unresolved claims before it sends |
| Export | Each run and why it ended | `Collection.export` of Enrollments, with `exitReason` |

## Example
**Three touches that stop on the first reply.**

1. `Sequence.create` saves three emails: day 0, day 3 and day 8, Monday to Thursday, from the 2 warmed Mailboxes on tryleaseline.app.
2. `Contact.enroll` starts 50 verified people; at 25 a day a Mailbox, the first touches go out over one sending day.
3. Two reply on day 3. Each reply ends that run, `exitReason: replied`, before the next step sends.
4. One asks to be left alone. `Contact.unsubscribe` ends the run and every future send to her.