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

# Link workflows to template

> Link one or more workflows to a template



## OpenAPI

````yaml post /v4/templates/{templateId}/link
openapi: 3.0.3
info:
  title: Kadoa API
  version: 3.0.0
  contact:
    name: Support
    email: support@kadoa.com
servers:
  - url: https://api.kadoa.com
security: []
paths:
  /v4/templates/{templateId}/link:
    post:
      tags:
        - Templates
      summary: Link workflows to template
      description: >-
        Associate existing workflows with this template at the latest version.
        Returns 409 with conflict details if workflows are linked to another
        template (use force: true to override).
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Template ID
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkWorkflowsBody'
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkWorkflowsResponse'
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '409':
          description: '409'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkWorkflowsConflictResponse'
        '500':
          description: '500'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
      security:
        - ApiKeyAuth: []
components:
  schemas:
    LinkWorkflowsBody:
      type: object
      properties:
        workflowIds:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          maxItems: 2000
          description: Workflow IDs to link to this template
        force:
          type: boolean
          description: >-
            If true, relink workflows that are already linked to another
            template
      required:
        - workflowIds
      title: LinkWorkflowsBody
      description: Request body for linking workflows to a template
    LinkWorkflowsResponse:
      type: object
      properties:
        error:
          type: boolean
          enum:
            - false
          description: Error flag (always false on success)
        success:
          type: boolean
          enum:
            - true
          description: Success flag
        linkedCount:
          type: number
          description: Number of workflows linked
        workflowIds:
          type: array
          items:
            type: string
            format: uuid
          description: IDs of linked workflows
      required:
        - error
        - success
        - linkedCount
        - workflowIds
      title: LinkWorkflowsResponse
      description: Response for linking workflows to a template
    LinkWorkflowsConflictResponse:
      type: object
      properties:
        error:
          type: boolean
          enum:
            - true
          description: Error flag
        code:
          type: string
          enum:
            - CONFLICT
          description: Error code
        conflicts:
          type: array
          items:
            type: object
            properties:
              workflowId:
                type: string
                format: uuid
              workflowName:
                type: string
              templateId:
                type: string
                format: uuid
              templateName:
                type: string
            required:
              - workflowId
              - workflowName
              - templateId
              - templateName
          description: Workflows already linked to another template
      required:
        - error
        - code
        - conflicts
      title: LinkWorkflowsConflictResponse
      description: Response when workflows are already linked to another template
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````