> ## 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 draft in place when possible

> [Beta] Update a workflow draft in place when possible — Updates the latest workflow version in place when it is a pristine draft (inactive and without recorded non-test runs).



## OpenAPI

````yaml patch /workflows/{workflow_id}/draft
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: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /workflows/{workflow_id}/draft:
    patch:
      tags:
        - Workflows (Beta)
      summary: '[Beta] Update a workflow draft in place when possible'
      description: >-
        Updates the latest workflow version in place when it is a pristine draft
        (inactive and without recorded non-test runs). If the latest version is
        active or has real run history, a new inactive draft version is created
        instead. In companion context (acting user), the edit applies on top of
        the user’s unsaved editor draft — snapshotting their work-in-progress
        into the version — and consumes that draft. The resulting definition
        must pass deep validation when it changes; failures return a 400 with
        structured issues. Only versions can be activated.
      operationId: updateWorkflowDraftAware
      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
          maxLength: 255
        description:
          description: New workflow description
          type:
            - string
            - 'null'
        trigger_type:
          description: New trigger type
          type: string
          enum:
            - ivr-incoming-call
            - manual-trigger
            - ai-trigger
            - cron-trigger
            - form-trigger
            - webhook
            - contact-created
            - contact-updated
            - phone-call-started
            - phone-call-finished
            - ticket-created
            - sub-session-created
            - ticket-reassigned
            - ticket-resolved
            - ticket-handoff
            - pre-ticket-handoff
            - ticket-tag-added
            - ticket-inactive
            - agent-inactive
            - 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
            - macro-option-clicked
            - ai-response-completed
            - agent-availability-changed
            - agent-avail-in-team-changed
            - ai-response-requested
            - ticket-reopened
            - agent-mentioned
            - agent-message-posted
            - ticket-team-changed
            - session-updated
            - sequence-contact-replied
            - sequence-contact-completed
            - sequence-contact-parked
            - sequence-step-failed
            - sequence-contact-suppressed
        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:
          description: Workflow description
          type:
            - string
            - 'null'
        is_active:
          description: Whether this version is currently active
          type:
            - boolean
            - 'null'
        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:
          description: >-
            Trigger URL for webhook-type workflows. Call this URL (POST) to
            trigger the workflow. Null for non-webhook workflows.
          type:
            - string
            - 'null'
      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:
                description: The step ID where the issue was found, if applicable
                type:
                  - string
                  - 'null'
              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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.