---
title: "Mark a test as quarantined"
method: POST
path: "/ci/{owner}/repositories/{repository}/quarantines"
tags: ["test_insights"]
deprecated: true
---

# Mark a test as quarantined

`POST /ci/{owner}/repositories/{repository}/quarantines`

## Request

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

> **Deprecated.**

Deprecated: use the test states API, `/ci/{owner}/repositories/{repository}/test-states`.

Add a test to the CI Quarantine for a repository

## Path parameters

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

## Request body

- AddTestToQuarantinePayload
  - `test_name` string, required: The fully qualified name of the test that needs to be quarantined
  - `reason` string, required: Reason for the test being added to the quarantine
  - `issue_url` string, nullable: Link to where the fix of the test is tracked, such as an issue in your issue tracker. Must be an `http` or `https` URL.
  - `branch_name` string, nullable: Branch name on which the test should be quarantined. If not specified, it will be quarantined on all branches. `branch` is accepted as a deprecated alias.
  - `pipeline_name` string, nullable: Pipeline in which the test should be quarantined. If not specified, it will be quarantined in all pipelines.
  - `job_name` string, nullable: Job in which the test should be quarantined. If not specified, it will be quarantined in all jobs.
  - `unquarantine_when_healthy` boolean: Unquarantine the test once it recovers, when Mergify no longer detects it as flaky or broken.
  - `branch` string, nullable: Deprecated: use `branch_name`.

## Response `201`

Successful Response

- TestAddedToQuarantineResponse
  - `id` string, uuid, required: The ID of the created quarantine

## Other responses

- `400`: `TEST_ALREADY_QUARANTINED`: The test already has a quarantine applying to some of the same runs.
- `403`: Forbidden
- `404`: Not found
- `409`: Conflict
- `422`: Unprocessable entity

## Changes

- **2026-10-22** `f0fe01773ba8`: 1 warning, 1 info
  - added the new `TEST_STATE_OVERLAP` enum value to the `error_code` response property for the response status `400`
  - endpoint deprecated
- **2026-10-21** `24834a2d3673`: 1 breaking, 1 info
  - removed the media type `application/json` for the response with the status `409`
  - removed the `REPOSITORY_NOT_RECORDED` enum value from the `error_code` response property for the response status `400`
- **2026-10-21** `b46b77eba26e`: 3 warning, 1 info
  - added the new `PIPELINE_NAME_TAKEN` enum value to the `error_code` response property for the response status `400`
  - added the new `PIPELINE_NOT_FOUND` enum value to the `error_code` response property for the response status `400`
  - added the new `REPOSITORY_NOT_RECORDED` enum value to the `error_code` response property for the response status `400`
  - added the media type `application/json` for the response with the status `409`
- **2026-10-20** `8669053cf863`: 1 warning, 1 info
  - added the new `SUBSCRIPTION_API_UNAVAILABLE` enum value to the `error_code` response property for the response status `400`
  - removed the `SHADOW_OFFICE_UNAVAILABLE` enum value from the `error_code` response property for the response status `400`
- **2026-10-19** `a01b82176fba`: 1 info
  - added the new optional request property `issue_url`

[Operation history](https://skmtc.dev/mergify/apis/mergify-api/changes/ci/:owner/repositories/:repository/quarantines/post.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)
