# View node rerun plan

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

Check available modes, affected nodes, and verification results for reruns from the specified node. Create a rerun only if the plan passes verification.

```text
GET https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/{workflow_id}/executions/{execution_id}/nodes/{node_key}/rerun-plan
```

## Preparation before calling

First [query the job node](../workflow-jobs/get-workflow-job-node.md) and confirm the node key to be used as the starting point for re-running. Prepare a personal access token and target workspace ID that has access to the target workspace.



## Query 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></dt><dd>Workflow ID.</dd></div>
<div class="mo-api-field"><dt><code>execution_id</code><span class="mo-api-field__type">string</span></dt><dd>Source job ID.</dd></div>
<div class="mo-api-field"><dt><code>node_key</code><span class="mo-api-field__type">string</span></dt><dd>The node key to start the rerun from.</dd></div>
<div class="mo-api-field"><dt><code>source_node_execution_id</code><span class="mo-api-field__type">string</span></dt><dd>Used when selecting from multiple node execution candidates.</dd></div>
</dl>
```

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

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

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

:::
::::

## Successful 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>`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.plan.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.plan.source_execution_id</code><span class="mo-api-field__type">string</span></dt><dd>Source job ID.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.node_key</code><span class="mo-api-field__type">string</span></dt><dd>The node key of the rerun starting point.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.source_node_execution_id</code><span class="mo-api-field__type">string</span></dt><dd>Selected source node execution ID.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.rerun_contract_hash</code><span class="mo-api-field__type">string</span></dt><dd>Plan contract hash; can be used when created to prevent the use of expired plans.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.available_modes</code><span class="mo-api-field__type">string[]</span></dt><dd>Can be used to create rerun patterns.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.affected_downstream_nodes[]</code><span class="mo-api-field__type">array</span></dt><dd>Affected downstream nodes; only returned if there is a value.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.validation.ok</code><span class="mo-api-field__type">boolean</span></dt><dd>Whether the plan passes the verification.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.validation.code</code><span class="mo-api-field__type">string</span></dt><dd>Error code when verification fails; only returned if there is a value.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.validation.message</code><span class="mo-api-field__type">string</span></dt><dd>Error message when verification fails; only returned if there is a value.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.validation.reasons</code><span class="mo-api-field__type">string[]</span></dt><dd>Reasons when verification fails; only returned if there is a value.</dd></div>
<div class="mo-api-field"><dt><code>data.plan.candidates[]</code><span class="mo-api-field__type">array</span></dt><dd>Source node execution candidates; only returned if there are multiple candidates.</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": {
    "plan": {
      "workflow_id": "wf-001",
      "source_execution_id": "exec-001",
      "node_key": "root.load",
      "source_node_execution_id": "node-exec-001",
      "rerun_contract_hash": "rgh-001",
      "available_modes": ["continue_from_node"],
      "validation": {
        "ok": true
      },
      "candidates": []
    }
  }
}
```

:::
::::

## 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": "ErrNotFound",
  "msg": "资源不存在",
  "data": null
}
```

:::
::::

## Follow-up operations

Save `rerun_contract_hash`, and then [rerun](create-node-rerun.md) from the specified node.
