# Auto Sequences

Auto sequences (formerly auto queues): multi-step sequences contacts are enrolled into, with their steps and enrollments. The older /auto-queues/* and /event-queues/* paths still work.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### POST /auto-sequences/:queue_id/steps

Add a step to a sequence.

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences-queue-id-steps.md)

### POST /auto-sequences/:queue_id/bulk-enroll

Bulk-enrol contacts or opportunities in a sequence. Pass ids directly, or a filter to enrol everything matching it. At least one of contact_ids, deal_ids, contact_filter or customer_filter is required. To RESUME a series for people who already received its first steps, backdate enrollment_time so the steps they already had fall in the past and set skip_past_steps: true; only the future steps are scheduled. Example: steps at Day 0, 2, 4, 6 and the person had the first two, so set enrollment_time to now minus 2 days minus 1 hour (for a sequence with count_business_days, count back in open days). Returns enrolled, skipped, failed, past_steps_skipped and past_steps_scheduled; a warning is returned when a backdated enrolment without skip_past_steps scheduled past steps, which all send within a minute.

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences-queue-id-bulk-enroll.md)

### POST /auto-sequences

Create an auto sequence (formerly auto queue).

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences.md)

### DELETE /auto-sequences/:queue_id

Delete an auto sequence (formerly auto queue).

**Scopes:** `automations:delete` — [full detail](./auto-sequences/delete-auto-sequences-queue-id.md)

### DELETE /auto-sequences/:queue_id/steps/:step_id

Delete a step from a sequence.

**Scopes:** `automations:delete` — [full detail](./auto-sequences/delete-auto-sequences-queue-id-steps-step-id.md)

### GET /auto-sequences/:queue_id

Fetch an auto sequence (formerly auto queue) by UUID with its steps.

**Scopes:** `automations:read` — [full detail](./auto-sequences/get-auto-sequences-queue-id.md)

### GET /auto-sequences/:queue_id/board

Read-only kanban-shaped state for an Auto Sequence. Returns active enrolments bucketed into columns by the step they last completed (column 0 = "Awaiting Step 1"; column N = after step N), plus terminal counts (completed / cancelled). Use this to answer "where is contact X in sequence Y" or "how many contacts are at each step" without grouping per-task rows from list_auto_sequence_enrollments client-side. Each column returns up to 50 cards — for terminal-state drill-in, call list_auto_sequence_enrollments with status=completed or status=cancelled.

**Scopes:** `automations:read` — [full detail](./auto-sequences/get-auto-sequences-queue-id-board.md)

### GET /auto-sequences/:queue_id/enrollments

List enrollments in a sequence.

**Scopes:** `automations:read` — [full detail](./auto-sequences/get-auto-sequences-queue-id-enrollments.md)

### GET /auto-sequences/:queue_id/steps

List steps in a sequence.

**Scopes:** `automations:read` — [full detail](./auto-sequences/get-auto-sequences-queue-id-steps.md)

### GET /auto-sequences

List auto sequences (formerly auto queues): timed drip follow-ups.

**Scopes:** `automations:read` — [full detail](./auto-sequences/get-auto-sequences.md)

### POST /auto-sequences/remove-all-enrollments

Remove a contact or deal from EVERY Auto Sequence (formerly auto queue) in the workspace at once, cancelling all of their still-pending steps across all sequences. Pass ONE of contact_id or deal_id. Use this instead of calling remove_from_auto_sequence once per sequence when you want a full unenrol (e.g. the customer unsubscribed or churned). Returns cancelled_count (total pending steps stopped) and queues_affected; cancelled_count: 0 means nothing was pending for that contact/deal in any sequence.

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences-remove-all-enrollments.md)

### POST /auto-sequences/:queue_id/remove-enrollment

Remove a contact or deal from an auto sequence (formerly auto queue) by cancelling their pending steps. Pass queue_id plus ONE of: enrollment_id (most precise — from get_auto_sequence_board cards or list_auto_sequence_enrollments), contact_id, or deal_id. This is the direct unenrol — no need to build, enable, and trigger a remove_from_event_queue automation. Returns cancelled_count (the real number of pending steps stopped) and a message; cancelled_count: 0 with an explanatory message means nothing was pending for that enrolment (already completed, already removed, or never enrolled).

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences-queue-id-remove-enrollment.md)

### POST /auto-sequences/:queue_id/retry-failed

Retry failed steps in an auto sequence (formerly auto queue), in bulk. Use this when steps show status "failed" with a reason saying they were never sent, which happens when the dispatcher stopped part-way through a large batch. Find them first with list_auto_sequence_enrollments using status="failed" and read each last_error. Pass queue_id alone to consider every failed step in the sequence, or narrow with event_queue_step_id (re-send one step to everyone it missed), contact_id, enrollment_id, or an explicit task_ids list. SAFE TO REPEAT: every step is checked against its automation run record first, and only steps proven never to have reached the send path are requeued, so this cannot message someone twice. Returns retried, skipped_already_sent, skipped_unconfirmed and considered. skipped_already_sent means those recipients did get the message and were deliberately left alone; skipped_unconfirmed means delivery could not be established either way, so they were not re-sent and need a human to check.

**Scopes:** `automations:write` — [full detail](./auto-sequences/post-auto-sequences-queue-id-retry-failed.md)

### PATCH /auto-sequences/:queue_id

Update an auto sequence (formerly auto queue).

**Scopes:** `automations:write` — [full detail](./auto-sequences/patch-auto-sequences-queue-id.md)

### PATCH /auto-sequences/:queue_id/steps/:step_id

Update a step in a sequence.

**Scopes:** `automations:write` — [full detail](./auto-sequences/patch-auto-sequences-queue-id-steps-step-id.md)
