> ## 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.

# Count issues

> Count the issues on a Project's default branch in total, by level and by category. Every level and category is present, with 0 when no issue has it. The counts come from the latest analysis of the default branch, with ignores applied at request time, and `meta.analyzedAt` says when that analysis ran; when the default branch has no analysis, `data` and `meta.analyzedAt` are null. Narrow the counts with `tool` and `status`, which work as they do on List issues; `status` defaults to `open`. A request that passes `level` or `category` is refused with 400, because the counts already cover every level and category. The counts are available only as JSON: a request whose `Accept` header does not accept `application/json`, including one for the `.csv` or `.ndjson` extension, is refused with 406. The issue metrics from Get project metrics are values stored when an analysis finished, so they can differ from these counts after someone ignores an issue, while an analysis is still loading, and after an analysis whose load never finished, until the next analysis of the default branch completes.



## OpenAPI

````yaml https://api.qlty.sh/openapi.json get /gh/{ownerKeyOrId}/projects/{projectKeyOrId}/issues/counts
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: Builds
    description: Operations for retrieving builds
  - name: Metrics
    description: Operations for retrieving metrics
  - name: Components
    description: Operations for retrieving components
  - name: Applications
    description: Operations for managing applications, which group a workspace's projects
  - name: Coverage
    description: Operations for retrieving code coverage data
  - name: Pull Requests
    description: Operations for retrieving pull request coverage
paths:
  /gh/{ownerKeyOrId}/projects/{projectKeyOrId}/issues/counts:
    get:
      tags:
        - Issues
      summary: Count issues
      description: >-
        Count the issues on a Project's default branch in total, by level and by
        category. Every level and category is present, with 0 when no issue has
        it. The counts come from the latest analysis of the default branch, with
        ignores applied at request time, and `meta.analyzedAt` says when that
        analysis ran; when the default branch has no analysis, `data` and
        `meta.analyzedAt` are null. Narrow the counts with `tool` and `status`,
        which work as they do on List issues; `status` defaults to `open`. A
        request that passes `level` or `category` is refused with 400, because
        the counts already cover every level and category. The counts are
        available only as JSON: a request whose `Accept` header does not accept
        `application/json`, including one for the `.csv` or `.ndjson` extension,
        is refused with 406. The issue metrics from Get project metrics are
        values stored when an analysis finished, so they can differ from these
        counts after someone ignores an issue, while an analysis is still
        loading, and after an analysis whose load never finished, until the next
        analysis of the default branch completes.
      operationId: getIssueCounts
      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:
            anyOf:
              - type: array
                items:
                  type: string
                  enum:
                    - open
                    - ignored
              - type: string
                enum:
                  - open
                  - ignored
            default:
              - open
            description: Filter by issue status (defaults to open)
          required: false
          description: Filter by issue status (defaults to open)
          name: status
          in: query
        - schema:
            anyOf:
              - type: array
                items:
                  type: string
              - type: string
            description: Filter by tool name
          required: false
          description: Filter by tool name
          name: tool
          in: query
      responses:
        '200':
          description: Count issues on the project's default branch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssueCounts'
              example:
                data:
                  total: 42
                  level:
                    high: 3
                    medium: 30
                    low: 9
                    note: 0
                    fmt: 0
                  category:
                    bug: 2
                    vulnerability: 1
                    structure: 4
                    duplication: 6
                    security_hotspot: 0
                    performance: 0
                    documentation: 0
                    type_check: 3
                    style: 0
                    anti_pattern: 0
                    accessibility: 0
                    dead_code: 0
                    lint: 26
                    secret: 0
                    dependency_alert: 0
                    unspecified: 0
                meta:
                  analyzedAt: '2026-01-09T12:00:00Z'
        '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'
        '406':
          description: 'Not Acceptable: the counts are available only as JSON'
          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:
    IssueCounts:
      type: object
      properties:
        data:
          type: object
          nullable: true
          properties:
            total:
              type: integer
              example: 42
              description: Number of matching issues
            level:
              $ref: '#/components/schemas/IssueLevelCounts'
            category:
              $ref: '#/components/schemas/IssueCategoryCounts'
          required:
            - total
            - level
            - category
          description: Null when the default branch has no analysis
        meta:
          $ref: '#/components/schemas/IssueCountsMeta'
      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
    IssueLevelCounts:
      type: object
      properties:
        high:
          type: integer
        medium:
          type: integer
        low:
          type: integer
        note:
          type: integer
        fmt:
          type: integer
      required:
        - high
        - medium
        - low
        - note
        - fmt
      description: Number of matching issues at each level
    IssueCategoryCounts:
      type: object
      properties:
        bug:
          type: integer
        vulnerability:
          type: integer
        structure:
          type: integer
        duplication:
          type: integer
        security_hotspot:
          type: integer
        performance:
          type: integer
        documentation:
          type: integer
        type_check:
          type: integer
        style:
          type: integer
        anti_pattern:
          type: integer
        accessibility:
          type: integer
        dead_code:
          type: integer
        lint:
          type: integer
        secret:
          type: integer
        dependency_alert:
          type: integer
        unspecified:
          type: integer
      required:
        - bug
        - vulnerability
        - structure
        - duplication
        - security_hotspot
        - performance
        - documentation
        - type_check
        - style
        - anti_pattern
        - accessibility
        - dead_code
        - lint
        - secret
        - dependency_alert
        - unspecified
      description: Number of matching issues in each category
    IssueCountsMeta:
      type: object
      properties:
        analyzedAt:
          type: string
          nullable: true
          format: date-time
          example: '2026-01-09T12:00:00Z'
          description: >-
            When the latest analysis of the default branch ran (RFC 3339, UTC).
            The counts come from this analysis. Null when `data` is null.
      required:
        - analyzedAt
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: Generate an API token at https://qlty.sh/user/settings/tokens

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.