# molted journeys

Source: https://molted.email/docs/cli/journeys

Manage journey orchestration

| Command | Description |
| - | - |
| [`molted journeys create`](#molted-journeys-create) | Create a new journey |
| [`molted journeys list`](#molted-journeys-list) | List all journeys |
| [`molted journeys get`](#molted-journeys-get) | Get a journey by ID |
| [`molted journeys update`](#molted-journeys-update) | Update a journey |
| [`molted journeys add-step`](#molted-journeys-add-step) | Add a step to a journey |
| [`molted journeys update-step`](#molted-journeys-update-step) | Update a step in a journey (refused while the journey is active: pause it first) |
| [`molted journeys delete-step`](#molted-journeys-delete-step) | Delete a step from a journey (refused while the journey is active: pause it first) |
| [`molted journeys delete`](#molted-journeys-delete) | Delete a journey in draft, paused, archived or completed status (an active one must be paused or archived first; remaining runs are cancelled) |
| [`molted journeys runs`](#molted-journeys-runs) | Manage journey runs (list, cancel). Deprecated: `runs <id>` alone still works as `runs list <id>`. |
| [`molted journeys runs list`](#molted-journeys-runs-list) | List runs for a journey |
| [`molted journeys runs cancel`](#molted-journeys-runs-cancel) | Cancel a single journey run |
| [`molted journeys runs cancel-all`](#molted-journeys-runs-cancel-all) | Cancel every active run of a journey |
| [`molted journeys trigger`](#molted-journeys-trigger) | Trigger journeys by ingesting an event. Prints \{ eventId, journeys }: per journey with this trigger event, "started" with run\_id, or "skipped" with a reason (already\_active, trigger\_conditions\_not\_met, journey\_not\_active, no\_steps) |

## Agent context

Journeys are automated multi-step email sequences triggered by events. A journey defines a series of steps (send, delay, branch, end) that execute in order when a trigger event fires for a contact.

### Create a journey end-to-end

```bash
# 1. Create templates for each step (declare every {{variable}}, or lint fails;
#    a marketing template also needs an unsubscribe link, see templates --help)
molted templates create --name "Day 1" --slug onboard-day1 --type transactional \
  --subject "Welcome {{name}}" --body "<h1>Welcome!</h1>" \
  --variables '[{"name": "name", "type": "string", "required": true}]' --auto-publish
# → { "template": { "id": "<uuid>", "slug": "onboard-day1", ... }, "version": {...}, ... }

# 2. Create the journey with a trigger event (it starts as a draft)
molted journeys create --name "Onboarding" --trigger-event signup
# → { "id": "<uuid>" }

# 3. Add steps in order (templateId takes the template's id or its slug)
molted journeys add-step <journeyId> --step-order 1 --step-type send \
  --config '{"templateId": "onboard-day1"}'
molted journeys add-step <journeyId> --step-order 2 --step-type delay \
  --config '{"delayMinutes": 1440}'
molted journeys add-step <journeyId> --step-order 3 --step-type send \
  --config '{"templateId": "<templateId>", "mailboxId": "<mailboxId>"}'
molted journeys add-step <journeyId> --step-order 4 --step-type end

# 4. Activate the journey
molted journeys update <journeyId> --status active

# 5. Trigger it for a contact
molted journeys trigger --event signup --contact alice@example.com \
  --properties '{"name": "Alice", "plan": "pro"}'
# → { "eventId": "<uuid>", "journeys": [
#     { "journey_id": "<uuid>", "journey_name": "Onboarding", "outcome": "started", "run_id": "<uuid>" } ] }
#   Runs start before the response returns. One entry per journey with this
#   trigger event: "started" with the run id, or "skipped" with a reason:
#     already_active             the contact already has an active run in it (active_run_id)
#     trigger_conditions_not_met the payload does not meet its trigger conditions
#     journey_not_active         it is paused, draft, archived or deleted (journey_status)
#     no_steps                   it has no steps
#   An empty list means no journey triggers on this event.
```

### Step types

- send — sends an email using a template. Config: \{ templateId, payload?, mailboxId? }. Set mailboxId to send from a specific mailbox (defaults to the tenant's default mailbox). Use `molted mailboxes list` to find the id.
- delay — waits N minutes before the next step Config: \{ delayMinutes } (default 60).
- branch — conditional routing. `field` is a dot path resolved against the trigger payload from `journeys trigger`/`--properties` (a bare field like "plan" and "properties.plan" are equivalent; "triggerPayload.plan" also works). Operators: eq, neq, gt, lt, contains, exists (value is not needed for exists). The first matching condition wins; every nextStepOrder must be greater than this step's own step-order (no looping back); example config: '\{"conditions":\[\{"field":"properties.plan","operator":"eq","value":"pro","nextStepOrder":3}],"defaultNextStepOrder":4}' (the legacy '\{"conditions":\[...],"onMatch":\{"nextStep":3},"onNoMatch":\{"nextStep":4}}' shape, where all conditions AND together, is still accepted but deprecated)
- end — terminates the journey

### Journey statuses

- draft - a new journey: nothing runs until you set it to active
- active — processing triggers and running steps
- paused — stops processing new triggers; in-flight runs are parked (deferred) and pick back up once the journey is active again
- archived — stops processing and cancels every in-flight run. Not permanent — set status back to active to reactivate.

Stopping on a reply (on by default):\
When a contact replies, every active run of a journey with exit on reply stops for them (status cancelled, reason contact\_replied), once the journey has already sent them an email. Automatic replies (out of office), delivery notices, spam and mail the safety check quarantined or rejected never count; an opt-out does. Pending approvals of the run are rejected. Turn it off for a journey that should keep going after a reply:

```bash
molted journeys update <journeyId> --no-exit-on-reply
```

Weekdays only (off by default):\
A journey can hold a send that falls on a Saturday or Sunday until Monday. The weekend is judged in a time zone, never UTC, and there is no default zone: turning it on needs `--timezone` (an IANA name), or one already stored on the journey. A contact's own timezone (contacts create/update `--timezone`) wins over the journey's when it has one.

```bash
molted journeys create --name "Nurture" --trigger-event signup \
  --weekdays-only --timezone America/Los_Angeles --weekend-hold-until 09:00
molted journeys update <journeyId> --weekdays-only --timezone Europe/Stockholm
molted journeys update <journeyId> --no-weekend-hold-until   # clear the Monday time
molted journeys update <journeyId> --no-weekdays-only --no-timezone
```

A held send goes out on Monday at `--weekend-hold-until` (24-hour HH:MM, local), or, with none set, at the same local time it was due. Delay and branch steps are not held, and a delay after a held send counts from when that send went out. A weekdays-only journey without a zone, an unknown zone, or a time that is not HH:MM is a 400.

### Delete a journey you no longer need (e.g. a test one)

```bash
molted journeys delete <journeyId>
# → { "deleted": true, "id": "...", "cancelledRuns": 0 }
```

Works for a draft, paused, archived or completed journey. An active journey is refused: pause or archive it first (`molted journeys update <id> --status paused`). Any run still waiting (a paused journey's parked runs) is cancelled, and its pending send approvals are rejected. The journey disappears from list and get; its run and send history is kept.

### Monitor and manage journey runs

```bash
molted journeys runs list <journeyId>
# → the 100 most recent runs, with their current step and status

molted journeys runs cancel <journeyId> <runId>
# → cancel one in-flight run

molted journeys runs cancel-all <journeyId>
# → cancel every active run of a journey (pulls every contact out without archiving)
```

### Measure journey effectiveness

```bash
molted outcomes journey-impact
# → shows conversion/revenue attributed to each journey
```

Related: [`molted templates`](https://molted.email/docs/cli/templates.md), [`molted send`](https://molted.email/docs/cli/send.md), [`molted outcomes`](https://molted.email/docs/cli/outcomes.md), [`molted contacts`](https://molted.email/docs/cli/contacts.md)

## Commands

### molted journeys create

Create a new journey

```bash
molted journeys create [options]
```

| Option | Description | Default |
| - | - | - |
| `--name <name>` | Journey name (required) (required) | |
| `--trigger-event <event>` | Trigger event name (required) (required) | |
| `--trigger-conditions <json>` | Trigger conditions as JSON: only events whose payload has every key equal to the given value start a run, e.g. '\{"plan":"pro"}' | |
| `--exit-on-reply` | Stop a contact's run when they reply (the default) | |
| `--no-exit-on-reply` | Keep sending after a contact replies | |
| `--weekdays-only` | Hold a send that falls on a Saturday or Sunday until Monday (needs `--timezone`; a contact's own timezone wins) | |
| `--no-weekdays-only` | Send on weekends too (the default) | |
| `--timezone <iana>` | IANA time zone the weekend is judged in, e.g. America/Los\_Angeles (no default) | |
| `--weekend-hold-until <HH:MM>` | With `--weekdays-only`: 24-hour local time a held send goes out on Monday (default: the time it was due) | |

### molted journeys list

List all journeys

```bash
molted journeys list
```

### molted journeys get

Get a journey by ID

```bash
molted journeys get <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | Journey ID | yes |

### molted journeys update

Update a journey

```bash
molted journeys update [options] <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | Journey ID | yes |

| Option | Description | Default |
| - | - | - |
| `--name <name>` | Journey name | |
| `--status <status>` | Status (active\|paused\|archived) | |
| `--exit-on-reply` | Stop a contact's run when they reply (applies to runs in flight) | |
| `--no-exit-on-reply` | Keep sending after a contact replies | |
| `--weekdays-only` | Hold a send that falls on a Saturday or Sunday until Monday (needs a timezone, stored or given with `--timezone`) | |
| `--no-weekdays-only` | Send on weekends too | |
| `--timezone <iana>` | IANA time zone the weekend is judged in, e.g. America/Los\_Angeles | |
| `--no-timezone` | Clear the journey time zone (refused while `--weekdays-only` is on) | |
| `--weekend-hold-until <HH:MM>` | 24-hour local time a held send goes out on Monday | |
| `--no-weekend-hold-until` | Clear it: a held send goes out at the time it was due, on Monday | |

### molted journeys add-step

Add a step to a journey

```bash
molted journeys add-step [options] <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | Journey ID | yes |

| Option | Description | Default |
| - | - | - |
| `--step-order <n>` | Step order (integer) (required) (required) | |
| `--step-type <type>` | Step type (send\|delay\|branch\|end) (required) (required) | |
| `--config <json>` | Step config as JSON | |

### molted journeys update-step

Update a step in a journey (refused while the journey is active: pause it first)

```bash
molted journeys update-step [options] <journeyId> <stepId>
```

| Argument | Description | Required |
| - | - | - |
| `<journeyId>` | Journey ID | yes |
| `<stepId>` | Step ID | yes |

| Option | Description | Default |
| - | - | - |
| `--step-order <n>` | New step order (integer) | |
| `--step-type <type>` | Step type (send\|delay\|branch\|end) | |
| `--config <json>` | Step config as JSON | |

### molted journeys delete-step

Delete a step from a journey (refused while the journey is active: pause it first)

```bash
molted journeys delete-step <journeyId> <stepId>
```

| Argument | Description | Required |
| - | - | - |
| `<journeyId>` | Journey ID | yes |
| `<stepId>` | Step ID | yes |

### molted journeys delete

Delete a journey in draft, paused, archived or completed status (an active one must be paused or archived first; remaining runs are cancelled)

```bash
molted journeys delete <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | Journey ID | yes |

### molted journeys runs

Manage journey runs (list, cancel). Deprecated: `runs <id>` alone still works as `runs list <id>`.

```bash
molted journeys runs [id]
```

| Argument | Description | Required |
| - | - | - |
| `[id]` | Journey ID (deprecated shorthand for `runs list <id>`) | no |

### molted journeys runs list

List runs for a journey

```bash
molted journeys runs list <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | Journey ID | yes |

### molted journeys runs cancel

Cancel a single journey run

```bash
molted journeys runs cancel <journeyId> <runId>
```

| Argument | Description | Required |
| - | - | - |
| `<journeyId>` | Journey ID | yes |
| `<runId>` | Run ID | yes |

### molted journeys runs cancel-all

Cancel every active run of a journey

```bash
molted journeys runs cancel-all <journeyId>
```

| Argument | Description | Required |
| - | - | - |
| `<journeyId>` | Journey ID | yes |

### molted journeys trigger

Trigger journeys by ingesting an event. Prints \{ eventId, journeys }: per journey with this trigger event, "started" with run\_id, or "skipped" with a reason (already\_active, trigger\_conditions\_not\_met, journey\_not\_active, no\_steps)

```bash
molted journeys trigger [options]
```

| Option | Description | Default |
| - | - | - |
| `--event <name>` | Event name (required) (required) | |
| `--contact <email>` | Contact email (required) (required) | |
| `--properties <json>` | Event payload as JSON (required) (required) | |

See [CLI overview](https://molted.email/docs/cli.md) for global options, credentials and output format.
