Skip to main content
POST

请求协议

所有请求携带 Bearer 凭据、zai-version: 2026-05-26 和 zai-beta: managed-agents-2026-05-26;多个 beta 值用逗号分隔且必须包含此值。JSON 请求设置 Content-Type: application/json。Channel 当前不支持 Coding Plan 请求。

选择渠道与凭据

企业微信不接受群机器人 Webhook URL、CorpID 或 AgentId。钉钉凭据对应开放平台的 Client ID/AppKey 与 Client Secret/AppSecret。不同渠道的专属字段不能混用;未知字段或错误类型返回 400。 四个请求示例可在右侧示例选择器切换。准备机器人、完整接入命令和真实消息验证见接入聊天渠道。字段、默认值、响应和错误码以本页自动生成的接口定义为准。

资源与组合校验

调用 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。下表为默认值,实际额度以服务响应为准。 429 响应携带 ratelimit-limit、ratelimit-remaining、ratelimit-reset 和 retry-after;后两项为相对秒数,全局限流另带 x-ratelimit-scope: global。并发预检忙返回 503,不属于 429。

Authorizations

Authorization
string
header
required

标准的 HTTP Bearer 认证方式,在 API Keys 页面获取密钥。

Headers

zai-version
enum<string>
default:2026-05-26
required

Channel API v0 基础协议标识,固定为 2026-05-26。

Available options:
2026-05-26
Example:

"2026-05-26"

zai-beta
string
default:managed-agents-2026-05-26
required

可有多个逗号分隔值,但必须包含 managed-agents-2026-05-26。

Example:

"managed-agents-2026-05-26"

Body

application/json

按 channel_type 选择配置。所有对象均为严格 Schema,未知、跨渠道字段或类型错误返回 400。

channel_type
enum<string>
required

固定为 feishu。

Available options:
feishu
name
string
required

名称;trim 后 1–128 字符。

Required string length: 1 - 128
Example:

"Channel xxx"

template
object
required

收到消息后创建 Managed Session 所用的固定模板。

channel_config
飞书 · object
required

飞书创建配置;未知字段、类型错误和跨渠道字段返回 400。序列化后的配置 JSON 不得超过 65,535 UTF-8 字节,超限返回 400。

Response

预检与配置保存成功,初始连接状态 disconnected;不代表可收发消息。

固定 Agent 版本和渠道安全配置。不回显 credentials、扫码 token、平台消息 ID、内部 Session ID 或计费字段。

id
string
required
Example:

"channel_xxx"

type
enum<string>
required
Available options:
channel
channel_type
enum<string>
required

渠道平台。

Available options:
feishu
name
string
required
Example:

"Channel xxx"

template
object
required
enabled
boolean
required

新建 Channel 固定为 true。

Example:

true

binding_status
string
required

绑定状态。WeChat 创建后为 unbound;创建扫码会话后可能为 pending,继续查询 QR 状态;手机确认后为 bound。其他渠道通常创建后为 bound。

Example:

"bound"

connection_status
enum<string>
required

异步连接状态。disconnected 尚未建立;connecting 连接中;connected 已连接;error 查看 last_error。

Available options:
disconnected,
connecting,
connected,
error
Example:

"disconnected"

channel_config
飞书 · object
required
last_error
object | null
required

最近连接错误的安全提示,正常时为 null;不能仅凭该字段判断某轮 Agent 执行是否成功。

Example:

null

created_at
string<date-time>
required

创建时间。

updated_at
string<date-time>
required

更新时间。