---
title: "Get code coverage summary for a branch"
method: POST
path: "/api/v2/code-coverage/branch/summary"
tags: ["Code Coverage"]
---

# Get code coverage summary for a branch

`POST /api/v2/code-coverage/branch/summary`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/code-coverage/branch/summary`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `code_coverage_read`

Retrieve aggregated code coverage statistics for a specific branch in a repository.
This endpoint provides overall coverage metrics as well as breakdowns by service
and code owner.

## Request body

- BranchCoverageSummaryRequest: Request object for getting code coverage summary for a branch.
  - `data` BranchCoverageSummaryRequestData, required: Data object for branch summary request.
    - `attributes` BranchCoverageSummaryRequestAttributes, required: Attributes for requesting code coverage summary for a branch.
      - `branch` string, required: The branch name.
      - `repository_id` string: Deprecated: use `repository_url` instead. The repository URL.
      - `repository_url` string: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`).
    - `type` 'ci_app_coverage_branch_summary_request', required: JSON:API type for branch coverage summary request. The value must always be `ci_app_coverage_branch_summary_request`.

## Response `200`

OK

- CoverageSummaryResponse: Response object containing code coverage summary.
  - `data` CoverageSummaryData: Data object for coverage summary response.
    - `attributes` CoverageSummaryAttributes: Attributes object for code coverage summary response.
      - `codeowners` object, nullable: Coverage statistics broken down by code owner.
      - `evaluated_flags_count` integer: Total number of coverage flags evaluated.
      - `evaluated_reports_count` integer: Total number of coverage reports evaluated.
      - `patch_coverage` number, double, nullable: Overall patch coverage percentage.
      - `services` object, nullable: Coverage statistics broken down by service.
      - `total_coverage` number, double, nullable: Overall total coverage percentage.
    - `id` string: Unique identifier for the coverage summary (base64-hashed).
    - `type` 'ci_app_coverage_summary': JSON:API type for coverage summary response. The value must always be `ci_app_coverage_summary`.

## Other responses

- `400`: Bad Request
- `403`: Not Authorized
- `404`: Not Found
- `429`: Too many requests
- `500`: Internal server error

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
