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

# Get a list of unhealthy tests



## OpenAPI

````yaml /openapi.json post /flaky-tests/list-unhealthy-tests
openapi: 3.1.0
info:
  title: Trunk APIs
  version: 1.0.0
  license:
    name: UNLICENSED
servers:
  - url: https://api.trunk.io/v1
security: []
paths:
  /flaky-tests/list-unhealthy-tests:
    post:
      summary: Get a list of unhealthy tests
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                repo:
                  type: object
                  properties:
                    host:
                      type: string
                      description: >-
                        The host of the repository. For example, `github.com` or
                        `gitlab.com`. If self-hosting, this will be the hostname
                        of your instance.
                      examples:
                        - github.com
                        - gitlab.com
                        - github-enterprise.my-org-tld.com
                        - gitlab-enterprise.my-org-tld.com
                    owner:
                      type: string
                      description: >-
                        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.
                      examples:
                        - my-github-org
                        - my-gitlab-org/my/sub/group
                    name:
                      type: string
                      description: The name of the repository.
                      examples:
                        - my-repo
                  required:
                    - host
                    - owner
                    - name
                  description: The repository to list tests for.
                org_url_slug:
                  type: string
                  description: >-
                    The slug of your organization. Find this at
                    https://app.trunk.io/trunk/settings under "Organization
                    Name" > "Slug"
                  examples:
                    - my-trunk-org-slug
                page_query:
                  type: object
                  properties:
                    page_size:
                      type: integer
                      minimum: 1
                      maximum: 100
                      description: The number of tests to return per page.
                    page_token:
                      type: string
                      description: >-
                        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.
                      examples:
                        - ''
                  required:
                    - page_size
                  description: Pagination options for the list of tests.
                status:
                  type: string
                  enum:
                    - FLAKY
                    - BROKEN
                  description: The status filter for unhealthy tests.
              required:
                - repo
                - org_url_slug
                - page_query
                - status
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tests:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: A stable unique identifier for the test
                        repository:
                          type: object
                          properties:
                            html_url:
                              type: string
                              format: uri
                              description: The URL of the repository
                          required:
                            - html_url
                        html_url:
                          type: string
                          format: uri
                          description: The URL of the test details
                        name:
                          type: string
                          description: The name of the test
                        variant:
                          type: string
                          description: The name of the test variant
                        status:
                          type: object
                          properties:
                            value:
                              type: string
                              enum:
                                - healthy
                                - flaky
                                - broken
                              description: The current status value in lowercase
                            reason:
                              type: string
                              description: The reason for the current status
                            timestamp:
                              type: string
                              format: date-time
                              description: The timestamp of the current status change
                          required:
                            - value
                            - reason
                            - timestamp
                        file_path:
                          type: string
                          description: The file path of the test
                        parent:
                          type: string
                          description: >-
                            The parent of the test. This includes the test suite
                            (depending on the test runner)
                        classname:
                          type: string
                          description: The class name of the test
                        codeowners:
                          type: array
                          items:
                            type: string
                          description: Code owners for the test
                        pull_requests_impacted_last_7d:
                          type: integer
                          minimum: 0
                          description: >-
                            The number of pull requests impacted in the last 7
                            days
                        quarantined:
                          type: boolean
                          description: |-
                            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:
                          type: object
                          properties:
                            html_url:
                              type: string
                              format: uri
                              description: The URL of the associated ticket
                          required:
                            - html_url
                      required:
                        - id
                        - repository
                        - html_url
                        - name
                        - variant
                        - status
                        - codeowners
                        - pull_requests_impacted_last_7d
                        - quarantined
                    description: A page of unhealthy test cases.
                  page:
                    type: object
                    properties:
                      total_rows:
                        type: number
                        minimum: 0
                        description: The total number of test cases in the paginated list.
                      total_pages:
                        type: number
                        minimum: 0
                        description: >-
                          The total number of pages in the paginated list of
                          test cases.
                      next_page_token:
                        type: string
                        description: >-
                          The next page token to use for pagination. See
                          `page_token` in the request for more information.
                      prev_page_token:
                        type: string
                        description: >-
                          The previous page token to use for pagination. See
                          `page_token` in the request for more information.
                      last_page_token:
                        type: string
                        description: >-
                          The last page token to use for pagination. See
                          `page_token` in the request for more information.
                      page_index:
                        type: number
                        minimum: 0
                        description: >-
                          The index of the current page in the paginated list of
                          test cases.
                    required:
                      - total_rows
                      - total_pages
                      - next_page_token
                      - prev_page_token
                      - last_page_token
                      - page_index
                    description: Pagination information for the list of test cases.
                required:
                  - tests
                  - page
        '401':
          description: Unauthorized
          content:
            application/plain-text:
              schema:
                type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-token

````