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

# Publish Flow Template

> Publishes a new Flow template version.



## OpenAPI

````yaml post /v1/flows/{flowId}/templates
openapi: 3.0.0
info:
  version: 1.0.0
  title: Sohar API
  license:
    name: MIT
servers:
  - url: https://api.soharhealth.com
security: []
paths:
  /v1/flows/{flowId}/templates:
    post:
      tags:
        - Flows
      summary: Publish Flow Template
      description: Publishes a new Flow template version.
      operationId: publishFlowTemplate
      parameters:
        - in: path
          name: flowId
          required: true
          description: The Flow ID.
          schema:
            type: string
            example: 33093874-1e3d-4ea9-b988-8cc64e5a4079
      requestBody:
        required: true
        content:
          application/x-yaml:
            schema:
              type: string
              description: The YAML template.
            example: |
              input:
                type: object
                properties: {}
              startsAt: final
              states:
                final:
                  end: true
              output:
                type: object
                properties: {}
      responses:
        '201':
          description: Published Flow template version
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishFlowTemplateResponse'
        '400':
          description: Invalid YAML or Flow template definition
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_request_error
                    default: invalid_request_error
                  param:
                    type: string
                    example: template
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_request_error
                    default: invalid_request_error
        '404':
          description: Template not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_request_error
                    default: invalid_request_error
        '500':
          description: Internal error
      security:
        - BasicAuth: []
components:
  schemas:
    PublishFlowTemplateResponse:
      type: object
      required:
        - flowId
        - version
      properties:
        flowId:
          type: string
          description: The Flow ID.
          example: 33093874-1e3d-4ea9-b988-8cc64e5a4079
        version:
          type: integer
          description: The published Flow template version.
          example: 1
  securitySchemes:
    BasicAuth:
      type: http
      scheme: bearer

````