> ## 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/flows/create-or-update-flow-with-template",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

# Create or update flow with template

> Create or update a flow for an organization.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json put /flows/{org}/template_file
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:
  /flows/{org}/template_file:
    put:
      tags:
        - Flows
      summary: Create or update flow with template
      description: Create or update a flow for an organization.
      operationId: create_flow_with_template_flows__org__template_file_put
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_create_flow_with_template_flows__org__template_file_put
      responses:
        '200':
          description: Successful flow update
        '201':
          description: Successful flow creation
          content:
            application/json:
              schema: {}
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__ValidationErrorResponse___locals___ValidationErrorResponseModel__2
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    Body_create_flow_with_template_flows__org__template_file_put:
      properties:
        data_json:
          $ref: '#/components/schemas/CreateFlow'
          description: Flow metadata in JSON format
        template_file:
          anyOf:
            - type: string
              contentMediaType: application/octet-stream
            - type: 'null'
          title: Template File
          description: 'The flow template file (max size: 10MB)'
      type: object
      required:
        - data_json
      title: Body_create_flow_with_template_flows__org__template_file_put
    fastapi_app__errors__ValidationErrorResponse___locals___ValidationErrorResponseModel__2:
      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
    CreateFlow:
      properties:
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        visibility:
          type: string
          enum:
            - public
            - private
          title: Visibility
      type: object
      required:
        - name
        - description
        - visibility
      title: CreateFlow
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````