---
title: "Returns historical Code Health metrics over time."
method: GET
path: "/api/projects/{project-id}/quality/code-health/trend"
tags: ["quality"]
---

# Returns historical Code Health metrics over time.

`GET /api/projects/{project-id}/quality/code-health/trend`

## Request

- Base URL: `https://codescene.io` (the document declares no server; this is the origin it was published from)
- URL: `https://codescene.io/api/projects/{project-id}/quality/code-health/trend`
- Auth: none declared

## Path parameters

- `project-id` integer, required

## Query parameters

- `type` 'team' | 'component'
- `name` string
- `pageSize` integer
- `pageToken` string
- `sort` string
- `from` string, date
- `to` string, date

## Response `200`

- CodeHealthTrend
  - `projectId` integer, required: The numeric ID of the project.
  - `period` object, required: Date range covered by the trend series.
    - `from` string, date, required: Start date of the period (inclusive).
    - `to` string, date, required: End date of the period (inclusive).
  - `metrics` string[], required: List of metric names included in the trend series.
  - `series` object[], required: Ordered list of data points forming the trend.
    - `date` string, required: Date of this data point.
    - `averageCodeHealth` number, nullable, required: Average code health score across all files on this date.
    - `hotspotCodeHealth` number, nullable, required: Average code health score across hotspot files on this date.
    - `projections` object: Projected Code Health based on PR actions (fixed vs ignored).
      - `realized` object, required
        - `averageCodeHealth` number, nullable, required
      - `potential` object, required
        - `averageCodeHealth` number, nullable, required
  - `context` object, required: Benchmark-based interpretation and next goal for the latest scores in the trend.
    - `averageCodeHealth` object: Interpretation and next goal for average code health.
      - `interpretation` object, required: Benchmark interpretation of the current code health score.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
      - `nextGoal` object, nullable, required: Next benchmark threshold to reach. Absent when the score is already at the top.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
    - `hotspotCodeHealth` object: Interpretation and next goal for hotspot code health.
      - `interpretation` object, required: Benchmark interpretation of the current code health score.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
      - `nextGoal` object, nullable, required: Next benchmark threshold to reach. Absent when the score is already at the top.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
  - `aiReadinessContext` object, required: AI readiness interpretation and next goal for the latest scores in the trend.
    - `averageCodeHealth` object: Interpretation and next goal for average code health.
      - `interpretation` object, required: Benchmark interpretation of the current code health score.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
      - `nextGoal` object, nullable, required: Next benchmark threshold to reach. Absent when the score is already at the top.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
    - `hotspotCodeHealth` object: Interpretation and next goal for hotspot code health.
      - `interpretation` object, required: Benchmark interpretation of the current code health score.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
      - `nextGoal` object, nullable, required: Next benchmark threshold to reach. Absent when the score is already at the top.
        - `id` string, required: Unique identifier of the benchmark entry.
        - `label` string, required: Human-readable label for the benchmark entry.
        - `type` 'threshold' | 'benchmark' | 'ai-readiness', required: The source and context for the entry: benchmark, threshold, or ai-readiness score.
        - `value` number, required: Numeric value associated with the benchmark entry.
  - `nextPageToken` string: Opaque cursor for the next page. Absent on the last page or when all results fit in one page.

## Other responses

- `400`
- `401`
- `403`
- `404`

---

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