---
title: "Get a list of distinct tests that failed in the given time range"
method: POST
path: "/flaky-tests/list-failing-tests"
---

# Get a list of distinct tests that failed in the given time range

`POST /flaky-tests/list-failing-tests`

## Request body

- object
  - `repo` object, required — The repository to list tests for.
    - `host` string, required — The host of the repository. For example, `github.com` or `gitlab.com`. If self-hosting, this will be the hostname of your instance.
    - `owner` string, required — The owner of the repository. For example, `my-github-org` or `my-gitlab-org/my/sub/group`. `owner` for GitLab will include the GitLab org, plus the project path, but excluding the repo name itself.
    - `name` string, required — The name of the repository.
  - `org_url_slug` string, required — The slug of your organization. Find this at https://app.trunk.io/trunk/settings under "Organization Name" > "Slug"
  - `start_time` string, date-time, required — The start time of the failing tests (inclusive). Must be within 7 days of the end time.
  - `end_time` string, date-time, required — The end time of the failing tests (exclusive). Must be within 7 days of the start time.
  - `page_query` object, required — Pagination options for the list of tests.
    - `page_size` integer, required — The number of tests to return per page.
    - `page_token` string — The page token to use for pagination. This is returned from the previous call to this endpoint. For the first page, this should be empty.

## Response `200`

OK

- object
  - `tests` object[], required — A page of failing test cases.
    - `id` string, uuid, required — A stable unique identifier for the test
    - `repository` object, required
      - `html_url` string, uri, required — The URL of the repository
    - `html_url` string, uri, required — The URL of the test details
    - `name` string, required — The name of the test
    - `variant` string, required — The name of the test variant
    - `status` object, required
      - `value` 'healthy' | 'flaky' | 'broken', required — The current status value in lowercase
      - `reason` string, required — The reason for the current status
      - `timestamp` string, date-time, required — The timestamp of the current status change
    - `most_common_failures` object[], required — Several of the most common failures of the test. This is behind a feature flag, access to this feature can be requested by reaching out to the Trunk team.
      - `summary` string, required — The summary of the failure
      - `occurrence_count` integer, required — The number of occurrences of this failure
      - `last_occurrence` string, date-time — The timestamp of the last occurrence
    - `failure_rate_last_7d` number, required — The failure rate over the last 7 days
    - `failure_rate_last_24h` number, required — The failure rate over the last 24 hours
    - `file_path` string — The file path of the test
    - `parent` string — The parent of the test. This includes the test suite (depending on the test runner)
    - `classname` string — The class name of the test
    - `codeowners` string[], required — Code owners for the test
    - `pull_requests_impacted_last_7d` integer, required — The number of pull requests impacted in the last 7 days
    - `quarantined` boolean, required — Whether the test is quarantined. This is `true` when quarantining is enabled for the repo and either of the following applies: - The quarantine override is set to `ALWAYS_QUARANTINE` for this test - Automatic quarantining is enabled for the repo, and this test's status is either `flaky` or `broken` If this is `true`, the next test run will be marked as passed even if the test run conclusion is failed.
    - `ticket` object
      - `html_url` string, uri, required — The URL of the associated ticket
  - `page` object, required — Pagination information for the list of test cases.
    - `total_rows` number, required — The total number of test cases in the paginated list.
    - `total_pages` number, required — The total number of pages in the paginated list of test cases.
    - `next_page_token` string, required — The next page token to use for pagination. See `page_token` in the request for more information.
    - `prev_page_token` string, required — The previous page token to use for pagination. See `page_token` in the request for more information.
    - `last_page_token` string, required — The last page token to use for pagination. See `page_token` in the request for more information.
    - `page_index` number, required — The index of the current page in the paginated list of test cases.

## Other responses

- `401` — Unauthorized

---

[API](https://skmtc.net/trunk/apis/trunk-apis.md) · [All operations](https://skmtc.net/trunk/apis/trunk-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/trunk/trunk-apis/versions/f7b911d8e24c/schema)
