> ## 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.

# Re-run a test run

> Re-triggers a test run from a source run's branch, build, and overrides. Optionally re-runs only the failed tests of a completed run.



## OpenAPI

````yaml /api-reference/openapi.generated.json post /api/test-runs/{id}/re-run
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}/re-run:
    post:
      tags:
        - Test Runs
      summary: Re-run a test run
      description: >-
        Re-triggers a test run from a source run's branch, build, and overrides.
        Optionally re-runs only the failed tests of a completed run.
      operationId: rerunTestRun
      parameters:
        - schema:
            type: integer
            minimum: 1
            description: Database ID of the test run.
          required: true
          description: Database ID of the test run.
          name: id
          in: path
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerunTestRunRequest'
      responses:
        '200':
          description: The re-triggered test run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTestRunResponse'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Source test run or environment not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    RerunTestRunRequest:
      type: object
      properties:
        only_failed:
          type: boolean
          description: >-
            When true, re-run only the failed tests from the source run. The
            source run must be completed.
        send_notifications:
          type: boolean
          description: >-
            Override whether notifications are sent for the re-run. Defaults to
            the source run's notification setting.
    CreateTestRunResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            trigger:
              type: object
              properties:
                success:
                  type: boolean
                  description: Whether the test run was triggered successfully.
              required:
                - success
            test_run:
              type: object
              properties:
                id:
                  type: number
                  description: Unique identifier for the test run.
                state:
                  type: string
                  description: Current state of the test run.
                test_run_branch:
                  type: string
                  description: Git branch being tested.
                created_at:
                  type: string
                  description: ISO 8601 timestamp when the run was created.
              required:
                - id
                - state
                - test_run_branch
                - created_at
          required:
            - trigger
            - 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
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````