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

# Update Workflow Definition Handler



## OpenAPI

````yaml /openapi.yaml put /v1/workflow-definitions/{definition_id}
openapi: 3.1.0
info:
  title: Knowledge Stack API
  description: Knowledge Stack backend API for authentication and knowledge management
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Knowledge Stack API local dev server
security: []
tags:
  - name: auth
    description: Authentication and identity management
  - name: users
    description: User accounts
  - name: tenants
    description: Tenant management
  - name: invites
    description: Tenant invitations
  - name: folders
    description: Folder management
  - name: documents
    description: Document management
  - name: document-versions
    description: Document version management
  - name: sections
    description: Document sections
  - name: chunks
    description: Chunk CRUD and semantic search
  - name: chunk-lineages
    description: Chunk lineage tracking
  - name: tags
    description: Tag management
  - name: path-parts
    description: Path part traversal and tagging
  - name: Threads
    description: Thread conversations
  - name: Thread Messages
    description: Thread message management
  - name: user-permissions
    description: User path permissions
  - name: workflows
    description: Ingestion workflows
paths:
  /v1/workflow-definitions/{definition_id}:
    put:
      tags:
        - Workflow Definitions
      summary: Update Workflow Definition Handler
      operationId: update_workflow_definition
      parameters:
        - name: definition_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Definition Id
        - name: authorization
          in: header
          required: false
          schema:
            type: string
            nullable: true
            title: Authorization
        - name: ks_uat
          in: cookie
          required: false
          schema:
            type: string
            nullable: true
            title: Ks Uat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWorkflowDefinitionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowDefinitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateWorkflowDefinitionRequest:
      properties:
        name:
          type: string
          maxLength: 255
          title: Name
        description:
          type: string
          nullable: true
          title: Description
        runner_type:
          $ref: '#/components/schemas/WorkflowRunnerType'
        runner_config:
          $ref: '#/components/schemas/SelfHostedRunnerConfig'
          nullable: true
        max_run_duration_seconds:
          type: integer
          maximum: 86400
          minimum: 60
          title: Max Run Duration Seconds
          default: 300
        source_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          maxItems: 20
          minItems: 1
          title: Source Path Part Ids
        instruction_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          maxItems: 20
          minItems: 1
          title: Instruction Path Part Ids
        output_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          maxItems: 20
          minItems: 1
          title: Output Path Part Ids
        template_path_part_id:
          type: string
          format: uuid
          nullable: true
          title: Template Path Part Id
        is_active:
          type: boolean
          title: Is Active
          default: true
      additionalProperties: false
      type: object
      required:
        - name
        - runner_type
        - source_path_part_ids
        - instruction_path_part_ids
        - output_path_part_ids
      title: UpdateWorkflowDefinitionRequest
      description: Full replacement (PUT semantics). All fields are required.
    WorkflowDefinitionResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          nullable: true
          title: Description
        runner_type:
          $ref: '#/components/schemas/WorkflowRunnerType'
        runner_config:
          $ref: '#/components/schemas/SelfHostedRunnerConfigResponse'
          nullable: true
        max_run_duration_seconds:
          type: integer
          title: Max Run Duration Seconds
        source_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Source Path Part Ids
        instruction_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Instruction Path Part Ids
        output_path_part_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Output Path Part Ids
        template_path_part_id:
          type: string
          format: uuid
          nullable: true
          title: Template Path Part Id
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - description
        - runner_type
        - runner_config
        - max_run_duration_seconds
        - source_path_part_ids
        - instruction_path_part_ids
        - output_path_part_ids
        - template_path_part_id
        - is_active
        - created_at
        - updated_at
      title: WorkflowDefinitionResponse
      description: Workflow definition response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowRunnerType:
      type: string
      enum:
        - SELF_HOSTED
      title: WorkflowRunnerType
      description: Runner that executes the workflow.
    SelfHostedRunnerConfig:
      properties:
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        webhook_secret:
          type: string
          format: password
          title: Webhook Secret
          writeOnly: true
      additionalProperties: false
      type: object
      required:
        - url
        - webhook_secret
      title: SelfHostedRunnerConfig
      description: Configuration for self-hosted workflow runner.
    SelfHostedRunnerConfigResponse:
      properties:
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
      additionalProperties: false
      type: object
      required:
        - url
      title: SelfHostedRunnerConfigResponse
      description: Response-safe version of runner config — excludes webhook_secret.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````