> ## Documentation Index
> Fetch the complete documentation index at: https://docs.empirical.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a test run

> Retrieves a single test run by ID, including its project and per-test summary details. Access is derived from the run's project; inaccessible or unknown runs return 404.



## OpenAPI

````yaml /api-reference/openapi.generated.json get /api/test-runs/{id}
openapi: 3.1.0
info:
  title: Empirical API
  version: 1.0.0
  description: Programmatic access to Empirical test runs, snoozes, and more.
  contact:
    name: Empirical
    url: https://empirical.run
servers:
  - url: https://api.empirical.run
security:
  - Bearer: []
tags:
  - name: Test Runs
    description: Trigger, list, and inspect end-to-end test runs.
  - name: Test Cases
    description: >-
      Browse the Playwright test cases synced from a project's repository and
      manage their tags.
  - name: Environments
    description: >-
      Named deployment targets (slug + Playwright project filters) a project's
      tests run against.
  - name: Snoozes
    description: Temporarily suppress known test failures for specific Playwright tests.
  - name: Analytics
    description: Aggregated test-run, test-count and test-case analytics for a project.
  - name: Resources
    description: >-
      Project file resources — uploads stored in R2 and external link-type files
      (e.g. Google Sheets).
  - name: Badges
    description: Public README status badge images (SVG) for project environments.
paths:
  /api/test-runs/{id}:
    get:
      tags:
        - Test Runs
      summary: Get a test run
      description: >-
        Retrieves a single test run by ID, including its project and per-test
        summary details. Access is derived from the run's project; inaccessible
        or unknown runs return 404.
      operationId: getTestRun
      parameters:
        - schema:
            type: integer
            minimum: 1
            description: Test run ID.
          required: true
          description: Test run ID.
          name: id
          in: path
      responses:
        '200':
          description: The test run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTestRunResponse'
        '400':
          description: Invalid x-project-id or x-project-slug header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Test run not found or not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    GetTestRunResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            test_run:
              type: object
              properties:
                project:
                  type: object
                  properties:
                    id:
                      type: number
                      description: Project ID.
                    name:
                      type: string
                      description: Project name.
                    repo_name:
                      type: string
                      description: Repository name for the project.
                  required:
                    - id
                    - name
                    - repo_name
                testRun:
                  $ref: '#/components/schemas/TestRunDetail'
                flattenedSummaryDetails:
                  type: array
                  items:
                    nullable: true
                  description: Detailed results for each test case.
              required:
                - project
                - testRun
                - flattenedSummaryDetails
          required:
            - test_run
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        data:
          nullable: true
          description: Always null for error responses.
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message.
          required:
            - message
          description: Error details.
      required:
        - data
        - error
    TestRunDetail:
      type: object
      properties:
        id:
          type: number
          description: Unique identifier.
        state:
          type: string
          enum:
            - pending
            - queued
            - started
            - ended
            - error
            - cancelled
            - cancelling
          description: Current state of the test run.
        total_count:
          type: number
          description: Total number of test cases.
        success_count:
          type: number
          description: Number of passed tests.
        failed_count:
          type: number
          description: Number of failed tests.
        skipped_count:
          type: number
          nullable: true
          description: Number of skipped tests.
        flaky_count:
          type: number
          nullable: true
          description: Number of flaky tests.
        duration:
          type: number
          nullable: true
          description: Duration in milliseconds.
        test_run_branch:
          type: string
          nullable: true
          description: Git branch being tested.
        environment_slug:
          type: string
          nullable: true
          description: Environment identifier.
        environment_name:
          type: string
          nullable: true
          description: Environment display name.
        build_url:
          type: string
          nullable: true
          description: URL of the build being tested.
        build_branch:
          type: string
          nullable: true
          description: Git branch of the build.
        commit:
          type: string
          nullable: true
          description: Commit SHA.
        created_at:
          type: string
          description: ISO 8601 timestamp.
        test_run_head_sha:
          type: string
          nullable: true
          description: Git commit SHA.
        run_started_at:
          type: string
          nullable: true
          description: ISO 8601 timestamp when tests started.
        run_ended_at:
          type: string
          nullable: true
          description: ISO 8601 timestamp when tests ended.
        summary_url:
          type: string
          nullable: true
          description: URL to download the Playwright JSON report for this run.
      required:
        - id
        - state
        - total_count
        - success_count
        - failed_count
        - skipped_count
        - flaky_count
        - duration
        - test_run_branch
        - environment_slug
        - environment_name
        - build_url
        - build_branch
        - commit
        - created_at
        - test_run_head_sha
        - run_started_at
        - run_ended_at
        - summary_url
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````