curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/forward/v0/channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": "agent_xxx",
"environment_id": "env_xxx"
},
"channel_config": {
"credentials": {
"app_id": "xxx",
"app_secret": "xxx"
},
"group_reply_in_thread": true
}
}
'{
"id": "channel_feishu_xxx",
"type": "channel",
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": {
"type": "agent",
"id": "agent_xxx",
"version": 3
},
"environment_id": "env_xxx",
"vault_ids": [],
"file_ids": [],
"memory_stores": []
},
"enabled": true,
"binding_status": "bound",
"connection_status": "disconnected",
"channel_config": {
"response_options": {
"include_tool_calls": false,
"include_process": false,
"card_output": true
},
"private_memory_store_enabled": false,
"group_prompt_template": null,
"group_reply_in_thread": true
},
"last_error": null,
"created_at": "2026-10-30T00:00:00.000Z",
"updated_at": "2026-10-30T00:00:00.000Z"
}Channel
创建 Channel
创建 Channel,将固定版本的 Agent 绑定到飞书、企业微信、钉钉或个人微信;201 仅表示保存成功,连接异步建立,凭据永不回显。
POST
/
agent
/
forward
/
v0
/
channels
curl --request POST \
--url https://agent-api.bigmodel.cn/api/agent/forward/v0/channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": "agent_xxx",
"environment_id": "env_xxx"
},
"channel_config": {
"credentials": {
"app_id": "xxx",
"app_secret": "xxx"
},
"group_reply_in_thread": true
}
}
'{
"id": "channel_feishu_xxx",
"type": "channel",
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": {
"type": "agent",
"id": "agent_xxx",
"version": 3
},
"environment_id": "env_xxx",
"vault_ids": [],
"file_ids": [],
"memory_stores": []
},
"enabled": true,
"binding_status": "bound",
"connection_status": "disconnected",
"channel_config": {
"response_options": {
"include_tool_calls": false,
"include_process": false,
"card_output": true
},
"private_memory_store_enabled": false,
"group_prompt_template": null,
"group_reply_in_thread": true
},
"last_error": null,
"created_at": "2026-10-30T00:00:00.000Z",
"updated_at": "2026-10-30T00:00:00.000Z"
}请求协议
所有请求携带 Bearer 凭据、zai-version: 2026-05-26 和 zai-beta: managed-agents-2026-05-26;多个 beta 值用逗号分隔且必须包含此值。JSON 请求设置 Content-Type: application/json。Channel 当前不支持 Coding Plan 请求。
选择渠道与凭据
| channel_type | 渠道 | 必需凭据与专属配置 |
|---|---|---|
feishu | 飞书 | app_id/app_secret;可设置 group_reply_in_thread |
wecom | 企业微信 | 智能机器人长连接的 bot_id/secret |
dingtalk | 钉钉 | 应用 client_id/client_secret;可设置已发布互动卡片模板 |
wechat | 个人微信 | 不传 credentials,创建后扫码绑定 |
资源与组合校验
调用 Create API 的身份必须具有目标 Agent 的 owner 权限。Agent、Environment、Vault、File 和 Memory Store 必须属于同一账号;资源 ID 均在 trim 后为 1–128 字符。Agent 字符串或省略 version 时,创建时解析并固定当前版本,后续更新 Agent 不会改变已有 Channel。 序列化后的channel_config 配置 JSON 不得超过 65,535 UTF-8 字节,超限返回 400。凭据中的标识字段 trim 后为 1–256 字符;Secret 为 1–4096 字符且不 trim。凭据对象还受加密存储的组合长度上限约束,单字段长度合法也可能因组合过长返回 400,不能只按单字段长度判断。
群聊模板的占位符、钉钉卡片字段格式及 Memory Store 挂载总数等跨字段校验见相应字段说明。owner 或资源预检调用失败时返回 500,不创建 Channel。
创建后状态与错误
201 只表示预检和保存成功,初始连接状态为 disconnected;微信初始 unbound,须继续扫码。调用获取 Channel检查绑定、连接状态和 last_error,并发送真实消息验证。连接成功与消息处理、文本和附件送达分别判断。 同一账号默认最多 5 个 Create 预检在途;繁忙时返回 503 和Retry-After: 1,不排队。这与请求频率超限的 429 不同。502 在本接口表示渠道探测未返回有效机器人身份;二维码创建接口的无效二维码响应或渲染失败也可能返回 502。
请求限流
同一账号的不同 API Key 共享请求频率额度。GET(含扫码查询)计入 read,POST/PATCH/DELETE(含扫码创建)计入 write。下表为默认值,实际额度以服务响应为准。| 类别 | 账号容量 | 账号每秒补充 | 全局容量 | 全局每秒补充 |
|---|---|---|---|---|
| read | 100 | 50 | 1000 | 500 |
| write | 20 | 10 | 400 | 200 |
ratelimit-limit、ratelimit-remaining、ratelimit-reset 和 retry-after;后两项为相对秒数,全局限流另带 x-ratelimit-scope: global。并发预检忙返回 503,不属于 429。Authorizations
标准的 HTTP Bearer 认证方式,在 API Keys 页面获取密钥。
Headers
Body
application/json
- 飞书
- 企业微信
- 钉钉
- 个人微信
按 channel_type 选择配置。所有对象均为严格 Schema,未知、跨渠道字段或类型错误返回 400。
Response
预检与配置保存成功,初始连接状态 disconnected;不代表可收发消息。
- 飞书
- 企业微信
- 钉钉
- 个人微信
固定 Agent 版本和渠道安全配置。不回显 credentials、扫码 token、平台消息 ID、内部 Session ID 或计费字段。
Was this page helpful?