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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/api-reference/approval/create-approval",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Create approval

> Create an approval.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json post /approvals/{org}/{flow_name}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /approvals/{org}/{flow_name}:
    post:
      tags:
        - Approval
      summary: Create approval
      description: Create an approval.
      operationId: post_approval_approvals__org___flow_name__post
      parameters:
        - name: flow_name
          in: path
          required: true
          schema:
            type: string
            title: Flow Name
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalPostInput'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovalPostInput'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__ValidationErrorResponse___locals___ValidationErrorResponseModel__1
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__1
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    ApprovalPostInput:
      properties:
        artifact_fingerprint:
          type: string
          pattern: ^[a-f0-9]{64}$
          title: Artifact Fingerprint
          description: The sha256 fingerprint of the artifact that is approved
        description:
          type: string
          title: Description
          description: Description for the approval
        environment:
          anyOf:
            - type: string
            - type: 'null'
          title: Environment
          description: Environment the approval is valid for
        src_commit_list:
          items:
            type: string
            pattern: ^[a-f0-9]{40}$
          type: array
          title: Src Commit List
        oldest_commit:
          anyOf:
            - type: string
              pattern: ^[a-f0-9]{40}$
            - type: 'null'
          title: Oldest Commit
          description: The oldest commit
        approvals:
          anyOf:
            - items:
                $ref: '#/components/schemas/Approval'
              type: array
            - type: 'null'
          title: Approvals
          description: List of approvals
        user_data:
          anyOf:
            - additionalProperties: true
              type: object
            - items: {}
              type: array
            - type: 'null'
          title: User Data
      additionalProperties: false
      type: object
      required:
        - artifact_fingerprint
        - description
        - src_commit_list
      title: ApprovalPostInput
      description: Create approval for an artifact.
      examples:
        - approvals:
            - approval_url: https://example.com
              approved_by: bob
              comment: I like this
              state: APPROVED
          artifact_fingerprint: 73d75bf7cac2f24845deeb51e05babd2514e91eb4fdd2352fbc2fcf267ff21fb
          description: Approved since it is good
          environment: production
          oldest_commit: 7e8a2cc65e4679bb7bea3605f9245f2214aad585
          src_commit_list:
            - 602ed54b6dec955d348201fa411faa3f92dc8bc7
            - af2705a9da720cbf1b166c668d5ed17fa371af0d
    fastapi_app__errors__ValidationErrorResponse___locals___ValidationErrorResponseModel__1:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: ValidationErrorResponseModel
      examples:
        - errors:
            email: Field must be a valid email address
            name: Field cannot be empty
          message: Input payload validation failed
    fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__1:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: ForbiddenResponseModel
      examples:
        - message: You don't have permission to access this resource
    Approval:
      properties:
        state:
          type: string
          enum:
            - APPROVED
            - UNAPPROVED
          title: State
        comment:
          type: string
          title: Comment
          description: Comment for approval
        approved_by:
          type: string
          title: Approved By
          description: The user who approved it
        approval_url:
          type: string
          title: Approval Url
          description: URL to the source of the approval
      type: object
      required:
        - state
        - comment
        - approved_by
        - approval_url
      title: Approval
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````