> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 更新 Channel

> 更新 Channel 绑定、展示名、启停状态或回复选项。

`POST /api/v1/forward/channels/{channel_id}`

使用 merge-patch 语义，未出现字段保持不变。

## 请求头

| Header          | 是否必填 | 说明                 |
| --------------- | ---- | ------------------ |
| Authorization   | 是    | `Bearer <PAT>`     |
| Content-Type    | 是    | `application/json` |
| Idempotency-Key | 否    | 有副作用请求可选的幂等键。      |

## 路径参数

| 参数          | 类型     | 是否必填 | 说明          |
| ----------- | ------ | ---- | ----------- |
| channel\_id | string | 是    | Channel ID。 |

## 请求体参数

| 参数                                | 类型      | 是否必填 | 说明                        |
| --------------------------------- | ------- | ---- | ------------------------- |
| name                              | string  | 否    | Channel 展示名。              |
| identity\_id                      | string  | 否    | 新的绑定 Forward Identity ID。 |
| template\_id                      | string  | 否    | 新的绑定 Forward Template ID。 |
| enabled                           | boolean | 否    | 人工启停开关。                   |
| channel\_config.credentials       | object  | 否    | 更新渠道凭据，用于凭据轮换。            |
| channel\_config.response\_options | object  | 否    | 回复内容可见性配置。                |

## 示例请求

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/channels/channel_019eabc123' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": false,
  "channel_config": {
    "response_options": {
      "include_tool_calls": true,
      "include_thinking": false
    }
  }
}'
```

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "id": "channel_019eabc123",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_support",
  "channel_type": "feishu",
  "name": "Support Feishu channel",
  "enabled": false,
  "binding_status": "bound",
  "channel_config": {
    "response_options": {
      "include_tool_calls": true,
      "include_thinking": false
    }
  },
  "created_at": "2026-06-18T10:00:00Z",
  "updated_at": "2026-06-18T10:30:00Z"
}
```

## 响应字段

| 字段  | 类型     | 说明               |
| --- | ------ | ---------------- |
| 返回值 | object | 更新后的 Channel 对象。 |

## 错误

| HTTP | Type                    | Code                         | 触发条件             |
| ---- | ----------------------- | ---------------------------- | ---------------- |
| 400  | `invalid_request_error` | `invalid_request`            | 请求体不合法。          |
| 404  | `not_found_error`       | `channel_not_found`          | Channel 不存在。     |
| 404  | `not_found_error`       | `channel_template_not_found` | 新的 Template 不存在。 |
| 404  | `not_found_error`       | `channel_identity_not_found` | 新的 Identity 不存在。 |
| 409  | `conflict_error`        | `channel_identity_disabled`  | 新的 Identity 已停用。 |
| 401  | `authentication_error`  | `authentication_required`    | PAT 无效或已过期。      |

## 注意事项

* `id`、`type` 和 `channel_type` 不允许更新。
* `binding_status` 由系统维护。
* `enabled=true` 只打开人工开关，不改变 `binding_status`。
* 更新 `identity_id` 或 `template_id` 后，已有会话关系可能停止复用，新消息按新绑定创建会话。

## 相关

<CardGroup cols={2}>
  <Card title="获取 Channel" icon="file-lines" href="/cloud-agents/api/forward/channels/get" />

  <Card title="列出 Channels" icon="list" href="/cloud-agents/api/forward/channels/list" />
</CardGroup>
