# Resume workflow job

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

Requests the resumption of a specified workflow job. A successful request only means that the server accepts the recovery operation; please check the job status again to confirm subsequent execution.

```text
POST https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/{workflow_id}/executions/{execution_id}/resume
```

## Preparation before calling

First [query job details](get-workflow-job.md) and check whether `available_actions` contains recovery. Prepare a personal access token and target workspace ID that has access to the target workspace.

## Path parameters

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>workflow_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Workflow ID.</dd></div>
  <div class="mo-api-field"><dt><code>execution_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Job ID.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Request example</p>
```

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/$WORKFLOW_ID/executions/$EXECUTION_ID/resume" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::
::::

## Successful response

Returns `200` on success. `data.execution` returns the current execution information processed by the server.

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">string</span></dt><dd>`OK` when successful.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>`OK` when successful.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.execution_id</code><span class="mo-api-field__type">string</span></dt><dd>Execution ID.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.workflow_id</code><span class="mo-api-field__type">string</span></dt><dd>Workflow ID.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.status</code><span class="mo-api-field__type">string</span></dt><dd>Current execution status.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.available_actions</code><span class="mo-api-field__type">string[]</span></dt><dd>Currently allowed operations.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.execution_mode</code><span class="mo-api-field__type">string</span></dt><dd>Execution mode.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.cron_expression</code><span class="mo-api-field__type">string</span></dt><dd>Cron expression; only returned in timing mode.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.input_payload</code><span class="mo-api-field__type">object</span></dt><dd>Expanded run input.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.vars_payload</code><span class="mo-api-field__type">object</span></dt><dd>Expanded run variables.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.moi_task_id</code><span class="mo-api-field__type">string</span></dt><dd>Task ID; returned when assigned by the server.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.moi_case_id</code><span class="mo-api-field__type">string</span></dt><dd>Case ID; returned when assigned by the server.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.moi_workflow_def_id</code><span class="mo-api-field__type">string</span></dt><dd>Workflow definition ID; returned when assigned by the server.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.moi_workflow_version_id</code><span class="mo-api-field__type">string</span></dt><dd>Workflow version ID; returned when assigned by the server.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.pause_scope</code><span class="mo-api-field__type">string</span></dt><dd>Pause scope; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.error</code><span class="mo-api-field__type">string</span></dt><dd>Error; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.started_at</code><span class="mo-api-field__type">string</span></dt><dd>Execution start time; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.ended_at</code><span class="mo-api-field__type">string</span></dt><dd>Execution end time; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.created_at</code><span class="mo-api-field__type">string</span></dt><dd>Execution creation time; returned if there is a value.</dd></div>
  <div class="mo-api-field"><dt><code>data.execution.updated_at</code><span class="mo-api-field__type">string</span></dt><dd>Execution update time; returned if there is a value.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Successful response example</p>
```

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "execution": {
      "execution_id": "exec-001",
      "workflow_id": "wf-001",
      "status": "running",
      "available_actions": ["pause", "cancel"],
      "execution_mode": "one_shot",
      "input_payload": {},
      "vars_payload": {}
    }
  }
}
```

:::
::::

## Error response

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">string</span></dt><dd>Error code.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>Readable error message.</dd></div>
  <div class="mo-api-field"><dt><code>data</code><span class="mo-api-field__type">null</span></dt><dd>`null` in an error response.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Error response example</p>
```

```json
{
  "code": "ErrConflict",
  "msg": "资源状态冲突",
  "data": null
}
```

:::
::::

## Follow-up operations

Use the same job ID [query workflow job details](get-workflow-job.md) to confirm recovery and continue tracking until completion.
