> ## 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] Create a workflow. Use when managing deterministic workflow definitions and triggering or inspecting their runs.

# [Beta] Create a workflow



## OpenAPI

````yaml post /workflows
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:
    post:
      tags:
        - Workflows (Beta)
      summary: '[Beta] Create a workflow'
      description: >-
        Create a new workflow. The workflow is created as an inactive draft
        (version 1). Use the activate endpoint to make it live. Use GET
        /workflows/definitions to discover available action and trigger types.
        Rejects definitions that fail deep validation (missing required action
        inputs or trigger configuration) with a 400 carrying structured issues.
      operationId: createWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWorkflowPublicInput'
      responses:
        '201':
          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:
    CreateWorkflowPublicInput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/CreateWorkflowPublicInputInput'
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Workflow name
        description:
          description: Workflow description
          type: string
        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
          description: >-
            What starts the workflow. Use "manual-trigger" for on-demand
            execution, "ai-trigger" for AI-initiated, "webhook" for external
            HTTP triggers, "cron-trigger" for scheduled runs, or event-based
            triggers like "ticket-created", "contact-created", etc.
        trigger_configuration:
          description: >-
            Trigger-specific configuration (e.g. cron expression for
            cron-trigger)
          anyOf:
            - {}
            - type: 'null'
        workflow_blocks:
          type: array
          items: {}
          description: >-
            Array of workflow steps and control-flow blocks. Each step is an
            object with { "$kind": "Action", "id": "<unique-step-id>", "type":
            "<action-type>", "name": "<display-name>", "input": { ... } }.
            Control-flow blocks use { "$kind": "Block", "type": "if-else", "id":
            "<unique-id>", "inputs": { "condition": { "operatorName": "equals",
            "left": "{{step_id.field}}", "right": "value" } }, "branches": {
            "then": [...steps], "else": [...steps] } }. Use {{step_id.field}} to
            reference outputs from previous steps (no `.output.` segment — the
            field sits directly under the step id).
        workflow_editor_state:
          description: >-
            React Flow editor state (nodes, edges, viewport) for the dashboard
            visual editor
          anyOf:
            - {}
            - type: 'null'
      required:
        - name
        - trigger_type
        - workflow_blocks
    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

````