---
title: "Find coverage risk areas"
method: GET
path: "/api/v1/user/projects/{projectId}/coverage/risk-areas"
tags: ["Coverage"]
---

# Find coverage risk areas

`GET /api/v1/user/projects/{projectId}/coverage/risk-areas`

## Request

- Base URL: `https://app.gaffer.sh`
- URL: `https://app.gaffer.sh/api/v1/user/projects/{projectId}/coverage/risk-areas`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in header `X-API-Key`
  - HTTP bearer

Returns areas of code that have both low coverage AND test failures.
Cross-references test results with coverage data to identify high-risk
areas that need attention. Results are sorted by risk score (highest first).
The analysis period is clamped by your plan tier.

## Path parameters

- `projectId` string, required

## Query parameters

- `days` integer
- `coverageThreshold` number

## Response `200`

Risk areas sorted by risk score

- CoverageRiskAreasResponse: Files with both low coverage and test failures, sorted by risk score.
  - `hasCoverage` boolean, required
  - `hasTestResults` boolean, required
  - `riskAreas` RiskArea[], required
    - `filePath` string, required
    - `coverage` number, required: Line coverage percentage (0-100)
    - `failureCount` integer, required: Number of test failures touching this file
    - `riskScore` number, required: Composite risk score (0-100, higher = more risky)
    - `testNames` string[], required: Names of failing tests associated with this file
  - `message` string, nullable
  - `analysisParams` object, required
    - `days` integer, required
    - `coverageThreshold` number, required
  - `meta` Meta, nullable: Present when query parameters were clamped by plan tier limits. Only included in the response when clamping actually occurred.
    - `appliedDays` integer: The actual days value used after clamping
    - `requestedDays` integer: The days value originally requested
    - `appliedLimit` integer: The actual limit value used after clamping
    - `requestedLimit` integer: The limit value originally requested
    - `clampedByPlan` boolean: Always true when this object is present

## Other responses

- `400`: Invalid request parameters
- `401`: Missing or invalid API key
- `404`: Resource not found

---

[API](https://skmtc.dev/gaffer/apis/gaffer-api.md) · [All operations](https://skmtc.dev/gaffer/apis/gaffer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/gaffer/apis/gaffer-api/revisions/d742ab303118?raw)
