> ## 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 the comments for a specific file or a single comment

> # Access control rules

- The requester must have access to the repository.
- Reviewers have access to the comments made by their team and public
  comments by any other role.
- Judges and triagers have access to all comments except internal comments.
- Clients and admins have access to all comments.



## OpenAPI

````yaml GET /api/v0/repositories/{repo_id}/comments/files/{path}
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}/comments/files/{path}:
    get:
      tags:
        - repositories
      summary: List the comments for a specific file or a single comment
      description: >-
        # Access control rules


        - The requester must have access to the repository.

        - Reviewers have access to the comments made by their team and public
          comments by any other role.
        - Judges and triagers have access to all comments except internal
        comments.

        - Clients and admins have access to all comments.
      operationId: file_comments
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: path
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ResourceRef'
      responses:
        '200':
          description: Comments
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FileComment'
        '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: File not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '500':
          description: Error accessing file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    ResourceRef:
      oneOf:
        - type: string
          format: uuid
          description: Resource id.
        - type: string
          description: Resource handle, e.g. a user's username or a team handle.
      description: Reference to a resource, either by `id` or `handle` (`username`).
    FileComment:
      type: object
      description: Comment made on a file.
      required:
        - id
        - lines
        - content
        - reactions
        - createdBy
        - lastUpdatedBy
        - lastUpdatedAt
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        lines:
          $ref: '#/components/schemas/InclusiveRangeInt'
          description: The line(s) refered to in the comment.
        parent:
          type:
            - string
            - 'null'
          format: uuid
          description: Comment is in a reply to a thread.
        visibleTo:
          type:
            - string
            - 'null'
          format: uuid
          description: |-
            ID of the team whose users can see the comment,
            or NULL if the comment is visible to all users.
        content:
          type: string
          description: Content of the comment, usually in Markdown.
        reactions:
          type: array
          items:
            $ref: '#/components/schemas/CommentReaction'
          description: Reactions to the comment.
        createdBy:
          $ref: '#/components/schemas/RepositoryUser'
          description: User that made the comment.
        lastUpdatedBy:
          $ref: '#/components/schemas/RepositoryUser'
          description: User that last updated the comment.
        lastUpdatedAt:
          type: string
          format: date-time
          description: |-
            Time at which the last update was made.
            Note: Check against created_at to see if comment has been updated,
        resolvedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Time at which the comment was resolved, or none if the comment
            thread is not resolved.

            Only set on the parent comment.
        resolvedBy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/RepositoryUser'
              description: |-
                User that resolved the comment thread, if any. Deduced from the
                most recent `resolved_at` change recorded in `file_comment_log`.
        createdAt:
          type: string
          format: date-time
          description: Time at which the comment was made.
    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.
    InclusiveRangeInt:
      type: object
      description: >-
        Represent a range where both the start and end are included in the
        range.
      required:
        - start
        - end
      properties:
        start:
          type: integer
          format: int32
        end:
          type: integer
          format: int32
    CommentReaction:
      type: object
      description: Reaction to a comment.
      required:
        - reaction
        - users
      properties:
        reaction:
          type: string
          description: Reaction, e.g. a unicode emoji such as `👍`.
        users:
          type: array
          items:
            $ref: '#/components/schemas/CommentReactionUser'
          description: Users that reacted with this reaction.
    RepositoryUser:
      type: object
      description: User data in the context of a repository.
      required:
        - userId
        - name
        - username
        - repositoryRole
        - avatar
        - isBot
        - createdAt
      properties:
        userId:
          type: string
          format: uuid
          description: User id, not to be confused with a client id.
        name:
          type: string
        username:
          type: string
        teamId:
          type:
            - string
            - 'null'
          format: uuid
          description: |-
            Id of the team the reviewer is a part of.

            For non-reviewers, this will be null.
        pingsLeft:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Number of times the reviewer can ping the client.


            Visible to admins, company users, and reviewers only when viewing
            their own info.


            For non-reviewers, this will be null.
        reputation:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Reputation of an auditor, always in the range of `0..=100`.


            Visible to admins, clients, judges and triagers only. Only returned
            in the

            finding's creator field (`Finding.created_by.reputation`), not in
            other

            places.


            For non-reviewers, this will be null.
        repositoryRole:
          $ref: '#/components/schemas/RepositoryRole'
        avatar:
          type: string
        isBot:
          type: boolean
        createdAt:
          type: string
          format: date-time
        disabledAt:
          type:
            - string
            - 'null'
          format: date-time
          description: User is disabled and doesn't have access to Cantina any more.
        deletedFromRepoAt:
          type:
            - string
            - 'null'
          format: date-time
          description: User is deleted from the repository.
    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
    CommentReactionUser:
      type: object
      description: User that posted a reaction to a comment.
      required:
        - id
        - name
      properties:
        id:
          type: string
          format: uuid
          description: User id.
        name:
          type: string
          description: Name of the user (NOTE **not** username).
    RepositoryRole:
      type: string
      description: Role of a user in the context of a repository.
      enum:
        - client
        - reviewer
        - judge
        - triager
        - admin

````