Bulk cancel and replay have lived in the dashboard. Now the same actions run from your backend code, so you can wire them into a deploy script, a scheduled task, or an incident runbook.
Create a bulk action
Pass a filter and Trigger.dev acts on every matching run, from a handful to millions. Replay them after you ship a fix:
import { runs } from "@trigger.dev/sdk";const action = await runs.bulk.replay({ filter: { status: "FAILED", taskIdentifier: "sync-customer", period: "24h", }, name: "Replay failed customer syncs",});
filter is the same shape as runs.list(), so you can select by status, task, tags, queue, version, machine, and region. Already know the exact runs? Pass runIds instead.
One thing to watch: a filter with no time field defaults to the last 7 days. Pass a period like "30d", or a from/to pair, to reach further back.
Cancel works the same way. Here's every queued run for one task:
await runs.bulk.cancel({ filter: { status: "QUEUED", taskIdentifier: "send-email", },});
Replays keep each run's original region. Set targetRegion to send them somewhere else.
Track progress
Both actions run asynchronously and return an id. runs.bulk.poll() waits for the action to finish and hands back the status and counts:
const completed = await runs.bulk.poll(action.id);console.log(completed.status); // "COMPLETED"console.log(completed.counts); // { total: 812, success: 812, failure: 0 }
Started one you'd rather stop? runs.bulk.abort(action.id) halts future batches. Runs already in flight finish on their own.
Read the bulk actions with the SDK docs to get started.

