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

# Comment on a file.

> # Access control rules

- The requester must have access to the repository.



## OpenAPI

````yaml POST /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}:
    post:
      tags:
        - repositories
      summary: Comment on a file.
      description: |-
        # Access control rules

        - The requester must have access to the repository.
      operationId: comment_on_file
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: path
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewFileComment'
        required: true
      responses:
        '201':
          description: Comment made
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedResource'
        '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: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    NewFileComment:
      type: object
      description: Create a new comment on a file.
      required:
        - content
      properties:
        lines:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/InclusiveRangeInt'
              description: |-
                The line(s) refered to in the comment.

                # Notes

                This must be not be used if `parent` is set.
        parent:
          type:
            - string
            - 'null'
          format: uuid
          description: Comment is in a reply to a thread.
        content:
          type: string
          description: >-
            The content is expected to be valid markdown, but this is not
            validated

            at this time.


            Users can "ping" other users by using:

            * `@project` to ping all company users associated with the company,
            or

            * `@username` to ping auditors (reviewers, judges and triagers) that
            are
              part of the repository.

            A ping will cause the pinged user(s) to receive a notification.
    CreatedResource:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          format: uuid
    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
    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

````