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

# Update Workflow

> Update a workflow's prompts.

The current version will be saved to the version history.
Only the fields provided in the request body will be updated.
The workflow must belong to the authenticated organization.



## OpenAPI

````yaml /openapi.json patch /v1/workflows/{workflow_id}
openapi: 3.1.0
info:
  title: Cyberdesk Cloud
  description: >-
    The Cyberdesk API provides programmatic access to all platform features,
    enabling you to automate desktop tasks at scale.
  version: 1.0.0
servers:
  - url: https://api.cyberdesk.io
    description: Production server
  - url: https://cyberdesk-api-dev.fly.dev
    description: Development server
security: []
paths:
  /v1/workflows/{workflow_id}:
    patch:
      tags:
        - workflows
      summary: Update Workflow
      description: |-
        Update a workflow's prompts.

        The current version will be saved to the version history.
        Only the fields provided in the request body will be updated.
        The workflow must belong to the authenticated organization.
      operationId: update_workflow_v1_workflows__workflow_id__patch
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workflow Id
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Unique key for idempotent requests. If provided, the server ensures
            the request is processed at most once. Retries with the same key
            return the original response. SDKs auto-generate this for write
            requests.
          schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WorkflowUpdate:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Name
        main_prompt:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Main Prompt
        input_schema:
          anyOf:
            - type: string
            - type: 'null'
          title: Input Schema
          description: >-
            JSON schema for validating merged run inputs. Sensitive root keys
            are exposed with a '$' prefix in schema validation (for example
            sensitive_input_values.api_key -> '$api_key').
        output_schema:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Schema
          description: JSON schema for output data transformation
        includes_file_exports:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Includes File Exports
          description: Enable AI-based file export detection
        is_webhooks_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Webhooks Enabled
          description: Send webhook on run completion
        terminal_command_allowlist:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Terminal Command Allowlist
          description: >-
            Optional workflow-level allowlist for execute_terminal_command. Set
            to an empty list or null to clear the allowlist.
        model_metadata:
          anyOf:
            - $ref: '#/components/schemas/WorkflowModelMetadata'
            - type: 'null'
          description: >-
            Optional workflow-level model configuration metadata (main agent,
            cache detection, and fallbacks).
        post_run_check_failure_cleanup_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Post Run Check Failure Cleanup Prompt
          description: >-
            Optional workflow-level cleanup prompt that runs when any post-run
            check fails during a session or chain. Set null to clear it.
        workflow_metadata:
          anyOf:
            - $ref: '#/components/schemas/WorkflowInternalMetadataUpdate'
            - type: 'null'
          description: >-
            Optional internal workflow metadata patch. Top-level null clears all
            workflow metadata. Omit this field to leave existing metadata
            unchanged. Set individual keys to null to remove only those keys.
        post_run_checks:
          anyOf:
            - items:
                $ref: '#/components/schemas/WorkflowPostRunCheckUpsert'
              type: array
            - type: 'null'
          title: Post Run Checks
          description: Workflow-managed post-run checks, reconciled on save when present.
      type: object
      title: WorkflowUpdate
      description: Schema for updating a workflow
    WorkflowResponse:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Name
        main_prompt:
          type: string
          minLength: 1
          title: Main Prompt
        input_schema:
          anyOf:
            - type: string
            - type: 'null'
          title: Input Schema
          description: >-
            JSON schema for validating merged run inputs. Sensitive root keys
            are exposed with a '$' prefix in schema validation (for example
            sensitive_input_values.api_key -> '$api_key').
        output_schema:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Schema
          description: JSON schema for output data transformation
        includes_file_exports:
          type: boolean
          title: Includes File Exports
          description: Enable AI-based file export detection
          default: false
        is_webhooks_enabled:
          type: boolean
          title: Is Webhooks Enabled
          description: Send webhook on run completion
          default: false
        terminal_command_allowlist:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Terminal Command Allowlist
          description: >-
            Optional workflow-level allowlist for execute_terminal_command. When
            set, the agent may only run commands that exactly match one of the
            approved command templates.
        model_metadata:
          anyOf:
            - $ref: '#/components/schemas/WorkflowModelMetadata'
            - type: 'null'
          description: >-
            Optional workflow-level model configuration metadata (main agent,
            cache detection, and fallbacks).
        post_run_check_failure_cleanup_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Post Run Check Failure Cleanup Prompt
          description: >-
            Optional workflow-level cleanup prompt that runs when any post-run
            check fails during a session or chain.
        id:
          type: string
          format: uuid
          title: Id
        user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: User Id
        organization_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Organization Id
        includes_input_variables:
          type: boolean
          title: Includes Input Variables
          default: false
        workflow_metadata:
          anyOf:
            - $ref: '#/components/schemas/WorkflowInternalMetadata'
            - type: 'null'
          description: Internal workflow metadata used for run/error tracking.
        old_versions:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Old Versions
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/WorkflowTagResponse'
              type: array
            - type: 'null'
          title: Tags
          description: Tags assigned to this workflow
        post_run_checks:
          anyOf:
            - items:
                $ref: '#/components/schemas/WorkflowPostRunCheckResponse'
              type: array
            - type: 'null'
          title: Post Run Checks
          description: Post-run checks assigned to this workflow.
      type: object
      required:
        - main_prompt
        - id
        - created_at
        - updated_at
      title: WorkflowResponse
      description: Workflow response schema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowModelMetadata:
      properties:
        main_agent_model_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Main Agent Model Id
          description: >-
            ModelConfiguration.id used for the main agent. Null → Cyberdesk
            default.
        cache_detection_model_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Cache Detection Model Id
          description: >-
            ModelConfiguration.id used for cache detection. Null → Cyberdesk
            default.
        fallback_model_1_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Fallback Model 1 Id
          description: ModelConfiguration.id used as fallback 1 (global across agents).
        fallback_model_2_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Fallback Model 2 Id
          description: ModelConfiguration.id used as fallback 2 (global across agents).
      type: object
      title: WorkflowModelMetadata
      description: >-
        JSONB-backed workflow model configuration metadata.


        Stored on the Workflow row as `model_metadata` to avoid adding many FK
        columns.

        All fields are optional; when missing/null, the system falls back to
        Cyberdesk defaults.
    WorkflowInternalMetadataUpdate:
      properties:
        has_unaddressed_error:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Has Unaddressed Error
          description: Set to false when workflow errors have been addressed.
        last_errored_run_start:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Errored Run Start
          description: Start timestamp of the most recent errored/task_failed run.
        last_errored_run_uuid:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Last Errored Run Uuid
          description: Run UUID of the most recent errored/task_failed run.
      type: object
      title: WorkflowInternalMetadataUpdate
      description: Patchable workflow metadata fields for internal workflow maintenance.
    WorkflowPostRunCheckUpsert:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        type:
          $ref: '#/components/schemas/PostRunCheckType'
        file_target_mode:
          anyOf:
            - $ref: '#/components/schemas/PostRunCheckFileTargetMode'
            - type: 'null'
        file_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: File Names
        file_name_regex:
          anyOf:
            - type: string
            - type: 'null'
          title: File Name Regex
        expected_match_count:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Expected Match Count
        expected_match_count_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Match Count Ref
        loop_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Loop Input
        loop_item_filename_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Loop Item Filename Template
        allow_missing_attachments:
          type: boolean
          title: Allow Missing Attachments
          default: false
        check_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Check Prompt
        model:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Model
          description: Optional ModelConfiguration id override for agentic post-run checks.
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
      type: object
      required:
        - name
        - type
      title: WorkflowPostRunCheckUpsert
      description: Create/update payload for workflow-managed post-run checks.
    WorkflowInternalMetadata:
      properties:
        has_unaddressed_error:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Has Unaddressed Error
          description: True when at least one run has failed and remains unaddressed.
        last_errored_run_start:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Errored Run Start
          description: Start timestamp of the most recent errored/task_failed run.
        last_errored_run_uuid:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Last Errored Run Uuid
          description: Run UUID of the most recent errored/task_failed run.
      type: object
      title: WorkflowInternalMetadata
      description: Backend workflow metadata exposed read-only for internal observability.
    WorkflowTagResponse:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
        emoji:
          anyOf:
            - type: string
              maxLength: 10
            - type: 'null'
          title: Emoji
        color:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Color
        group_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Group Id
          description: Optional group for mutual exclusivity
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          title: Organization Id
        order:
          type: integer
          title: Order
        is_archived:
          type: boolean
          title: Is Archived
          default: false
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        workflow_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Workflow Count
          description: Number of workflows with this tag (returned in list endpoint)
        group:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTagGroupResponse'
            - type: 'null'
          description: The group this tag belongs to
      type: object
      required:
        - name
        - id
        - organization_id
        - order
        - created_at
        - updated_at
      title: WorkflowTagResponse
      description: Workflow tag response schema
    WorkflowPostRunCheckResponse:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        type:
          $ref: '#/components/schemas/PostRunCheckType'
        file_target_mode:
          anyOf:
            - $ref: '#/components/schemas/PostRunCheckFileTargetMode'
            - type: 'null'
        file_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: File Names
        file_name_regex:
          anyOf:
            - type: string
            - type: 'null'
          title: File Name Regex
        expected_match_count:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Expected Match Count
        expected_match_count_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Match Count Ref
        loop_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Loop Input
        loop_item_filename_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Loop Item Filename Template
        allow_missing_attachments:
          type: boolean
          title: Allow Missing Attachments
          default: false
        check_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Check Prompt
        model:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Model
          description: Optional ModelConfiguration id override for agentic post-run checks.
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          title: Organization Id
        user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: User Id
        order:
          type: integer
          title: Order
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - name
        - type
        - id
        - organization_id
        - order
        - created_at
        - updated_at
      title: WorkflowPostRunCheckResponse
      description: >-
        Workflow response shape for post-run checks, including workflow-specific
        order.
    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
          additionalProperties: true
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PostRunCheckType:
      type: string
      enum:
        - run_attachment_exists
        - run_attachment_image_check
        - output_data_passes_schema_validation
        - output_data_agentic_check
      title: PostRunCheckType
    PostRunCheckFileTargetMode:
      type: string
      enum:
        - exact
        - regex
        - loop_items
      title: PostRunCheckFileTargetMode
    WorkflowTagGroupResponse:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
        emoji:
          anyOf:
            - type: string
              maxLength: 10
            - type: 'null'
          title: Emoji
        color:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Color
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          title: Organization Id
        order:
          type: integer
          title: Order
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - name
        - id
        - organization_id
        - order
        - created_at
        - updated_at
      title: WorkflowTagGroupResponse
      description: Workflow tag group response schema
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````