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

# List pull request files with diff coverage

> Lists the files a pull request adds or modifies, with each file's diff coverage and uncovered lines, matching the Files Changed tab of its Coverage page in Qlty. Coverage from all tags is combined.

A file is listed when its changes include executable lines or its line coverage changed. Coverage can change even when a file gains no executable lines, for example when lines are deleted or tests exercise it differently, or for [reasons outside the pull request](https://docs.qlty.sh/coverage/unexpected-changes).

All files are currently returned in one response, so `meta.hasMore` is `false`. Check it anyway, since a future version may paginate.

If the files can't be listed, `data` is empty and `unavailableReason` explains why.

On private projects, returns `403` if the pull request's author has no [Qlty seat](https://docs.qlty.sh/cloud/billing/seats).



## OpenAPI

````yaml https://api.qlty.sh/openapi.json get /gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files
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}/pulls/{number}/coverage/files:
    get:
      tags:
        - Pull Requests
      summary: List pull request files with diff coverage
      description: >-
        Lists the files a pull request adds or modifies, with each file's diff
        coverage and uncovered lines, matching the Files Changed tab of its
        Coverage page in Qlty. Coverage from all tags is combined.


        A file is listed when its changes include executable lines or its line
        coverage changed. Coverage can change even when a file gains no
        executable lines, for example when lines are deleted or tests exercise
        it differently, or for [reasons outside the pull
        request](https://docs.qlty.sh/coverage/unexpected-changes).


        All files are currently returned in one response, so `meta.hasMore` is
        `false`. Check it anyway, since a future version may paginate.


        If the files can't be listed, `data` is empty and `unavailableReason`
        explains why.


        On private projects, returns `403` if the pull request's author has no
        [Qlty seat](https://docs.qlty.sh/cloud/billing/seats).
      operationId: getPullRequestCoverageFiles
      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: integer
            minimum: 0
            exclusiveMinimum: true
            example: 123
            description: Pull request number
          required: true
          description: Pull request number
          name: number
          in: path
      responses:
        '200':
          description: Changed files with diff coverage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestCoverageFiles'
              example:
                data:
                  - path: lib/discount.rb
                    diffCoverage:
                      value: 83.33
                      coveredLines: 5
                      missedLines: 1
                    uncoveredLines:
                      - 6
                meta:
                  hasMore: false
                unavailableReason: null
        '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:
    PullRequestCoverageFiles:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PullRequestChangedFileCoverage'
        meta:
          type: object
          properties:
            hasMore:
              type: boolean
              example: true
              description: Whether there are more items available beyond this page
          required:
            - hasMore
        unavailableReason:
          $ref: '#/components/schemas/PullRequestCoverageFilesUnavailableReason'
      required:
        - data
        - meta
        - unavailableReason
    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
    PullRequestChangedFileCoverage:
      type: object
      properties:
        path:
          type: string
          example: lib/discount.rb
        diffCoverage:
          $ref: '#/components/schemas/PullRequestFileDiffCoverage'
        uncoveredLines:
          type: array
          items:
            type: integer
          example:
            - 6
          description: >-
            Line numbers, in the head commit, of the added or modified lines
            that no test covers
      required:
        - path
        - diffCoverage
        - uncoveredLines
    PullRequestCoverageFilesUnavailableReason:
      type: string
      nullable: true
      enum:
        - no_coverage
        - diff_too_large
        - no_changed_files
        - null
      description: >-
        Why `data` is empty, or null when the files were listed:


        - `no_coverage`: No coverage has been processed yet. It wasn't uploaded,
        or it's still processing.

        - `diff_too_large`: The pull request changes more than 500 files, or
        GitHub couldn't return its diff.

        - `no_changed_files`: GitHub reports no changed files. It may not have
        computed the diff yet.
    PullRequestFileDiffCoverage:
      type: object
      properties:
        value:
          type: number
          nullable: true
          example: 83.33
          description: >-
            Line coverage of the file's added or modified lines, rounded to two
            decimal places. Null when Qlty finds no executable lines among them:
            the changes only delete lines or add non-executable ones, GitHub
            returns no patch for the file (as it does for large or binary
            changes), or the head coverage doesn't include the file.
        coveredLines:
          type: integer
          example: 5
          description: Added or modified executable lines that tests cover
        missedLines:
          type: integer
          example: 1
          description: Added or modified executable lines that no test covers
      required:
        - value
        - coveredLines
        - missedLines
  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.