---
title: "Search tests"
method: GET
path: "/ci/{owner}/repositories/{repository}/search/tests"
tags: ["test_insights"]
---

# Search tests

`GET /ci/{owner}/repositories/{repository}/search/tests`

## Request

- Base URL: `https://api.mergify.com/v1`
- URL: `https://api.mergify.com/v1/ci/{owner}/repositories/{repository}/search/tests`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Search tests in a repository.

## Path parameters

- `repository` string, required: The name of the repository
- `owner` string, required: The owner of the repository

## Query parameters

- `test_name` string[], nullable: Filter by test name. Pass multiple times to combine matches. Supports glob patterns (`*`, `?`). Omit to return all test identities.
- `test_name_exclude` string[], nullable: The test name to exclude
- `pipeline_name` string[], nullable: The pipeline name to filter on
- `pipeline_name_exclude` string[], nullable: The pipeline name to exclude
- `job_name` string[], nullable: The job name to filter on
- `job_name_exclude` string[], nullable: The job name to exclude
- `health_status` HealthStatus[], nullable: The health status to filter on
- `health_status_exclude` HealthStatus[], nullable: The health status to exclude
- `failed_executions_impact` string[], nullable: The failed executions impact to filter on
- `failed_executions_impact_exclude` string[], nullable: The failed executions impact to exclude
- `state` TestStateValue[], nullable: The states to filter on.
- `state_exclude` TestStateValue[], nullable: The states to exclude.
- `is_quarantined` boolean, nullable: Deprecated: use `state=quarantined` or `state_exclude=quarantined` instead. Only return tests whose branch, pipeline and job a quarantine covers (`true`) or does not (`false`). Omit to return both.
- `cursor` string, nullable: The opaque cursor of the current page. Must be extracted from RFC 5988 pagination links to get the previous/next pages
- `per_page` integer: The number of items per page
- `sort` 'executions_count' | 'test_name' | 'pipeline_name' | 'job_name' | 'health_status' | 'failed_executions_impact' | 'failed_executions_ratio': Sort field
- `direction` 'asc' | 'desc': Sort direction

## Response `200`

Successful Response

- SearchTestsResponse
  - `size` integer, required: The number of items in this page
  - `per_page` integer, required: The number of items per page
  - `tests` TestSearchResult[], required: Test identities matching the search query.
    - `test_id` string, uuid5, required: Stable identifier of the test. Pass it to the per-test endpoints to fetch details, metrics, or failures.
    - `test_name` string, required: Fully qualified name of the test as reported by the CI provider.
    - `pipeline_name` string, required: Name of the pipeline (workflow) that ran the test.
    - `job_name` string, required: Name of the job within the pipeline that ran the test.
    - `state` 'quarantined', required
    - `is_quarantined` boolean, required: Deprecated: use `state` instead. Whether a quarantine covers this test identity: its branch, pipeline and job.
    - `metrics` TestSearchResultMetrics, required
      - `health_status` 'healthy' | 'flaky' | 'broken', required
      - `failed_executions_impact` 'low' | 'medium' | 'high', nullable, required: Impact of the test's failures, derived from its failure ratio. `null` for healthy tests, which have no meaningful failure impact.
  - `total` integer, required: Total number of test identities matching the search query, across all pages.

## Other responses

- `403`: Forbidden
- `404`: Not found
- `409`: Conflict
- `422`: Unprocessable entity

## Changes

- **2026-10-23** `00b8f4a31190`: 5 info
  - added the new optional `query` request parameter `state`
  - added the new optional `query` request parameter `state_exclude`
  - `query` request parameter `is_quarantined` was deprecated
  - response property `tests/items/is_quarantined` deprecated
  - …1 more
- **2026-10-06** `95a430805010`: 2 info
  - added the new optional `query` request parameter `is_quarantined`
  - added the required property `tests/items/is_quarantined` to the response with the `200` status
- **2026-10-05** `9da975fb5680`: 2 breaking, 2 warning
  - removed the enum value `health_confidence` from the `query` request parameter `sort`
  - removed the required property `tests/items/metrics/health_confidence` from the response with the `200` status
  - deleted the `query` request parameter `health_confidence`
  - deleted the `query` request parameter `health_confidence_exclude`
- **2026-09-08** `58d92e39a2b4`: 2 breaking
  - for the `query` request parameter `direction`, default value was changed from `desc` to `asc`
  - for the `query` request parameter `sort`, default value was changed from `executions_count` to `test_name`
- **2026-09-03** `0d03a872f0d1`: 1 info
  - the endpoint scheme security `CIApplicationKey` was removed from the API

[Operation history](https://skmtc.dev/mergify/apis/mergify-api/changes/ci/:owner/repositories/:repository/search/tests/get.md)

---

[API](https://skmtc.dev/mergify/apis/mergify-api.md) · [All operations](https://skmtc.dev/mergify/apis/mergify-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mergify/apis/mergify-api/revisions/00b8f4a31190?raw)
