# Enable workflow

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Switches a disabled (`disabled`) workflow to the ready (`ready`) state and reactivates its configured scheduled task or volume trigger entrypoint. Paused (`paused`) workflows must go through [Resume workflow](resume-workflow.md) so workflow-paused executions are resumed together; calling this endpoint does not immediately start a new job run.

```text
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/{workflow_id}/enable
```

## Before you begin

1. Prepare a [personal access token](../../../../../guides/genesis/api-keys.md#creating-and-managing-personal-access-tokens) with workflow enable permission and the [target workspace ID](../../../../../guides/ai-studio/resource-center/workspace.md#copy-the-workspace-id).
2. Call [Get workflow details](get-workflow.md) to confirm the target workflow ID and verify that `status` is `disabled` and `source_type` is not `agent_automation_task`.

## Request parameters

Replace `$AI_STUDIO_API_KEY`, `$WORKSPACE_ID`, and `$WORKFLOW_ID` with actual values.

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/$WORKFLOW_ID/enable" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameters

### Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workflow_id` | string | Yes | ID of the workflow to enable, obtained from [List workflows](list-workflows.md). |

:::::
::::::
:::::::

## Successful response

Returns HTTP `200` and the enabled workflow details. If the target workflow is already in the `ready` state, the current workflow details are returned directly.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "workflow": {
      "id": "wf-001",
      "name": "daily-import",
      "description": "Import daily files",
      "source_type": "manual_dsl",
      "status": "ready",
      "available_actions": [
        "update",
        "delete",
        "run",
        "pause",
        "list_executions"
      ],
      "execution_mode": "cron",
      "cron_expression": "0 2 * * *",
      "latest_workflow_version_id": "ver-001",
      "execution_summary": {
        "total_executions": 8,
        "active_executions": 0
      },
      "trigger_summary": {
        "mode": "cron",
        "configured": true,
        "enabled": true,
        "cron_expression": "0 2 * * *"
      },
      "created_at": "2026-10-14T00:00:00Z",
      "updated_at": "2026-10-14T08:30:00Z",
      "dsl_yaml": "workflow:\n  name: daily-import\n  root: main\nroot:\n  chain: []\n",
      "definition_format": "dsl",
      "moi_workflow_def_id": "def-001"
    }
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` when the request succeeds. |
| `msg` | string | Result message; `OK` when the request succeeds. |
| `data` | object | Payload returned by this operation. |
| `data.workflow` | object | Enabled workflow detail object. |
| `data.workflow.automation_task_id` | string | Associated agent automation task ID, returned only when linked. |
| `data.workflow.session_id` | string | Associated authoring session ID, returned when provided by the server. |
| `data.workflow.id` | string | Workflow ID. |
| `data.workflow.name` | string | Workflow name. |
| `data.workflow.description` | string | Workflow description, returned when set. |
| `data.workflow.source_type` | string | Workflow source type: `nl2dsl`, `manual_dsl`, `manual_mowl`, `system`, or `agent_automation_task`. |
| `data.workflow.status` | string | Workflow status after enabling; `ready` on success (enum values: `ready`, `disabled`, `paused`). |
| `data.workflow.available_actions` | array of string | Action hints derived from the current status (`update`, `delete`, `enable`, `resume`, `run`, `pause`, `list_executions`); does not imply that the current identity has passed IAM permission checks. |
| `data.workflow.execution_mode` | string | Configured execution mode: `one_shot`, `volume_trigger`, `cron`, `dynamic_service`, or `task_by_version`. |
| `data.workflow.cron_expression` | string | Cron expression for scheduled execution, returned only when scheduled. |
| `data.workflow.draft_id` | string | Associated draft ID, returned when provided by the server. |
| `data.workflow.candidate_id` | string | Associated candidate ID, returned when provided by the server. |
| `data.workflow.latest_workflow_version_id` | string | Latest workflow version ID, returned when a version exists. |
| `data.workflow.compute_resource_id` | string | Workflow-level compute resource ID, returned when bound. |
| `data.workflow.compute_resource_bindings` | array of object | Workflow-level or node-level compute resource bindings, returned when bound. |
| `data.workflow.compute_resource_bindings[].id` | string | Compute resource ID. |
| `data.workflow.compute_resource_bindings[].name` | string | Compute resource name, returned when provided by the server. |
| `data.workflow.compute_resource_bindings[].workflow_level` | boolean | Whether this binding applies at the workflow level. |
| `data.workflow.compute_resource_bindings[].node_names` | array of string | Node names that use this compute resource binding. |
| `data.workflow.execution_summary` | object | Execution summary statistics. |
| `data.workflow.execution_summary.total_executions` | integer | Total historical job executions. |
| `data.workflow.execution_summary.active_executions` | integer | Number of currently active job executions. |
| `data.workflow.execution_summary.active_execution_id` | string | Active job execution ID, returned when an active execution exists. |
| `data.workflow.execution_summary.active_execution_status` | string | Active job execution status, returned when an active execution exists. |
| `data.workflow.execution_summary.latest_execution_id` | string | Most recent job execution ID, returned when execution history exists. |
| `data.workflow.execution_summary.latest_execution_status` | string | Most recent job execution status, returned when execution history exists. |
| `data.workflow.execution_summary.latest_execution_at` | string | Timestamp of the most recent job execution, returned when execution history exists. |
| `data.workflow.trigger_summary` | object | Trigger configuration summary. |
| `data.workflow.trigger_summary.mode` | string | Trigger execution mode: `one_shot`, `volume_trigger`, `cron`, `dynamic_service`, or `task_by_version`. |
| `data.workflow.trigger_summary.configured` | boolean | Whether trigger configuration is complete. |
| `data.workflow.trigger_summary.enabled` | boolean | Whether the trigger is currently enabled. |
| `data.workflow.trigger_summary.volume_id` | integer | Bound volume ID, returned only for volume triggers. |
| `data.workflow.trigger_summary.cron_expression` | string | Scheduled Cron expression, returned only for Cron triggers. |
| `data.workflow.trigger_summary.service_name` | string | Dynamic API service name, returned only in dynamic service mode. |
| `data.workflow.trigger_summary.input_schema` | string | Input schema JSON string of the latest dynamic service version, returned when present. |
| `data.workflow.trigger_summary.output_schema` | string | Output schema JSON string of the latest dynamic service version, returned when present. |
| `data.workflow.created_at` | string | Creation time in RFC 3339 format. |
| `data.workflow.updated_at` | string | Last update time in RFC 3339 format. |
| `data.workflow.goal` | string | Workflow goal description, returned when provided by the server. |
| `data.workflow.planner_model` | string | Planner model name, returned when provided by the server. |
| `data.workflow.dsl_yaml` | string | Workflow DSL YAML text. |
| `data.workflow.workflow` | object | Native MOWL workflow definition object, returned when saved in native format. |
| `data.workflow.definition_format` | string | Definition format: `dsl`, `mowl`, or `""`. |
| `data.workflow.run_context` | object | Runtime context object, returned when provided by the server. |
| `data.workflow.runtime_fields` | object | Runtime input form definition, returned when configured; nested fields match [Get workflow details](get-workflow.md). |
| `data.workflow.runtime_layout` | object | Runtime input form layout, returned when configured; nested fields match [Get workflow details](get-workflow.md). |
| `data.workflow.default_values` | object | Default runtime parameter object, returned when configured. |
| `data.workflow.design_graph` | object | Workflow design graph object, returned when configured. |
| `data.workflow.notification_config` | object | Terminal job notification configuration object, returned when configured. |
| `data.workflow.moi_workflow_def_id` | string | Associated workflow definition ID, returned when present. |
| `data.workflow.ui_resource` | object | Interactive UI asset bound to a dynamic service, returned only when bound. |
| `data.workflow.ui_resource.resource_uri` | string | Derived service UI resource URI. |
| `data.workflow.ui_resource.file_id` | string | Workspace HTML file ID. |
| `data.workflow.ui_resource.mime_type` | string | Resource MIME type, fixed to `text/html`. |

:::::
::::::
:::::::

## Error response

Returns `404` (`ErrNotFound`) when the workflow does not exist, and `409` when the workflow is managed by an agent automation task (`source_type` is `agent_automation_task`) or has a stale execution identity/version. Calling this endpoint on a `paused` workflow fails because its status precondition is not met; call [Resume workflow](resume-workflow.md) instead.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "ErrWorkflowUpdateManagedByAutomation",
  "msg": "workflow is managed by an automation task; edit the automation task instead"
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code, such as `ErrWorkspaceRequired`, `ErrForbidden`, `ErrNotFound`, `ErrWorkflowUpdateManagedByAutomation`, or `ErrServer`. |
| `msg` | string | Human-readable error message. |

:::::
::::::
:::::::
