{"openapi":"3.1.0","info":{"title":"Cloudbridge Digital Employee API","version":"1.3.0","description":"调用数字员工，并通过轮询、SSE、签名 Webhook 和受保护任务成果交付结果。API 每分钟请求数、任务最长运行时间、历史记录保留期和队列优先级由调用账户当前会员等级决定，并在创建任务时固化。平台按费率收取数字员工基础费、单次最低费用及模型、工具、检索和容器等实际资源用量。"},"servers":[{"url":"https://ai.cbapi.ai"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/agents/{agentId}/responses":{"post":{"summary":"创建数字员工任务","parameters":[{"name":"agentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"相同 API Key 下用于避免重复创建和重复预扣费。","schema":{"type":"string","maxLength":120}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string","maxLength":12000,"description":"任务指令；与 message 二选一。"},"message":{"type":"string","maxLength":12000,"description":"input 的兼容字段。"},"model":{"type":"string","description":"可选的运行模型；省略时使用数字员工版本中的开发者推荐模型。"},"variables":{"type":"object","description":"传递给当前任务的结构化变量，不会自动修改员工记忆或正式配置。"},"webhookEndpointId":{"type":"string","format":"uuid","description":"在 API 凭证页面创建并启用，且属于当前 API Key 的 Webhook 端点。"}}}}}},"responses":{"202":{"description":"任务已创建；会员任务时限、历史保留期和队列优先级已固化"},"429":{"description":"超过会员等级允许的每分钟 API 请求数；读取 Retry-After 后重试"}}}},"/v1/runs/{runId}":{"get":{"summary":"读取运行与标准输出","parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"包含 response.content、artifacts、validation 与 usage"},"410":{"description":"任务详情已按会员历史保留期限归档，账单记录仍保留"},"429":{"description":"超过会员等级允许的每分钟 API 请求数"}}}},"/v1/runs/{runId}/events":{"get":{"summary":"订阅任务事件流（SSE）","description":"使用支持 Authorization 请求头的 fetch 流式客户端连接；任务进入终态后连接自动结束。","parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"text/event-stream 事件流"},"410":{"description":"任务事件已按会员历史保留期限归档"},"429":{"description":"超过会员等级允许的每分钟 API 请求数"}}}},"/api/agent-artifacts/{artifactId}/download":{"get":{"summary":"下载任务产物","description":"使用创建任务的同一账户 API Key 下载尚未过期且允许下载的产物。","parameters":[{"name":"artifactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"产物二进制内容"},"403":{"description":"版本或试用策略禁止下载"},"410":{"description":"产物已过期"}}}}},"webhooks":{"runCompleted":{"post":{"summary":"任务完成回调","description":"签名原文为 timestamp + \".\" + 原始 JSON。请求头包含 Cloudbridge-Event-Id、Cloudbridge-Timestamp 和 Cloudbridge-Signature: v1=<hex>。非 2xx 响应将按 30 秒、2 分钟、10 分钟、1 小时、6 小时、1 天、2 天重试。","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["agent.run.succeeded","agent.run.failed"]},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object"}}}}}},"responses":{"200":{"description":"确认接收"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"cbk_..."}},"schemas":{"ContentBlock":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["text","markdown","code","json","table","metric","chart","image","file","form","action_request","citation","warning","progress"]}}}}}}