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

> [Beta] Update a workflow (creates a new version). Use when managing deterministic workflow definitions and triggering or inspecting their runs.

# [Beta] Update a workflow (creates a new version)



## OpenAPI

````yaml patch /workflows/{workflow_id}
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /workflows/{workflow_id}:
    patch:
      tags:
        - Workflows (Beta)
      summary: '[Beta] Update a workflow (creates a new version)'
      description: >-
        Update a workflow by creating a new version. The new version is created
        as an inactive draft. Only the provided fields are changed; omitted
        fields carry over from the current version. Use the activate endpoint to
        make the new version live. When blocks or trigger fields are provided,
        the resulting definition must pass deep validation — failures return a
        400 with structured issues.
      operationId: updateWorkflow
      parameters:
        - schema:
            type: string
          in: path
          name: workflow_id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWorkflowPublicInput'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowDetailPublicResponseDto'
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowValidationErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    UpdateWorkflowPublicInput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/UpdateWorkflowPublicInputInput'
      type: object
      properties:
        name:
          description: New workflow name
          type: string
          minLength: 1
        description:
          description: New workflow description
          anyOf:
            - type: string
            - type: 'null'
        trigger_type:
          description: New trigger type
          type: string
          enum:
            - manual-trigger
            - ai-trigger
            - cron-trigger
            - form-trigger
            - webhook
            - contact-created
            - phone-call-started
            - phone-call-finished
            - ticket-created
            - ticket-reassigned
            - ticket-resolved
            - ticket-handoff
            - pre-ticket-handoff
            - ticket-tag-added
            - ticket-inactive
            - agent-inactive
            - sequence-completed
            - csat-score-submit
            - prohibited-topic-detected
            - sla-first-reply-breached
            - sla-next-reply-breached
            - sla-resolution-breached
            - voice-call-transferred
            - pre-voice-call-transfer
            - pre-phone-call-finished
            - manual-ticket-trigger
            - contact-message-received
            - first-contact-message-received
            - macro-called
            - ai-response-completed
            - agent-availability-changed
            - agent-avail-in-team-changed
            - ai-response-requested
            - ticket-reopened
        trigger_configuration:
          description: New trigger configuration
          anyOf:
            - {}
            - type: 'null'
        workflow_blocks:
          description: New workflow step/block definitions (replaces existing blocks)
          type: array
          items: {}
        workflow_editor_state:
          description: >-
            React Flow editor state (nodes, edges, viewport) for the dashboard
            visual editor
          anyOf:
            - {}
            - type: 'null'
    WorkflowDetailPublicResponseDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/WorkflowDetailPublicResponseDto'
      type: object
      properties:
        id:
          type: number
          description: Version serial ID
        workflow_id:
          type: string
          description: Workflow UUID (groups all versions of the same workflow)
        name:
          type: string
          description: Workflow name
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Workflow description
        is_active:
          anyOf:
            - type: boolean
            - type: 'null'
          description: Whether this version is currently active
        trigger_type:
          type: string
          description: >-
            Trigger type: "manual-trigger", "ai-trigger", "cron-trigger",
            "webhook", "form-trigger", or event-based triggers
        version_number:
          type: number
          description: Version number (increments with each edit)
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        workflow_blocks:
          anyOf:
            - type: array
              items: {}
            - type: 'null'
          description: Workflow step/block definitions
        trigger_configuration:
          anyOf:
            - {}
            - type: 'null'
          description: Trigger-specific configuration
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Trigger URL for webhook-type workflows. Call this URL (POST) to
            trigger the workflow. Null for non-webhook workflows.
      required:
        - id
        - workflow_id
        - name
        - description
        - is_active
        - trigger_type
        - version_number
        - created_at
        - updated_at
        - workflow_blocks
        - trigger_configuration
        - webhook_url
      additionalProperties: false
    WorkflowValidationErrorResponse:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/WorkflowValidationErrorResponse'
      type: object
      properties:
        statusCode:
          type: number
          const: 400
        message:
          type: string
          description: Human-readable summary of the validation failure
        error:
          type: string
        issues:
          type: array
          items:
            type: object
            properties:
              step_id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: The step ID where the issue was found, if applicable
              message:
                type: string
                description: Description of the validation issue
              severity:
                type: string
                enum:
                  - error
                  - warning
                description: >-
                  "error" blocks create/update/activate; "warning" is advisory
                  only
            required:
              - step_id
              - message
              - severity
            additionalProperties: false
          description: Structured validation issues — fix each step_id and retry
      required:
        - statusCode
        - message
        - error
        - issues
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````