---
title: "Update Flaky Tests Management policies"
method: PATCH
path: "/api/v2/ci/test-optimization/settings/policies"
tags: ["Test Optimization"]
---

# Update Flaky Tests Management policies

`PATCH /api/v2/ci/test-optimization/settings/policies`

Partially update Flaky Tests Management repository-level policies for the given repository.
Only provided policy blocks are updated; omitted blocks are left unchanged.

## Request body

- TestOptimizationFlakyTestsManagementPoliciesUpdateRequest — Request object for updating Flaky Tests Management policies.
  - `data` TestOptimizationFlakyTestsManagementPoliciesUpdateRequestData, required — Data object for update Flaky Tests Management policies request.
    - `attributes` TestOptimizationFlakyTestsManagementPoliciesUpdateRequestAttributes, required — Attributes for updating Flaky Tests Management policies. Only provided policy blocks are updated; omitted blocks are left unchanged.
      - `attempt_to_fix` TestOptimizationFlakyTestsManagementPoliciesAttemptToFix — Configuration for the attempt-to-fix Flaky Tests Management policy.
        - `retries` integer — Number of retries when attempting to fix a flaky test. Must be greater than 0.
      - `disabled` TestOptimizationFlakyTestsManagementPoliciesDisabled — Configuration for the disabled Flaky Tests Management policy.
        - `auto_disable_rule` TestOptimizationFlakyTestsManagementPoliciesAutoDisableRule — Automatic disable triggering rule based on a time window and test status.
          - `enabled` boolean — Whether this auto-disable rule is enabled.
          - `status` 'active' | 'quarantined' — Test status that the disable policy applies to. Must be either `active` or `quarantined`.
          - `window_seconds` integer — Time window in seconds over which flakiness is evaluated. Must be greater than 0.
        - `branch_rule` TestOptimizationFlakyTestsManagementPoliciesBranchRule — Branch filtering rule for a Flaky Tests Management policy.
          - `branches` string[] — List of branches to which the policy applies.
          - `enabled` boolean — Whether this branch rule is enabled.
          - `excluded_branches` string[] — List of branches excluded from the policy.
          - `excluded_test_services` string[] — List of test services excluded from the policy.
        - `enabled` boolean — Whether the disabled policy is enabled.
        - `failure_rate_rule` TestOptimizationFlakyTestsManagementPoliciesDisabledFailureRateRule — Failure-rate-based rule for the disabled policy.
          - `branches` string[] — List of branches to which this rule applies.
          - `enabled` boolean — Whether this failure rate rule is enabled.
          - `min_runs` integer — Minimum number of runs required before the rule is evaluated. Must be greater than or equal to 0.
          - `status` 'active' | 'quarantined' — Test status that the disable policy applies to. Must be either `active` or `quarantined`.
          - `threshold` number, double — Failure rate threshold (0.0–1.0) above which the rule triggers.
      - `quarantined` TestOptimizationFlakyTestsManagementPoliciesQuarantined — Configuration for the quarantined Flaky Tests Management policy.
        - `auto_quarantine_rule` TestOptimizationFlakyTestsManagementPoliciesAutoQuarantineRule — Automatic quarantine triggering rule based on a time window.
          - `enabled` boolean — Whether this auto-quarantine rule is enabled.
          - `window_seconds` integer — Time window in seconds over which flakiness is evaluated. Must be greater than 0.
        - `branch_rule` TestOptimizationFlakyTestsManagementPoliciesBranchRule — Branch filtering rule for a Flaky Tests Management policy.
          - `branches` string[] — List of branches to which the policy applies.
          - `enabled` boolean — Whether this branch rule is enabled.
          - `excluded_branches` string[] — List of branches excluded from the policy.
          - `excluded_test_services` string[] — List of test services excluded from the policy.
        - `enabled` boolean — Whether the quarantined policy is enabled.
        - `failure_rate_rule` TestOptimizationFlakyTestsManagementPoliciesQuarantinedFailureRateRule — Failure-rate-based rule for the quarantined policy.
          - `branches` string[] — List of branches to which this rule applies.
          - `enabled` boolean — Whether this failure rate rule is enabled.
          - `min_runs` integer — Minimum number of runs required before the rule is evaluated. Must be greater than or equal to 0.
          - `threshold` number, double — Failure rate threshold (0.0–1.0) above which the rule triggers.
      - `repository_id` string, required — The repository identifier.
    - `type` 'test_optimization_update_flaky_tests_management_policies_request', required — JSON:API type for update Flaky Tests Management policies request. The value must always be `test_optimization_update_flaky_tests_management_policies_request`.

