---
title: "Get a list of unhealthy tests"
method: POST
path: "/flaky-tests/list-unhealthy-tests"
---

# Get a list of unhealthy tests

`POST /flaky-tests/list-unhealthy-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"
  - `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.
  - `status` 'FLAKY' | 'BROKEN', required — The status filter for unhealthy tests.

## Response `200`

OK

- object
  - `tests` object[], required — A page of unhealthy 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
    - `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)
