Skip to main content
GET
/
api
/
test-runs
List test runs
curl --request GET \
  --url https://api.empirical.run/api/test-runs \
  --header 'Authorization: Bearer <token>'
{
  "data": {
    "project": {
      "id": 123,
      "name": "<string>",
      "slug": "<string>",
      "repo_name": "<string>"
    },
    "test_runs": {
      "items": [
        {
          "id": 123,
          "total_count": 123,
          "success_count": 123,
          "failed_count": 123,
          "skipped_count": 123,
          "flaky_count": 123,
          "duration": 123,
          "test_run_branch": "<string>",
          "environment_slug": "<string>",
          "environment_name": "<string>",
          "build_url": "<string>",
          "build_branch": "<string>",
          "commit": "<string>",
          "created_at": "<string>"
        }
      ]
    }
  },
  "pagination": {
    "page": 123,
    "per_page": 123,
    "total": 123,
    "total_pages": 123
  }
}
Test runs transition through these states:
StateDescription
pendingRun is queued behind other runs (concurrency limit reached)
queuedRun is queued and will start soon
startedRun is currently executing
endedRun completed successfully
errorRun failed with an error
cancellingRun is being cancelled
cancelledRun was cancelled
A failed run may carry one of these error codes:
Error codeDescription
merge_conflictMerge conflict detected when merging the test branch
dispatch_failedFailed to dispatch the test run to workers
report_not_generatedTest report was not generated
run_failed_with_errorTest run failed with an error during execution
worker_interruptedTest run worker was interrupted
merge_reports_failedFailed to merge sharded reports

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

id
integer

Return only the test run with this exact ID.

Required range: x >= 1
per_page
integer
default:20

Items per page (max 100). Defaults to 20.

Required range: 1 <= x <= 100
page
integer
default:1

Page number (1-indexed). Defaults to 1.

Required range: x >= 1
branch
string

Filter to runs on this test repo branch.

interval_in_days
integer

Restrict to runs created in the last N days.

Required range: x >= 1
state
string

Filter by run state (e.g. queued, ended).

result
enum<string>

Filter by overall run result.

Available options:
passed,
failed
environment_ids
string

Comma-separated environment IDs to filter by.

Response

Paginated list of test runs.

data
object
required
pagination
object
required

Pagination metadata.