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

# List files in a repository.

> # Access control rules

- The requester must have access to the repository.



## OpenAPI

````yaml GET /api/v0/repositories/{repo_id}/files
openapi: 3.1.0
info:
  title: Cantina Client API
  description: >-
    Endpoints available to client organizations. For an overview and
    authentication, see
    https://docs.cantina.xyz/for-organizations/getting-started/api-access.
  license:
    name: Cantina
    identifier: Cantina
  version: 0.1.0
servers: []
security: []
paths:
  /api/v0/repositories/{repo_id}/files:
    get:
      tags:
        - repositories
      summary: List files in a repository.
      description: |-
        # Access control rules

        - The requester must have access to the repository.
      operationId: list_files
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: List of files
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FileMetadata'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '401':
          description: Access not authorised
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '403':
          description: Access forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '500':
          description: Error listing files
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    FileMetadata:
      type: object
      description: Metadata about a file in a repository.
      required:
        - path
        - symbolicLink
        - inScope
        - mode
        - size
        - lastModified
        - relatedFindings
      properties:
        path:
          type: string
          description: |-
            Path to the file, relative to the root of the repository, e.g.
            `directory/README.md`.
        language:
          type:
            - string
            - 'null'
          description: |-
            Detected programming language used in the file.
            Null if the the language couldn't be determined.
        symbolicLink:
          type: boolean
          description: True if the file is a symbolic link.
        inScope:
          type: boolean
          description: True if the file is considered in scope for reporting finding.
        mode:
          type: integer
          format: int32
          description: File permissions, commonly know as "file mode".
        size:
          type: integer
          format: int32
          description: Size of the file in bytes.
        lastModified:
          type: string
          format: date-time
          description: Timestamp when the file was last modified.
        relatedFindings:
          type: integer
          format: int32
          description: >-
            Number of findings related to this file.


            Note that the amount is limited to the finding the user has access
            to.

            For example for reviewers this means only the finding of their team
            are

            counted.


            If this is zero `highest_severity` will be null.
        highestSeverity:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FindingSeverity'
              description: >-
                Highest severity in the findings related to this file.


                Like `related_findings` this is based on the findings the user
                has

                access to, which means it will differ depending on what kind of
                access

                the user has.


                This will be null if the file has no findings related in it.
    CantinaError:
      type: object
      description: Error returned by the Cantina API.
      required:
        - type
        - msg
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        msg:
          type: string
          description: Error message for the user.
    FindingSeverity:
      type: string
      description: Severity of a [`Finding`].
      enum:
        - critical
        - high
        - medium
        - low
        - informational
        - gas_optimization
    ErrorType:
      type: string
      description: Type of error.
      enum:
        - email_not_verified
        - auth_invalid
        - auth_expired
        - auth_token_missing
        - auth_id_missing
        - invalid_password
        - disabled_user
        - tc_not_accepted
        - evicted
        - unauthorized
        - bad_request
        - not_found
        - forbidden
        - gone
        - payload_too_large
        - service_unavailable
        - internal_error

````