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

# Update Test Optimization service settings

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

Partially update Test Optimization settings for a specific service identified by repository, service name, and environment.
Only provided fields are updated; setting a field to `null` is a no-op.
To reset a setting to inherit from the repository level, use the corresponding `<setting>_inherit` field.
The `pr_comments_enabled` field is ignored as it cannot be overridden at the service level.

## Request body

- TestOptimizationUpdateServiceSettingsRequest — Request object for updating Test Optimization service settings.
  - `data` TestOptimizationUpdateServiceSettingsRequestData, required — Data object for update service settings request.
    - `attributes` TestOptimizationUpdateServiceSettingsRequestAttributes, required — Attributes for updating Test Optimization service settings. All non-required fields are optional; only provided fields will be updated. Setting a field to `null` is a no-op. To reset a setting to inherit from the repository level, use the corresponding `<setting>_inherit` field.
      - `auto_test_retries_enabled` boolean — Whether Auto Test Retries are enabled for this service. Setting to `null` is a no-op; use `auto_test_retries_enabled_inherit` to reset to repository-level inheritance.
      - `auto_test_retries_enabled_inherit` boolean — When `true`, resets the Auto Test Retries setting to inherit from the repository level.
      - `code_coverage_enabled` boolean — Whether Code Coverage is enabled for this service. Setting to `null` is a no-op; use `code_coverage_enabled_inherit` to reset to repository-level inheritance.
      - `code_coverage_enabled_inherit` boolean — When `true`, resets the Code Coverage setting to inherit from the repository level.
      - `early_flake_detection_enabled` boolean — Whether Early Flake Detection is enabled for this service. Setting to `null` is a no-op; use `early_flake_detection_enabled_inherit` to reset to repository-level inheritance.
      - `early_flake_detection_enabled_inherit` boolean — When `true`, resets the Early Flake Detection setting to inherit from the repository level.
      - `env` string — The environment name. If omitted, defaults to `none`.
      - `failed_test_replay_enabled` boolean — Whether Failed Test Replay is enabled for this service. Setting to `null` is a no-op; use `failed_test_replay_enabled_inherit` to reset to repository-level inheritance.
      - `failed_test_replay_enabled_inherit` boolean — When `true`, resets the Failed Test Replay setting to inherit from the repository level.
      - `pr_comments_enabled` boolean — This field is ignored. PR Comments cannot be overridden at the service level.
      - `repository_id` string, required — The repository identifier.
      - `service_name` string, required — The service name.
      - `test_impact_analysis_enabled` boolean — Whether Test Impact Analysis is enabled for this service. Setting to `null` is a no-op; use `test_impact_analysis_enabled_inherit` to reset to repository-level inheritance.
      - `test_impact_analysis_enabled_inherit` boolean — When `true`, resets the Test Impact Analysis setting to inherit from the repository level.
    - `type` 'test_optimization_update_service_settings_request', required — JSON:API type for update service settings request. The value must always be `test_optimization_update_service_settings_request`.

## Response `200`

OK

- TestOptimizationServiceSettingsResponse — Response object containing Test Optimization service settings.
  - `data` TestOptimizationServiceSettingsData — Data object for Test Optimization service settings response.
    - `attributes` TestOptimizationServiceSettingsAttributes — Attributes for Test Optimization service settings.
      - `auto_test_retries_enabled` boolean — Whether Auto Test Retries are enabled for this service.
      - `auto_test_retries_enabled_is_overridden` boolean — Whether the Auto Test Retries setting is overridden at the service level.
      - `code_coverage_enabled` boolean — Whether Code Coverage is enabled for this service.
      - `code_coverage_enabled_is_overridden` boolean — Whether the Code Coverage setting is overridden at the service level.
      - `early_flake_detection_enabled` boolean — Whether Early Flake Detection is enabled for this service.
      - `early_flake_detection_enabled_is_overridden` boolean — Whether the Early Flake Detection setting is overridden at the service level.
      - `env` string — The environment name.
      - `failed_test_replay_enabled` boolean — Whether Failed Test Replay is enabled for this service.
      - `failed_test_replay_enabled_is_overridden` boolean — Whether the Failed Test Replay setting is overridden at the service level.
      - `pr_comments_enabled` boolean — Whether PR Comments are enabled. This value reflects the repository-level setting and cannot be overridden at the service level.
      - `repository_id` string — The repository identifier.
      - `service_name` string — The service name.
      - `test_impact_analysis_enabled` boolean — Whether Test Impact Analysis is enabled for this service.
      - `test_impact_analysis_enabled_is_overridden` boolean — Whether the Test Impact Analysis setting is overridden at the service level.
    - `id` string — Unique identifier for the service settings.
    - `type` 'test_optimization_service_settings' — JSON:API type for service settings response. The value must always be `test_optimization_service_settings`.

## 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)
