--- title: ATF Code Coverage API description: The ATF Code Coverage API provides endpoints to compute code coverage from Automated Test Framework \(ATF\) runs. Coverage can be retrieved by filtered line numbers, for specific script IDs, or for all scripts covered by a set of test suite/test runs.Aggregates coverage across all scripts covered by the provided ATF runs. Supports combining test suite runs and individual test runs.Computes coverage for specific script records.Computes code coverage using a set of filtered line numbers per metadata record. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/rest-apis/atf-code-coverage-api.html release: australia product: REST APIs classification: rest-apis topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 15 breadcrumb: [REST API reference, API reference, API implementation and reference] --- # ATF Code Coverage API The ATF Code Coverage API provides endpoints to compute code coverage from Automated Test Framework \(ATF\) runs. Coverage can be retrieved by filtered line numbers, for specific script IDs, or for all scripts covered by a set of test suite/test runs. ATF code coverage is a tool that enables you to determine what percentage of code in a deployment request is covered by ATF test suites. By default, if ATF test suites cover less than 70% of the code in a deployment request, ReleaseOps transitions the deployment request to the Reconciling state and a test failure task is automatically created. You can adjust the ATF code coverage threshold in the deployment request assessment playbook. For more information, see [Set Automated Test Framework \(ATF\) code coverage](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/set-atf-code-coverage-threshold.md). For information on ATF and Performance Analyzer, see [Testing and debugging applications](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/testing-and-debugging-applications.md). For information on deployment analyzer, see [Deployment analyzer in ReleaseOps](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/deployment-analyzer.md). **Parent Topic:**[REST API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/api-rest.md) ## ATF Code Coverage - POST /now/atf/code\_coverage/all Aggregates coverage across all scripts covered by the provided ATF runs. Supports combining test suite runs and individual test runs. ### URL format Versioned URL: `/api/now/v1/atf/code_coverage/all` Default URL: `/api/now/atf/code_coverage/all` ### Supported request parameters
| Name | Description |
|---|---|
| api\_version | Optional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String |
| Name | Description |
|---|---|
| test\_suite\_result\_ids | Required unless `test_result_ids` are provided. List of test suite result sys\_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Suite Results \[sys\_atf\_test\_suite\_result\] Data type: Array of strings |
| test\_result\_ids | Required unless `test_suite_result_ids` are provided. List of test result sys\_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Results \[sys\_atf\_test\_result\] Data type: Array of strings |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script.Valid values: - true: Include detailed per-item coverage in the response body **details** object. - false: The response body **details** object will return empty or not at all. Default: false Data type: Boolean |
| sys\_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided.Data type: Array of strings |
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json** |
| Name | Description |
|---|---|
| link | Link to the request record.Data type: String |
| details.<scriptId> | Lists the ATF aggregation coverage percent of each custom test script by script sys\_id.Data type: Number |
| api\_request\_sys\_id | The sys\_id of the request.Table: ATF code coverage API requests \[sys\_atf\_code\_coverage\_request\] Data type: String |
| result |
Success or error message.Error response formats:
- 400 Bad Request
`{ "result": "Validation error: |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the **details** property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided.Possible values: 0-100 Data type: Number |
| truncation\_message | If request data was truncated during persistence, provides details about what scripts have truncated information.Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was\_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using **glide.db.truncate\_utf8** system property as described in the **Additional information** section.Valid values: - true: Request data was truncated during persistence. - false: Request data was not truncated during persistence. Data type: Boolean Default number of characters: 4000 |
| Name | Description |
|---|---|
| api\_version | Optional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String |
| Name | Description |
|---|---|
| test\_suite\_result\_ids | Required unless `test_result_ids` are provided. List of test suite result sys\_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Suite Results \[sys\_atf\_test\_suite\_result\] Data type: Array of strings |
| test\_result\_ids | Required unless `test_suite_result_ids` are provided. List of test result sys\_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Results \[sys\_atf\_test\_result\] Data type: Array of strings |
| script\_array | Required. One or more valid script sys\_ids to evaluate for code coverage. Must contain at least one valid \(non-empty\) script identifier. Null, empty, or whitespace-only entries are filtered out.Table: Metadata Tracing \[sys\_traced\_metadata\] Data type: Array |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script.Valid values: - true: Include detailed per-item coverage in the response body **details** object. - false: The response body **details** object will return empty or not at all. Default: false Data type: Boolean |
| sys\_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided.Data type: Array of strings |
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json** |
| Name | Description |
|---|---|
| link | Link to the request record.Data type: String |
| details.<scriptId> | Lists the ATF aggregation coverage percent of each custom test script by script sys\_id.Data type: Number |
| api\_request\_sys\_id | The sys\_id of the request.Table: ATF code coverage API requests \[sys\_atf\_code\_coverage\_request\] Data type: String |
| result |
Success or error message.Error response formats:
- 400 Bad Request
`{ "result": "Validation error: |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the **details** property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided.Possible values: 0-100 Data type: Number |
| truncation\_message | If request data was truncated during persistence, provides details about what scripts have truncated information.Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was\_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using **glide.db.truncate\_utf8** system property as described in the **Additional information** section.Valid values: - true: Request data was truncated during persistence. - false: Request data was not truncated during persistence. Data type: Boolean Default number of characters: 4000 |
| Name | Description |
|---|---|
| api\_version | Optional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String |
| Name | Description |
|---|---|
| test\_suite\_result\_ids | Required unless `test_result_ids` are provided. List of test suite result sys\_ids. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Suite Results \[sys\_atf\_test\_suite\_result\] Data type: Array of strings |
| test\_result\_ids | Required unless `test_suite_result_ids` are provided. List of test result sys\_ids to include. Both `test_result_ids` and `test_suite_result_ids` can be included in the same request.Table: Test Results \[sys\_atf\_test\_result\] Data type: Array of strings |
| filtered\_lines |
Required. Map of metadata sys\_ids and corresponding code lines to designate for code coverage \(e.g., `{ " |
| filtered\_lines.<sys\_id> | Required, must not be empty. One or more script sys\_ids to evaluate for code coverage. Must contain at least one valid \(non-empty\) script identifier. Null, empty, or whitespace-only entries are filtered out.Table: Metadata Tracing \[sys\_traced\_metadata\] Data type: Object |
| filtered\_lines.<sys\_id>.script | Required. List of line numbers and strings of ranges of lines numbers. All values provided must be positive integers greater than or equal to 1.Valid line number formats: - Individual lines: \[1, 7, 10\] - Ranges: For example, \["1-7"\] expands to \[1, 2, 3, 4, 5, 6, 7\]. - The format is start-end, where the value of start is less than or equal to end. - The maximum range is 10000 lines. - Mixed formats. For example, \[1, "3-6", 7\] expands to \[1, 3, 4, 5, 6, 7\]. Example: ``` { "filtered_lines": { "sys_script_include_db95cb370a0a0b2b00244880b5cacda7": { "script": [1, "3-6", 7, "10-12"] } } } ``` Data type: Array |
| verbose | Flag that indicates level of detail to provide in the response for each custom test script.Valid values: - true: Include detailed per-item coverage in the response body **details** object. - false: The response body **details** object will return empty or not at all. Default: false Data type: Boolean |
| sys\_scopes | Filter results to specified application scopes. For example, `["x_my_app", "global"]`. Multiple scopes use OR logic, so any matching scope is included. No filtering occurs if any empty or NULL array is provided.Data type: Array of strings |
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json** |
| Name | Description |
|---|---|
| link | Link to the request record.Data type: String |
| details.<scriptId> | Lists the ATF aggregation coverage percent of each custom test script by script sys\_id.Data type: Number |
| api\_request\_sys\_id | The sys\_id of the request.Table: ATF code coverage API requests \[sys\_atf\_code\_coverage\_request\] Data type: String |
| result |
Success or error message.Error response formats:
- 400 Bad Request
`{ "result": "Validation error: "`
- `"Invalid data type in filtered_lines: Ensure line numbers are integers or valid range strings (e.g., '1-7')"`
- `"Null value found in filtered_lines structure. All metadata IDs, field names, and line number lists must be non-null"`
- `"Unexpected error processing filtered_lines: |
| total | Overall code coverage percentage reflecting the combined ATF code coverage of the scripts listed in the **details** property. The value is zero if no custom scripts are associated with the tests provided or no percentage of code coverage has been provided.Possible values: 0-100 Data type: Number |
| truncation\_message | If request data was truncated during persistence, provides details about what scripts have truncated information.Example message: `truncation_message: "Field atf_code_coverage_request.metadata_info truncated from 5000 to 4000 characters (max: 4000). Consider increasing column length to prevent data loss"` Data type: String |
| was\_truncated | Flag that indicates whether request data was truncated during persistence. You can change the default number of characters supported using **glide.db.truncate\_utf8** system property as described in the **Additional information** section.Valid values: - true: Request data was truncated during persistence. - false: Request data was not truncated during persistence. Data type: Boolean Default number of characters: 4000 |