Skip to main content
Channels

更新 Channel

POST /api/v1/forward/channels/{channel_id} 使用 merge-patch 语义,未出现字段保持不变。

请求头

Header是否必填说明
AuthorizationBearer <PAT 或 SAT>
Content-Typeapplication/json
Idempotency-Key有副作用请求可选的幂等键。

路径参数

参数类型是否必填说明
channel_idstringChannel ID。

请求体参数

参数类型是否必填说明
namestringChannel 展示名。
identity_idstringfixed 模式下新的 Forward Identity ID。
template_idstringfixed 模式下新的 Forward Template ID。
enabledboolean人工启停开关。
channel_config.credentialsobject更新渠道凭据,用于凭据轮换。
channel_config.response_optionsobject回复内容可见性配置。

示例请求

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

示例响应

HTTP 200 OK
{
  "id": "channel_019eabc123",
  "type": "channel",
  "identity_id": "idn_019eabc123",
  "identity_resolution": {
    "mode": "fixed"
  },
  "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 对象。

错误码

HTTPType触发条件
400invalid_request_error请求体不合法。
401authentication_errorPAT 或 SAT 无效或已过期。
404not_found_errorChannel 不存在。
404not_found_error新的 Template 不存在。
404not_found_error新的 Identity 不存在。
409conflict_error新的 Identity 已停用。

注意事项

  • identity_resolution.mode 创建后不可更新;需要切换模式时必须删除并重建 Channel。
  • pairing 模式不允许更新 identity_idtemplate_id,二者由 Pairing API 按消息范围绑定。
  • idtypechannel_type 不允许更新。
  • binding_status 由系统维护。
  • enabled=true 只打开人工开关,不改变 binding_status
  • fixed 模式更新 identity_idtemplate_id 后,已有会话关系可能停止复用,新消息按新绑定创建会话。

相关