v3

latestOpenAPI 3.1.02026-07-311725107.3 KB
Metrics

Get project metric series

Retrieve each metric's history on a Project's default branch as a time series over the requested window. Returns one series per metric — covering maintainability, reliability, security, size, coverage, and quality indicators — each with the metric's descriptor and one value per interval; narrow the result with the metric and category query parameters. Available as JSON, newline-delimited JSON (application/x-ndjson), or CSV (text/csv) via the Accept header. Buckets are UTC-aligned and labeled with the inclusive end of each interval; a bucket with no measurement carries the most recent prior value forward, and the final bucket (the one containing to) may be labeled later than to — including the future for an interval still in progress — with its value reflecting only measurements within the window.

get/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/metrics/series

Path parameters

ownerKeyOrIdstring required

Repository owner name (login) or workspace ID

Example:acme-corp

Repository owner name (login) or workspace ID

projectKeyOrIdstring required

Repository name or project ID

Example:my-repo

Repository name or project ID

Query parameters

fromstring date-time

Window start (RFC 3339 date or date-time, inclusive). Defaults to six months before to.

Example:2026-01-01

Window start (RFC 3339 date or date-time, inclusive). Defaults to six months before to.

tostring date-time

Window end (RFC 3339 date or date-time, inclusive). Defaults to the current time and is clamped to it.

Example:2026-06-01

Window end (RFC 3339 date or date-time, inclusive). Defaults to the current time and is clamped to it.

interval'day' | 'week' | 'month'

Bucket size; buckets are UTC-aligned and weeks start Monday

Bucket size; buckets are UTC-aligned and weeks start Monday

string[]
OR
'CMPLX' | 'DUP' | 'MNT' | 'SEC' | 'SIZE' | 'ISS' | 'SECI' | 'TDR' | 'FILES' | 'LOC' | 'COV' | 'LCOV'

Filter by metric key

string[]
OR
'maintainability' | 'reliability' | 'security' | 'size' | 'coverage' | 'quality'

Filter by metric category

Response

Retrieve metric time series for the project

Example response

{
  "data": [
    {
      "metric": {
        "key": "CMPLX",
        "name": "Cognitive Complexity",
        "description": "Measures how hard the code is to understand",
        "category": "maintainability",
        "inverted": true,
        "valueType": "number"
      },
      "points": [
        {
          "timestamp": "2026-01-11T23:59:59Z"
        }
      ]
    }
  ],
  "meta": {
    "from": "2025-12-01T00:00:00Z",
    "to": "2026-06-01T00:00:00Z",
    "interval": "week"
  }
}