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

> # 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
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:
    get:
      tags:
        - repositories
      summary: List file comments.
      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: repo_comments
      parameters:
        - name: limit
          in: query
          description: >-
            Maximum number of comments to return.


            Defaults to 10 comments (not counting replies to that comment),
            limited to 100.
          required: false
          schema:
            type:
              - integer
              - 'null'
            minimum: 0
        - name: next
          in: query
          description: >-
            Pagination value.


            When this route is first used it returns a `next_value`, when set as
            the

            `next` value it will return the next set of items, implementing

            pagination.


            # Notes


            All the same filtering options MUST be used between requests,
            otherwise

            comments might be skipped and/or returned twice (in two different

            requests).
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: created_by
          in: query
          description: >-
            Filter comments by user (id) that created them.


            If a comment is created by *any* of the users in this list it will
            be

            included in the result, i.e. it's an `OR` not `AND` filtering.


            Format is a comma separated list, e.g.

            `05c45af0-b99f-4fb6-8f48-6606b64f982e,c206ac84-9483-4320-a271-6a402d8f7bce`.
          required: false
          schema:
            type:
              - array
              - 'null'
            items:
              type: string
              format: uuid
        - name: q
          in: query
          description: >-
            Search the comment's content for the query.


            If any comment in a comment thread matches the search query the
            entire

            comment thread is returned.
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: pinged
          in: query
          description: >-
            Limit the comment threads to include at least one comment where the
            user

            was pinged.


            Defaults to not be limited to pings only.
          required: false
          schema:
            type:
              - boolean
              - 'null'
        - name: resolved
          in: query
          description: >-
            Limit file comments to either include only resolved comments, ie:
            resolved=true

            or only unresolved comments, ie: resolved=false

            If this parameter is not provided, the default behavior includes all
            comments

            (resolved and unresolved)
          required: false
          schema:
            type:
              - boolean
              - 'null'
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Comments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryCommentList'
        '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: Repository 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:
    RepositoryCommentList:
      type: object
      description: List of [`RepositoryComment`]`s.
      required:
        - comments
      properties:
        comments:
          type: array
          items:
            $ref: '#/components/schemas/RepositoryComment'
          description: List of comments.
        nextValue:
          type:
            - string
            - 'null'
          description: >-
            Use this as `next` value in the next request to retrieve the next
            list

            of findings.


            If this is empty it means no more comments are available.
    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.
    RepositoryComment:
      type: object
      description: >-
        Comment made in a repository.


        This can be a comment on a file or on a finding, the `related_to` field
        can

        be used to determine to what the comment relates.
      required:
        - id
        - relatedTo
        - content
        - reactions
        - createdBy
        - createdAt
        - replies
        - lastUpdatedBy
        - lastUpdatedAt
      properties:
        id:
          type: string
          format: uuid
        relatedTo:
          $ref: '#/components/schemas/RepositoryCommentKind'
          description: To what the comment relates.
        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.
            NOTE: This is only supported for file comments.
        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.
        createdAt:
          type: string
          format: date-time
          description: Time at which the comment was made.
        replies:
          type: array
          items:
            $ref: '#/components/schemas/RepositoryCommentReply'
          description: Replies made to this comment, i.e. the comment thread.
        resolvedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            NOTE: Resolving is currently supported only for file comments.

            Therefore, this value can be set only when `related_to` is of file
            kind.
        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`.
        lastUpdatedBy:
          $ref: '#/components/schemas/RepositoryUser'
        lastUpdatedAt:
          type: string
          format: date-time
          description: Time at which the last comment in the thread was made.
    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
    RepositoryCommentKind:
      oneOf:
        - type: object
          description: Comment made on a file, also see [`FileComment`].
          required:
            - path
            - lines
            - kind
          properties:
            path:
              type: string
              description: >-
                Path to the file the comment relates to, relative to the root of
                the

                repository, e.g. `src/main.rs`.
            lines:
              $ref: '#/components/schemas/InclusiveRangeInt'
              description: The line(s) refered to in the comment.
            relevantContent:
              type:
                - string
                - 'null'
              description: >-
                Content of the file that is relevant to the finding, i.e. the
                `lines` of

                the content.


                # Notes


                This may be null if the `lines` are invalid (e.g. they go beyond
                the

                amount of lines) or if the file is binary.
            kind:
              type: string
              enum:
                - file
        - type: object
          description: Comment made on a finding, also see [`FindingComment`].
          required:
            - findingNumber
            - kind
          properties:
            findingNumber:
              type: integer
              format: int32
              description: Finding number the comment relates to.
            kind:
              type: string
              enum:
                - finding
      description: To what a [`RepositoryComment`] relates to.
    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.
    RepositoryCommentReply:
      type: object
      description: Reply made to a comment in a repository.
      required:
        - id
        - content
        - reactions
        - createdBy
        - createdAt
        - lastUpdatedBy
        - lastUpdatedAt
      properties:
        id:
          type: string
          format: uuid
        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.
            NOTE: This is only supported for file comments.
        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.
        createdAt:
          type: string
          format: date-time
          description: Time at which the comment was made.
        lastUpdatedBy:
          $ref: '#/components/schemas/RepositoryUser'
          description: User that last updated the comment.
        lastUpdatedAt:
          type: string
          format: date-time
          description: Time at which the comment was updated.
    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
    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

````