Skip to main content

Overview

Returns a cursor-paginated list of runs for an environment. Filter by status, task identifier, tags, date range, and more. Two variants exist:
EndpointAuthScope
GET /api/v1/runsSecret keyCurrent environment only
GET /api/v1/projects/{projectRef}/runsPATAll environments in a project

Endpoint (secret key)

GET https://api.trigger.dev/api/v1/runs

Query parameters

limit
integer
Number of results per page. Defaults to 20.
page[after]
string
Return runs created after this run ID. Used for forward pagination.
page[before]
string
Return runs created before this run ID. Used for backward pagination.
status
string[]
Filter by run status. Accepted values: PENDING_VERSION, QUEUED, EXECUTING, REATTEMPTING, FROZEN, COMPLETED, CANCELED, FAILED, CRASHED, INTERRUPTED, SYSTEM_FAILURE.
taskIdentifier
string[]
Filter by one or more task identifiers.
tag
string[]
Filter by one or more tags attached to runs.
from
string (ISO 8601)
Return runs created at or after this date-time.
to
string (ISO 8601)
Return runs created at or before this date-time.
version
string[]
Filter by worker version, e.g. ["20240523.1"].
isTest
boolean
When true, return only test runs. When false, exclude test runs.
schedule
string
Filter by schedule ID (e.g. sched_1234).
bulkAction
string
Filter by bulk action ID.

Endpoint (Personal Access Token)

GET https://api.trigger.dev/api/v1/projects/{projectRef}/runs
projectRef
string
required
The project reference, e.g. proj_yubjwjsfkxnylobaqvqz.
Supports all of the same query filters above, plus:
env
string[]
Filter by environment. One or more of dev, staging, prod.

Response

data
object[]
Array of run summary objects.
pagination
object
Cursor pagination handles.

Examples

import { runs } from "@trigger.dev/sdk";

// Fetch first page
let page = await runs.list({ limit: 20 });

for (const run of page.data) {
  console.log(`${run.id}: ${run.status}`);
}

// Manual pagination
while (page.hasNextPage()) {
  page = await page.getNextPage();
}

// Auto-paginate through all results
for await (const run of runs.list({ limit: 20 })) {
  console.log(run.id);
}

Response example

{
  "data": [
    {
      "id": "run_p4omhh45hgxxnq1re6ovy",
      "status": "COMPLETED",
      "taskIdentifier": "my-task",
      "version": "20240523.1",
      "env": { "id": "cl1234", "name": "prod" },
      "isTest": false,
      "tags": ["user_5df987al13"],
      "createdAt": "2024-04-01T12:00:00Z",
      "updatedAt": "2024-04-01T12:00:05Z",
      "startedAt": "2024-04-01T12:00:01Z",
      "finishedAt": "2024-04-01T12:00:05Z",
      "durationMs": 4200,
      "costInCents": 0.00292,
      "baseCostInCents": 0.0025
    }
  ],
  "pagination": {
    "next": "run_earlier123",
    "previous": null
  }
}

Build docs developers (and LLMs) love