> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qlty.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Get component metric series

> Retrieve each metric's history for a specific Component on the 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.



## OpenAPI

````yaml https://api.qlty.sh/openapi.json get /gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components/{componentIdOrName}/metrics/series
openapi: 3.1.0
info:
  title: Qlty API
  version: 1.0.0
  description: >-
    The Qlty API is organized around REST. It provides predictable,
    resource-oriented URLs, accepts JSON-encoded request bodies, and returns
    JSON-encoded responses.
servers:
  - url: https://api.qlty.sh
security:
  - Bearer: []
tags:
  - name: Service
    description: Service status and API discovery operations
  - name: User
    description: Operations for the authenticated user
  - name: Workspaces
    description: Operations for managing workspaces
  - name: Projects
    description: Operations for managing projects
  - name: Issues
    description: Operations for managing issues
  - name: Metrics
    description: Operations for retrieving metrics
  - name: Components
    description: Operations for retrieving components
  - name: Coverage
    description: Operations for retrieving code coverage data
paths:
  /gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components/{componentIdOrName}/metrics/series:
    get:
      tags:
        - Metrics
      summary: Get component metric series
      description: >-
        Retrieve each metric's history for a specific Component on the 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.
      operationId: getComponentMetricSeries
      parameters:
        - schema:
            type: string
            minLength: 3
            example: acme-corp
            description: Repository owner name (login) or workspace ID
          required: true
          description: Repository owner name (login) or workspace ID
          name: ownerKeyOrId
          in: path
        - schema:
            type: string
            minLength: 3
            example: my-repo
            description: Repository name or project ID
          required: true
          description: Repository name or project ID
          name: projectKeyOrId
          in: path
        - schema:
            type: string
            minLength: 1
            example: backend-api
            description: Component ID or name
          required: true
          description: Component ID or name
          name: componentIdOrName
          in: path
        - schema:
            type: string
            format: date-time
            example: '2026-01-01'
            description: >-
              Window start (RFC 3339 date or date-time, inclusive). Defaults to
              six months before `to`.
          required: false
          description: >-
            Window start (RFC 3339 date or date-time, inclusive). Defaults to
            six months before `to`.
          name: from
          in: query
        - schema:
            type: string
            format: date-time
            example: '2026-06-01'
            description: >-
              Window end (RFC 3339 date or date-time, inclusive). Defaults to
              the current time and is clamped to it.
          required: false
          description: >-
            Window end (RFC 3339 date or date-time, inclusive). Defaults to the
            current time and is clamped to it.
          name: to
          in: query
        - schema:
            type: string
            enum:
              - day
              - week
              - month
            default: week
            description: Bucket size; buckets are UTC-aligned and weeks start Monday
          required: false
          description: Bucket size; buckets are UTC-aligned and weeks start Monday
          name: interval
          in: query
        - schema:
            anyOf:
              - type: array
                items:
                  type: string
                  enum:
                    - CMPLX
                    - DUP
                    - MNT
                    - SEC
                    - SIZE
                    - ISS
                    - SECI
                    - TDR
                    - FILES
                    - LOC
                    - COV
                    - LCOV
              - type: string
                enum:
                  - CMPLX
                  - DUP
                  - MNT
                  - SEC
                  - SIZE
                  - ISS
                  - SECI
                  - TDR
                  - FILES
                  - LOC
                  - COV
                  - LCOV
            description: Filter by metric key
          required: false
          description: Filter by metric key
          name: metric
          in: query
        - schema:
            anyOf:
              - type: array
                items:
                  type: string
                  enum:
                    - maintainability
                    - reliability
                    - security
                    - size
                    - coverage
                    - quality
              - type: string
                enum:
                  - maintainability
                  - reliability
                  - security
                  - size
                  - coverage
                  - quality
            description: Filter by metric category
          required: false
          description: Filter by metric category
          name: category
          in: query
      responses:
        '200':
          description: Retrieve metric time series for a component
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricSeriesList'
              example:
                data:
                  - metric:
                      key: LCOV
                      name: Line Coverage
                      description: Percentage of lines covered by tests
                      category: coverage
                      inverted: false
                      valueType: percentage
                    dimensions: {}
                    points:
                      - timestamp: '2026-01-04T23:59:59Z'
                        value: 78.9
                      - timestamp: '2026-01-11T23:59:59Z'
                        value: 80.2
                meta:
                  from: '2025-12-29T00:00:00Z'
                  to: '2026-01-09T12:00:00Z'
                  interval: week
            application/x-ndjson:
              schema:
                type: string
                description: >-
                  Newline-delimited JSON (NDJSON); one object per point with
                  `metric`, `timestamp`, and `value`
            text/csv:
              schema:
                type: string
                description: >-
                  CSV with a `timestamp` column followed by one column per
                  metric key
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate Limit Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    MetricSeriesList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MetricSeries'
        meta:
          $ref: '#/components/schemas/MetricSeriesMeta'
      required:
        - data
        - meta
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
                example: '400'
              title:
                type: string
                example: Bad Request
              detail:
                type: string
                example: The request was invalid.
            required:
              - status
              - title
              - detail
      required:
        - errors
    MetricSeries:
      type: object
      properties:
        metric:
          $ref: '#/components/schemas/MetricDescriptor'
        dimensions:
          type: object
          properties: {}
          description: Reserved for future grouping dimensions; always empty
        points:
          type: array
          items:
            $ref: '#/components/schemas/MetricPoint'
      required:
        - metric
        - dimensions
        - points
    MetricSeriesMeta:
      type: object
      properties:
        from:
          type: string
          example: '2025-12-01T00:00:00Z'
        to:
          type: string
          example: '2026-06-01T00:00:00Z'
        interval:
          type: string
          enum:
            - day
            - week
            - month
          example: week
      required:
        - from
        - to
        - interval
    MetricDescriptor:
      type: object
      properties:
        key:
          type: string
          example: CMPLX
        name:
          type: string
          example: Cognitive Complexity
        description:
          type: string
          example: Measures how hard the code is to understand
        category:
          type: string
          enum:
            - maintainability
            - reliability
            - security
            - size
            - coverage
            - quality
          example: maintainability
        inverted:
          type: boolean
          example: true
          description: When true, higher values are worse
        valueType:
          type: string
          enum:
            - number
            - percentage
            - grade
            - size
            - duration
            - count
          example: number
          description: How the metric's value should be interpreted
      required:
        - key
        - name
        - category
        - inverted
        - valueType
    MetricPoint:
      type: object
      properties:
        timestamp:
          type: string
          example: '2026-01-11T23:59:59Z'
          description: >-
            Inclusive end of the interval bucket (RFC 3339, UTC). The final
            point labels the bucket containing `meta.to`, so its timestamp may
            be later than `meta.to` — including in the future for an interval
            still in progress.
        value:
          oneOf:
            - type: number
            - type: string
              enum:
                - XS
                - S
                - M
                - L
                - XL
            - type: string
              enum:
                - A
                - B
                - C
                - D
                - F
          example: 42
          description: The metric's value for the interval
      required:
        - timestamp
        - value
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: Generate an API token at https://qlty.sh/user/settings/tokens

````