---
title: "Returns the current Code Health of a component, ranked against the other components of the project."
method: GET
path: "/api/projects/{project-id}/components/{component-id}/quality/code-health"
tags: ["quality"]
---

# Returns the current Code Health of a component, ranked against the other components of the project.

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

## 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}/components/{component-id}/quality/code-health`
- Auth: none declared

## Path parameters

- `project-id` integer, required
- `component-id` integer, required

## Response `200`

- union
  - object
    - `projectId` integer, required: The numeric ID of the project the unit belongs to.
    - `asOf` string, date-time, required: ISO 8601 datetime of when the snapshot was taken.
    - `comparisonPeriod` object, required: Date range used to compute the delta values.
      - `from` string, date, required: Start date of the period (inclusive).
      - `to` string, date, required: End date of the period (inclusive).
    - `type` 'team' | 'component', required: Kind of the unit.
    - `analyticalUnitId` integer, required: Analytics analytical-unit ID of the team or component.
    - `name` string, required: Display name of the team or component.
    - `averageCodeHealth` object, required: Code health averaged across all files of the unit.
      - `value` number, nullable, required: Code health score on a scale from 1 to 10.
      - `delta` number, nullable, required: Change in code health score relative to the comparison period. Null if no prior data.
      - `classification` 'unhealthy-code' | 'problematic-code' | 'healthy-code', nullable, required: Human-readable classification of the code health score (e.g. healthy-code, problematic-code, unhealthy-code).
      - `nextGoal` object, nullable: Next benchmark threshold to reach. Present when a higher threshold remains.
        - `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.
      - `trend` TrendInterpretation
        - `direction` 'improving' | 'declining' | 'steady', required: Normalized trend direction for reusable trend consumers.
        - `pace` 'slow' | 'fast', nullable, required: Normalized trend pace. Null when the direction is steady.
      - `series` object[]: Dated code-health history over the comparison period. Empty when no usable measurements exist.
        - `date` string, date, required: Date of the code-health measurement.
        - `value` number, required: Code-health score measured on this date.
    - `hotspotCodeHealth` object, required: Code health averaged across hotspot files of the unit.
      - `value` number, nullable, required: Code health score on a scale from 1 to 10.
      - `delta` number, nullable, required: Change in code health score relative to the comparison period. Null if no prior data.
      - `classification` 'unhealthy-code' | 'problematic-code' | 'healthy-code', nullable, required: Human-readable classification of the code health score (e.g. healthy-code, problematic-code, unhealthy-code).
      - `nextGoal` object, nullable: Next benchmark threshold to reach. Present when a higher threshold remains.
        - `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.
      - `trend` TrendInterpretation
        - `direction` 'improving' | 'declining' | 'steady', required: Normalized trend direction for reusable trend consumers.
        - `pace` 'slow' | 'fast', nullable, required: Normalized trend pace. Null when the direction is steady.
      - `series` object[]: Dated code-health history over the comparison period. Empty when no usable measurements exist.
        - `date` string, date, required: Date of the code-health measurement.
        - `value` number, required: Code-health score measured on this date.
    - `context` object: Benchmark interpretation and next goal for the latest scores.
      - `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: AI readiness interpretation and next goal for the latest scores.
      - `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.
    - `peers` object, required: Rank of the unit among the units of the same kind in the project.
      - `averageCodeHealth` object: Rank of the average code health. Absent when the unit has no score.
        - `rank` integer, required: Competition rank among the units of the same kind in the project, 1 being the highest score. Tied units share a rank.
        - `peerCount` integer, required: Number of units of the same kind with a score, this unit included.
        - `median` number, required: Median score across those units.
      - `hotspotCodeHealth` object: Rank of the hotspot code health. Absent when the unit has no score.
        - `rank` integer, required: Competition rank among the units of the same kind in the project, 1 being the highest score. Tied units share a rank.
        - `peerCount` integer, required: Number of units of the same kind with a score, this unit included.
        - `median` number, required: Median score across those units.
    - `files` object, required: Aggregate counts across the files the unit owns: a team owns the files it is the main team of, a component the files mapped to it.
      - `totalFiles` integer, required: Total number of files in the inventory.
      - `hotspotCount` integer, required: Number of files classified as hotspots.
      - `upliftTargetCount` integer, required: Number of files classified as uplift targets.
      - `healthyHotspotCount` integer, required: Number of hotspots with healthy code health.
      - `offboardingRiskCount` integer: Number of files that are off-boarding risks. Absent in results generated before this field was introduced.
  - object
    - `status` 'pending_reanalysis', required: Reported when the latest analysis has no packaged results for the unit yet.
    - `message` string, required: Human-readable explanation for the returned status.

## Other responses

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

## Changes

- **2026-10-19** `e443e0b6bc89`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/codescene/apis/codescene-api/changes/api/projects/:project-id/components/:component-id/quality/code-health/get.md)

---

[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)
