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

# Create a new finding in a repository.

> Only auditors can use this route and they must be part of a repository team
that has access to this repository. The created finding will also be
attributed to this team.

# Access control rules

- The requester must be a reviewer with access to the repository.



## OpenAPI

````yaml POST /api/v0/repositories/{repo_id}/findings
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}/findings:
    post:
      tags:
        - repositories
      summary: Create a new finding in a repository.
      description: >-
        Only auditors can use this route and they must be part of a repository
        team

        that has access to this repository. The created finding will also be

        attributed to this team.


        # Access control rules


        - The requester must be a reviewer with access to the repository.
      operationId: create_finding
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewFinding'
        required: true
      responses:
        '201':
          description: Finding created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedNumberedResource'
        '400':
          description: Finding is invalid
          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 creating finding
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    NewFinding:
      type: object
      required:
        - title
        - description
        - severity
      properties:
        title:
          type: string
        description:
          type: string
        severity:
          $ref: '#/components/schemas/FindingSeverity'
        likelihood:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FindingLikelihood'
        impact:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FindingImpact'
        category:
          type:
            - string
            - 'null'
        assetGroup:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/NewFindingAssetGroup'
        safeHarborAssetIds:
          type: array
          items:
            type: string
            format: uuid
        relatedFiles:
          type: array
          items:
            $ref: '#/components/schemas/NewFindingRelatedFile'
        commentId:
          type:
            - string
            - 'null'
          format: uuid
          description: Populate it if the new finding originates from a file comment
    CreatedNumberedResource:
      type: object
      required:
        - id
        - number
      properties:
        id:
          type: string
          format: uuid
        number:
          type: integer
          format: int32
    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
    FindingLikelihood:
      type: string
      description: Likelihood of a [`Finding`].
      enum:
        - high
        - medium
        - low
    FindingImpact:
      type: string
      description: Impact of a [`Finding`].
      enum:
        - high
        - medium
        - low
    NewFindingAssetGroup:
      type: object
      required:
        - assetGroupId
        - assets
      properties:
        assetGroupId:
          type: string
          format: uuid
        assets:
          type: array
          items:
            type: string
            format: uuid
          description: Currently the assets cannot be empty
    NewFindingRelatedFile:
      type: object
      required:
        - path
        - lines
      properties:
        path:
          type: string
        lines:
          $ref: '#/components/schemas/InclusiveRangeInt'
          description: The line(s) refered to in the comment.
    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
    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

````