---

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

orphan: true
---

# 更新智能体工作流绑定

更新绑定的工作流、节点、模板或输入输出映射。

```text
PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agent-workflow-bindings/{binding_id}
```

## 调用前准备



## 请求体

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} 调用示例

```bash
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agent-workflow-bindings/$BINDING_ID" -H "X-API-Key: $AI_STUDIO_API_KEY" -H "X-Workspace-ID: $WORKSPACE_ID" -H 'Content-Type: application/json' -d '{"input_mapping":{"document":"$.content"}}'
```

:::::
:::::{tab-item} 参数说明

| 参数 | 类型 | 是否必填 | 说明 |
| --- | --- | --- | --- |
| `workflow_id` | string | 否 | 工作流 ID。 |
| `workflow_version_id` | string | 否 | 工作流版本 ID。 |
| `node_id` | string | 否 | 工作流节点 ID。 |
| `agent_task_template_id` | string | 否 | 智能体任务模板 ID。 |
| `input_mapping` | object | 否 | 输入映射。 |
| `output_mapping` | object | 否 | 输出映射。 |
| `failure_mapping` | object | 否 | 失败处理映射。 |
| `status` | string | 否 | 绑定状态。 |
| `labels` | object | 否 | 标签键值对。 |
| `annotations` | object | 否 | 注解键值对。 |

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

## 成功响应

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{"code": 0, "data": {"id": "binding_01", "input_mapping": {"document": "$.content"}}}
```

:::::
:::::{tab-item} 字段说明

成功时返回 `200` 和更新后的绑定。



响应字段如下。

::::{tab-set}
:::{tab-item} 通用字段

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `code` | integer | 成功时为 `0`。 |

:::

:::{tab-item} 基本信息

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 绑定 ID。 |
| `input_mapping` | object | 更新后的输入映射。 |

:::
::::

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

## 错误响应

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{"code": 5, "message": "agent workflow binding not found"}
```

:::::
:::::{tab-item} 字段说明

### 常见 HTTP 错误

::::{tab-set}
:::{tab-item} 通用字段

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `400` | `2` | **常见原因：**请求体无效。**建议操作：**检查要更新的字段。 |
| `404` | `5` | **常见原因：**绑定不存在。**建议操作：**核对绑定 ID。 |

:::
::::

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