## Response `200`

OK

- TestOptimizationFlakyTestsManagementPoliciesResponse — Response object containing Flaky Tests Management policies for a repository.
  - `data` TestOptimizationFlakyTestsManagementPoliciesData — Data object for Flaky Tests Management policies response.
    - `attributes` TestOptimizationFlakyTestsManagementPoliciesAttributes — Attributes of the Flaky Tests Management policies for a repository.
      - `attempt_to_fix` TestOptimizationFlakyTestsManagementPoliciesAttemptToFix — Configuration for the attempt-to-fix Flaky Tests Management policy.
        - `retries` integer — Number of retries when attempting to fix a flaky test. Must be greater than 0.
      - `disabled` TestOptimizationFlakyTestsManagementPoliciesDisabled — Configuration for the disabled Flaky Tests Management policy.
        - `auto_disable_rule` TestOptimizationFlakyTestsManagementPoliciesAutoDisableRule — Automatic disable triggering rule based on a time window and test status.
          - `enabled` boolean — Whether this auto-disable rule is enabled.
          - `status` 'active' | 'quarantined' — Test status that the disable policy applies to. Must be either `active` or `quarantined`.
          - `window_seconds` integer — Time window in seconds over which flakiness is evaluated. Must be greater than 0.
        - `branch_rule` TestOptimizationFlakyTestsManagementPoliciesBranchRule — Branch filtering rule for a Flaky Tests Management policy.
          - `branches` string[] — List of branches to which the policy applies.
          - `enabled` boolean — Whether this branch rule is enabled.
          - `excluded_branches` string[] — List of branches excluded from the policy.
          - `excluded_test_services` string[] — List of test services excluded from the policy.
        - `enabled` boolean — Whether the disabled policy is enabled.
        - `failure_rate_rule` TestOptimizationFlakyTestsManagementPoliciesDisabledFailureRateRule — Failure-rate-based rule for the disabled policy.
          - `branches` string[] — List of branches to which this rule applies.
          - `enabled` boolean — Whether this failure rate rule is enabled.
          - `min_runs` integer — Minimum number of runs required before the rule is evaluated. Must be greater than or equal to 0.
          - `status` 'active' | 'quarantined' — Test status that the disable policy applies to. Must be either `active` or `quarantined`.
          - `threshold` number, double — Failure rate threshold (0.0–1.0) above which the rule triggers.
      - `quarantined` TestOptimizationFlakyTestsManagementPoliciesQuarantined — Configuration for the quarantined Flaky Tests Management policy.
        - `auto_quarantine_rule` TestOptimizationFlakyTestsManagementPoliciesAutoQuarantineRule — Automatic quarantine triggering rule based on a time window.
          - `enabled` boolean — Whether this auto-quarantine rule is enabled.
          - `window_seconds` integer — Time window in seconds over which flakiness is evaluated. Must be greater than 0.
        - `branch_rule` TestOptimizationFlakyTestsManagementPoliciesBranchRule — Branch filtering rule for a Flaky Tests Management policy.
          - `branches` string[] — List of branches to which the policy applies.
          - `enabled` boolean — Whether this branch rule is enabled.
          - `excluded_branches` string[] — List of branches excluded from the policy.
          - `excluded_test_services` string[] — List of test services excluded from the policy.
        - `enabled` boolean — Whether the quarantined policy is enabled.
        - `failure_rate_rule` TestOptimizationFlakyTestsManagementPoliciesQuarantinedFailureRateRule — Failure-rate-based rule for the quarantined policy.
          - `branches` string[] — List of branches to which this rule applies.
          - `enabled` boolean — Whether this failure rate rule is enabled.
          - `min_runs` integer — Minimum number of runs required before the rule is evaluated. Must be greater than or equal to 0.
          - `threshold` number, double — Failure rate threshold (0.0–1.0) above which the rule triggers.
      - `repository_id` string — The repository identifier.
    - `id` string — The repository identifier used as the resource ID.
    - `type` 'test_optimization_flaky_tests_management_policies' — JSON:API type for Flaky Tests Management policies response. The value must always be `test_optimization_flaky_tests_management_policies`.

## Other responses

- `400` — Bad Request
- `403` — Not Authorized
- `404` — Not Found
- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
