Skip to content

OpenAPI ​

OpenAPI 的本质是把 WinNexo 的前台能力当成你现有系统的"AI 能力插件"调用。 本文是完整接口参考:先讲清鉴权与通用规范,再按能力域给出全部接口的总览表与逐接口的路径、请求参数、响应参数与调用示例。

公共云 OpenAPI 文档站传送门

工作原理 ​

mermaid
graph LR
    A[你的业务系统] -->|HTTP 请求 + AccessToken| B[WinNexo OpenAPI 网关]
    B --> C[会话能力]
    B --> D[快捷技能]
    B --> E[我的资源]
    B --> F[企业知识库]
    B --> I[定时任务]
    B --> J[用户与组织]
    C --> G[数字员工]
    D --> G
    E --> H[产出/资源]
    F --> H

每次调用都需要带上身份凭证(Authorization: Bearer <AccessToken>)。凭证类型见下方「鉴权」章节。

鉴权与通用规范 ​

网关地址 ​

  • 所有接口统一前缀:/openapi
  • 完整地址形如:https://<gateway-domain>/openapi/<接口路径>
  • <gateway-domain> 为你所在部署的网关域名,请向管理员获取。

AccessToken 类型 ​

所有接口通过请求头 Authorization: Bearer <AccessToken> 鉴权,由 require_openapi_identity 统一处理。支持三类 Token:

Token 类型前缀说明适用场景
用户 API Tokenwn_个人身份凭证,代表某个具体用户个人脚本、IDE 插件、CLI 登录
部署级 Tokenwn_dpl_部署级凭证,需配合租户/用户信息使用服务端集成、后台批处理
加密包 Token@ENCRYPT__加密串形式下发的凭证特定托管/加密下发场景

获取与管理用户 API Token,请阅读个人设置中的 UserToken 说明。

租户 ID 确认 ​

  • 单租户用户:租户自动推断,无需显式传入。
  • 多租户用户:需显式指定租户,二选一:
    • Query 参数:tenantId 或 tenant_id
    • 请求头:X-Tenant-Id
  • 未指定且无法自动推断时返回 ERR.Auth.TenantIdRequired。

请求规范 ​

  • HTTP 方法:写操作默认 POST;只读查询部分为 GET(个别删除为 DELETE),以各接口「接口信息」为准。
  • 必填请求头:
    • Authorization: Bearer <AccessToken>
    • Content-Type: application/json
  • 可选请求头:
    • X-Tenant-Id:多租户下指定租户
    • X-Timezone:指定时区(如 Asia/Shanghai),影响时间相关字段
  • 字段命名:请求 / 响应字段统一使用 camelCase。
  • 禁传字段:请求体中不要传 tenantId / tenant_id、userId / user_id——这些由鉴权链路自动推导,显式传入会被忽略或报错。

响应规范 ​

所有接口返回 POP 网关兼容格式:顶层固定 Code / Message / RequestId,业务字段扁平展开(无嵌套 data 包装)。

成功响应:

json
{
  "Code": "200",
  "Message": "success",
  "RequestId": "req-xxx",
  "businessField": "value"
}

错误响应:

json
{
  "Code": "ERR.User.NotFound",
  "Message": "用户不存在",
  "RequestId": "req-xxx",
  "error_type": "USER_ERROR",
  "solution": "请检查用户ID是否正确"
}

多语言调用示例 ​

以「创建个人文件」createPersonalFile 为例,演示各语言调用姿势。其余接口只需替换路径与请求体。

cURL:

bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalFile" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{
    "operatingObjectName": "my-agent",
    "name": "周报.md",
    "filePath": "https://oss.example.com/xxx/周报.md"
  }'

Python(requests):

python
import requests

resp = requests.post(
    "https://<gateway-domain>/openapi/createPersonalFile",
    headers={
        "Authorization": "Bearer <AccessToken>",
        "Content-Type": "application/json",
    },
    json={
        "operatingObjectName": "my-agent",
        "name": "周报.md",
        "filePath": "https://oss.example.com/xxx/周报.md",
    },
)
print(resp.json())

Java(OkHttp):

java
OkHttpClient client = new OkHttpClient();
MediaType JSON = MediaType.parse("application/json");
String body = "{\"operatingObjectName\":\"my-agent\",\"name\":\"周报.md\",\"filePath\":\"https://oss.example.com/xxx/周报.md\"}";
Request request = new Request.Builder()
    .url("https://<gateway-domain>/openapi/createPersonalFile")
    .addHeader("Authorization", "Bearer <AccessToken>")
    .post(RequestBody.create(body, JSON))
    .build();
try (Response response = client.newCall(request).execute()) {
    System.out.println(response.body().string());
}

Go(net/http):

go
payload := strings.NewReader(`{"operatingObjectName":"my-agent","name":"周报.md","filePath":"https://oss.example.com/xxx/周报.md"}`)
req, _ := http.NewRequest("POST", "https://<gateway-domain>/openapi/createPersonalFile", payload)
req.Header.Set("Authorization", "Bearer <AccessToken>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(string(data))

Node.js(fetch):

javascript
const resp = await fetch("https://<gateway-domain>/openapi/createPersonalFile", {
  method: "POST",
  headers: {
    Authorization: "Bearer <AccessToken>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    operatingObjectName: "my-agent",
    name: "周报.md",
    filePath: "https://oss.example.com/xxx/周报.md",
  }),
});
console.log(await resp.json());

常见错误码 ​

错误码含义处理建议
ERR.Auth.UnsupportedAuthType不支持的鉴权类型检查 Token 前缀与 Authorization 头格式
ERR.Auth.TenantIdRequired未指定租户且无法自动推断多租户下传入 tenantId 或 X-Tenant-Id
ERR.Auth.TenantAccessDenied无权访问该租户确认当前用户属于目标租户
ERR.User.NotFound用户不存在检查用户标识是否正确
ERR.Resource.NotFound资源不存在检查资源 ID 是否正确、是否已删除
ERR.Robject.UserDirectory.NotAuthorized无目录访问权限确认数字员工对目标目录有可见/操作权限
ERR.System.Error系统内部错误携带 RequestId 联系管理员排查

注意事项 ​

  • 幂等调用:写接口可传 clientToken(调用方自行生成)用于幂等标识。
  • 数字员工上下文:多数资源/知识/对象类接口需传 operatingObjectName(数字员工名称,即运营对象 name)来确定操作上下文与权限范围。
  • 大文件上传:大文件走 OSS 直传——先调 getSourceUploadSignature 获取签名 URL,直传后再登记资源;会话内小文件可用 uploadChatFile 后端直传。
  • 异步任务查询:runSkill 返回 runId,通过 getSkillRun 轮询执行状态与结果。
  • 版本兼容:新增能力向后兼容,调用路径不变,历史接口持续可用。

接口总览 ​

共 82 个接口,按能力域分组。

系统与实例(2 个) ​

接口方法路径说明
checkHealthGET/openapi/checkHealth健康检查与鉴权探测
getInstanceExpireTimeGET/openapi/getInstanceExpireTime获取实例到期时间

会话(7 个) ​

接口方法路径说明
sendChatMessagePOST/openapi/v1/chatMessages发送会话消息
getChatSessionGET/openapi/v1/chatSession获取会话详情
listChatSessionsGET/openapi/v1/chatSession/list获取会话列表
updateChatSessionPOST/openapi/v1/chatSession/update更新会话信息
stopChatSessionPOST/openapi/v1/chatSession/stop停止会话生成
deleteChatSessionDELETE/openapi/v1/chatSession/delete删除会话
uploadChatFilePOST/openapi/v1/uploadChatFile上传会话文件

快捷技能(4 个) ​

接口方法路径说明
listSkillsPOST/openapi/listSkills查询技能列表
getSkillPOST/openapi/getSkill获取技能详情
runSkillPOST/openapi/runSkill异步执行技能
getSkillRunPOST/openapi/getSkillRun查询技能异步执行结果

我的资源(19 个) ​

接口方法路径说明
createPersonalFilePOST/openapi/createPersonalFile创建个人文件资源
createPersonalTextPOST/openapi/createPersonalText创建个人在线小记(文本)
createPersonalVoiceMeetingPOST/openapi/createPersonalVoiceMeeting创建个人语音会议记录
createPersonalDingtalkMeetingPOST/openapi/createPersonalDingtalkMeeting创建个人 DingTalk 会议记录
createPersonalAliDingMeetingPOST/openapi/createPersonalAliDingMeeting创建个人钉钉会议记录
createPersonalAliDingDocPOST/openapi/createPersonalAliDingDoc创建个人钉钉文档资源
createPersonalAliDingKnowledgeBasePOST/openapi/createPersonalAliDingKnowledgeBase创建个人钉钉知识库资源
createPersonalFeishuMinutePOST/openapi/createPersonalFeishuMinute创建个人飞书妙记资源
createPersonalDirectoryPOST/openapi/createPersonalDirectory创建个人资源目录
listPersonalDirectoryContentsPOST/openapi/listPersonalDirectoryContents下钻查询我的资源目录内容
getSourcePOST/openapi/getSource获取资源详情
getSourceUploadSignaturePOST/openapi/getSourceUploadSignature获取资源上传签名
moveResourcePOST/openapi/moveResource移动个人资源
renameSourcePOST/openapi/renameSource重命名个人资源
updateDirectoryPOST/openapi/updateDirectory更新个人资源目录
retryDirectoryFailedSourcesPOST/openapi/retryDirectoryFailedSources重试目录内失败资源
previewPersonalSourcePOST/openapi/previewPersonalSource预览个人资源
listOutputFilesPOST/openapi/listOutputFiles查询当前用户产出列表
saveOutputFileToResourcePOST/openapi/saveOutputFileToResource产出批量保存为个人资源

企业知识库(16 个) ​

接口方法路径说明
listVisibleKnowledgeBasesPOST/openapi/listVisibleKnowledgeBases查询数字员工可见知识库列表
listVisibleKnowledgeBaseContentsPOST/openapi/listVisibleKnowledgeBaseContents下钻查询可见知识库目录内容
listAdminKnowledgeBasesPOST/openapi/listAdminKnowledgeBases后台查询/下钻企业知识库
submitSourceToKnowledgeBasePOST/openapi/submitSourceToKnowledgeBase个人资源提交到企业知识库
createKnowledgeBaseFilePOST/openapi/createKnowledgeBaseFile创建知识库文件资源
createKnowledgeBaseTextPOST/openapi/createKnowledgeBaseText创建知识库文本资源
createKnowledgeBaseAliDingDocPOST/openapi/createKnowledgeBaseAliDingDoc创建知识库钉钉文档资源
createKnowledgeBaseDirectoryPOST/openapi/createKnowledgeBaseDirectory创建知识库目录
getKnowledgeBaseSourcePOST/openapi/getKnowledgeBaseSource获取知识库资源详情
listKnowledgeBaseDirectoriesPOST/openapi/listKnowledgeBaseDirectories查询知识库目录列表
updateKnowledgeBaseDirectoryPOST/openapi/updateKnowledgeBaseDirectory更新知识库目录
moveKnowledgeBaseResourcePOST/openapi/moveKnowledgeBaseResource移动企业知识库资源
renameKnowledgeBaseSourcePOST/openapi/renameKnowledgeBaseSource重命名企业知识库资源
updateKnowledgeBaseSourceTagsPOST/openapi/updateKnowledgeBaseSourceTags更新知识库资源标签
retryKnowledgeBaseFailedSourcesPOST/openapi/retryKnowledgeBaseFailedSources重试知识库失败资源
previewKnowledgeBaseSourcePOST/openapi/previewKnowledgeBaseSource预览知识库资源

定时任务(8 个) ​

接口方法路径说明
createScheduledTaskPOST/openapi/createScheduledTask创建定时任务
updateScheduledTaskPOST/openapi/updateScheduledTask更新定时任务
listScheduledTasksPOST/openapi/listScheduledTasks获取定时任务列表
executeScheduledTaskPOST/openapi/executeScheduledTask立即执行定时任务
getScheduledTaskExecutionDetailPOST/openapi/getScheduledTaskExecutionDetail获取定时任务执行详情
getScheduledTaskExecutionRecordsPOST/openapi/getScheduledTaskExecutionRecords获取定时任务执行记录
getScheduledTaskPushOptionsPOST/openapi/getScheduledTaskPushOptions获取定时任务推送选项
getScheduledTaskUnderstandDetailPOST/openapi/getScheduledTaskUnderstandDetail获取定时任务理解详情

主对象数据(3 个) ​

接口方法路径说明
queryPrimaryObjectDataPOST/openapi/queryPrimaryObjectData分页查询主对象数据
togglePrimaryObjectFavoritePOST/openapi/togglePrimaryObjectFavorite关注/取消关注主对象
replaceObjectBindingsPOST/openapi/replaceObjectBindings替换对象绑定关系

用户、Credit 与账单(4 个) ​

接口方法路径说明
getUserInfoGET/openapi/getUserInfo获取当前用户信息
updateUserInfoPOST/openapi/updateUserInfo更新当前用户信息
getUserCreditUsagePOST/openapi/getUserCreditUsage获取用户 Credit 用量
listBillingPOST/openapi/listBilling查询账单列表

用户与权限管理(15 个) ​

接口方法路径说明
createUserPOST/openapi/createUser创建用户
updateUserPOST/openapi/updateUser更新用户
getUserPOST/openapi/getUser获取用户详情
listUsersPOST/openapi/listUsers查询用户列表
removeUserPOST/openapi/removeUser移除用户
resetPasswordPOST/openapi/resetPassword重置用户密码
getTokenInfoPOST/openapi/getTokenInfo获取 Token 信息
enableTokenPOST/openapi/enableToken启用用户 Token
disableTokenPOST/openapi/disableToken停用用户 Token
resetTokenPOST/openapi/resetToken重置用户 Token
grantAgentUsersPOST/openapi/grantAgentUsers授予数字员工用户权限
revokeAgentUsersPOST/openapi/revokeAgentUsers回收数字员工用户权限
listAuthorizedAgentsPOST/openapi/listAuthorizedAgents查询已授权数字员工
listAuthorizedUsersPOST/openapi/listAuthorizedUsers查询已授权用户
updateAgentAuthModePOST/openapi/updateAgentAuthMode更新数字员工授权模式

组织同步(4 个) ​

接口方法路径说明
createCustomOrgPOST/openapi/createCustomOrg创建自定义组织
syncOrgStructurePOST/openapi/syncOrgStructure同步组织架构
querySyncResultPOST/openapi/querySyncResult查询组织同步结果
listAvailableConfigsPOST/openapi/listAvailableConfigs查询可用组织同步配置

系统与实例 ​

checkHealth · 健康检查与鉴权探测 ​

OpenAPI 入口健康检查,可用于探测鉴权是否生效及当前生效的调用方 / 租户 / 数字员工。

GET /openapi/checkHealth

请求:无请求体参数。

响应字段:

字段类型说明
callerTypestr调用方类型:user / aliyun_main / aliyun_ram / service
authSourcestr认证来源:bearer / aliyun_gateway
userIdint平台用户 ID
tenantIdint生效租户 ID
digitalEmployeeNamestr当前请求生效的数字员工名(运营对象);未传且租户下无数字员工时为空
bash
curl -X GET "https://<gateway-domain>/openapi/checkHealth" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json"

getInstanceExpireTime · 查询租户标准包实例过期时间 ​

OpenAPI 查询租户标准包实例过期时间。

POST /openapi/getInstanceExpireTime

请求:无请求体参数。

响应字段:

字段类型说明
tenantIdint系统租户 ID
instanceIdstr实例 ID
instanceExpireTimestr实例过期时间(ISO 格式)
instanceStatusstr实例状态
foundbool是否找到标准包实例
bash
curl -X POST "https://<gateway-domain>/openapi/getInstanceExpireTime" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

会话 ​

sendChatMessage · 发送会话消息 ​

向会话发送消息,不传 sessionId 则新建会话。

POST /openapi/v1/chatMessages

请求字段:

字段类型必填说明
contentstr✅用户消息正文
contentTypestr❌消息类型:Text / Markdown(默认 Text)
sessionIdstr❌会话ID,不传则新建会话
digitalEmployeeNamestr❌数字员工名称
fileslist[FileRef]❌文件引用列表
streambool❌是否流式返回(默认 True)
reuseLastSessionbool❌不传 sessionId 时是否复用该数字员工最近一个会话(默认 False)

响应:仅返回通用包装字段 {"Code":"200","Message":"success","RequestId":"req-xxx"}(流式内容通过流通道推送)。

bash
curl -X POST "https://<gateway-domain>/openapi/v1/chatMessages" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"content":"帮我总结上周客户拜访","stream":true}'

getChatSession · 获取单个会话详情 ​

OpenAPI 获取单个会话详情端点。

GET /openapi/v1/chatSession

Query 参数:

参数类型必填说明
sessionIdstring❌会话 ID

响应字段:

字段类型说明
sessionConversationInfo会话信息
messageslist[ConversationMessageInfo]最近消息列表
bash
curl -X GET "https://<gateway-domain>/openapi/v1/chatSession?sessionId=<sessionId>" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json"

listChatSessions · 获取会话列表 ​

OpenAPI 会话列表端点。

GET /openapi/v1/chatSession/list

Query 参数:

参数类型必填说明
tenant_idstring❌租户 ID
page_sizestring❌每页数量
pagestring❌页码
keywordstring❌关键词
digital_employee_namestring❌数字员工名称

响应字段:

字段类型说明
datalist[ConversationInfo]会话列表
totalint满足条件的总数
pageint当前页码
pageSizeint每页条数
hasMorebool是否有更多数据
bash
curl -X GET "https://<gateway-domain>/openapi/v1/chatSession/list?page=1&page_size=20" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json"

updateChatSession · 更新会话信息 ​

更新会话标题等信息。

POST /openapi/v1/chatSession/update

请求字段:

字段类型必填说明
sessionIdstr❌会话ID
titlestr❌新的会话标题

响应字段:

字段类型说明
sessionConversationInfo更新后的会话信息
bash
curl -X POST "https://<gateway-domain>/openapi/v1/chatSession/update" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sessionId":"12345","title":"客户拜访总结"}'

stopChatSession · 停止会话生成 ​

停止指定会话当前正在生成的回复。

POST /openapi/v1/chatSession/stop

Query 参数:

参数类型必填说明
sessionIdstring❌会话 ID

请求字段:

字段类型必填说明
Reasonstr❌停止原因(审计用)

响应字段:

字段类型说明
sessionIdstr会话ID
messageIdstr被停止的消息ID
statusstr消息最终状态
finishReasonstr结束原因
partialContentstr已生成的部分内容
bash
curl -X POST "https://<gateway-domain>/openapi/v1/chatSession/stop?sessionId=12345" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"Reason":"用户主动取消"}'

deleteChatSession · 删除会话 ​

OpenAPI 删除会话端点。

DELETE /openapi/v1/chatSession/delete

Query 参数:

参数类型必填说明
sessionIdstring❌会话 ID

响应字段:

字段类型说明
sessionIdstr会话 ID
deletedbool是否删除成功
hardDeletebool是否硬删除
bash
curl -X DELETE "https://<gateway-domain>/openapi/v1/chatSession/delete?sessionId=<sessionId>" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json"

uploadChatFile · 会话文件上传 ​

会话场景下的后端直传文件上传端点。

POST /openapi/v1/uploadChatFile

请求:无请求体参数(文件通过 multipart 形式上传)。

响应字段:

字段类型说明
objectNamestrOSS 对象路径
fileUrlstr文件 remote_url(入库路径)
filePublicUrlstr文件公开访问 URL(有效期 1 小时)
uploadSignatureUrlstr签名上传 URL(本接口为后端直传,该字段为空)
fileRecordIdstr文件记录 ID
contentTypestr文件 MIME 类型
fileNamestr文件名
bash
curl -X POST "https://<gateway-domain>/openapi/v1/uploadChatFile" \
  -H "Authorization: Bearer <AccessToken>" \
  -F "file=@/path/to/local/file.pdf"

快捷技能 ​

listSkills · 查询技能列表 ​

OpenAPI 技能列表查询。

POST /openapi/listSkills

请求字段:

字段类型必填说明
filterTypestr❌筛选类型:ALL / BUILTIN / CUSTOM / DRAFT / ALL_WITH_DRAFTS(默认 ALL)
tagslist[str]❌按标签筛选,数组任一命中即匹配
keywordstr❌关键词搜索,模糊匹配名称或描述
pageint❌页码(默认 1)
pageSizeint❌每页数量,1-100(默认 20)
operatingObjectNamestr❌数字员工名称;必须与 bindStatus 同时传入
bindStatusstr❌绑定状态:BOUND / UNBOUND;必须与 operatingObjectName 同时传入

响应字段:

字段类型说明
itemslist[OpenAPISkillItem]技能列表
totalint符合条件的技能总数
pageint当前页码
pageSizeint每页数量
bash
curl -X POST "https://<gateway-domain>/openapi/listSkills" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"filterType":"BUILTIN","page":1,"pageSize":20}'

getSkill · 获取技能详情 ​

OpenAPI 技能详情查询。

POST /openapi/getSkill

请求字段:

字段类型必填说明
skillCodestr❌技能编码(全局唯一),优先级高于 skillName
skillNamestr❌技能名称,未传 skillCode 时使用;租户范围内唯一
viewModestr❌视角:draft(草稿)/ published(默认)
includeSkillFilesbool❌是否返回完整文件树(默认 false)

响应字段(节选):

字段类型说明
skillHubDefinitionIdint技能定义 ID
skillCodestr技能编码(全局唯一)
namestr技能名称(已 i18n 解析)
displayNamestr展示名称
descriptionstr技能描述
tagslist[str]标签列表
sourceTypestr来源类型:BUILTIN / CUSTOM
globalAccessbool是否全局可访问
executeModestr执行模式
inputConfigstr入参配置原文
inputConfigFormattedlist[dict]结构化入参 schema 数组
detailLogicstr技能详细逻辑
skillMdSummarystrSKILL.md 简介
versionNumberstr版本号
versionCountint版本总数
statusstr技能状态:ACTIVE / DRAFT
hasDraftChangesbool是否存在未发布的草稿修改
createdTimestr创建时间 ISO8601
updatedTimestr修改时间 ISO8601
argumentslist[ArgumentSchema]精简参数 schema,描述 runSkill.arguments 需要传什么
skillFileslist[dict]技能文件嵌套树(仅 includeSkillFiles=True)
bash
curl -X POST "https://<gateway-domain>/openapi/getSkill" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"skillCode":"skill-abc","viewMode":"published"}'

runSkill · 异步执行技能 ​

提交技能异步执行,返回 runId,后续用 getSkillRun 轮询结果。

POST /openapi/runSkill

请求字段:

字段类型必填说明
skillCodestr❌技能编码(全局唯一),优先级高于 skillName
skillNamestr❌技能名称,未传 skillCode 时使用;租户范围内必须唯一
argumentsdict[str, Any]❌技能入参字典;schema 由 getSkill 的 arguments 字段描述
clientTokenstr❌幂等 token,调用方自行生成(当前版本仅记录到 metadata)

响应字段:

字段类型说明
runIdstr异步任务 ID,用于 getSkillRun 查询
skillCodestr实际执行的技能编码
skillNamestr技能名称
statusstr任务状态:提交即返回 Running
createdAtstr任务创建时间,ISO8601 UTC 格式
bash
curl -X POST "https://<gateway-domain>/openapi/runSkill" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"skillName":"客户摘要","arguments":{"customer_id":"C-2026-0612"}}'

getSkillRun · 查询技能异步执行结果 ​

OpenAPI 异步技能执行结果查询入口。

POST /openapi/getSkillRun

请求字段:

字段类型必填说明
runIdstr❌runSkill 返回的异步任务 ID
includeLogsbool❌是否附带执行日志(默认 false)

响应字段:

字段类型说明
runIdstr异步任务 ID
skillCodestr技能编码
skillNamestr技能名称
statusstr执行状态:Running / Succeeded / Failed / Cancelled
progressint进度百分比(仅 Running 时有意义)
progressMessagestr进度描述
resultdict[str, Any]执行结果,仅 Succeeded 时返回;包含 content 列表
usagedict[str, Any]LLM token 使用统计,仅 Succeeded 时返回
logslist[dict[str, Any]]执行日志列表(仅 includeLogs=true 时返回)
errorCodestr错误码,仅 Failed 时返回
errorMessagestr错误描述,仅 Failed 时返回
createdAtstr任务创建时间 ISO8601
startedAtstr任务开始执行时间 ISO8601
finishedAtstr任务结束时间 ISO8601;仅终态有值
bash
curl -X POST "https://<gateway-domain>/openapi/getSkillRun" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"runId":"run_123","includeLogs":false}'

我的资源 ​

createPersonalFile · 上传文件到我的资源 ​

上传文件到当前数字员工的"我的资源"。

POST /openapi/createPersonalFile

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
filePathstr✅文件 OSS 持久化地址
filePublicUrlstr❌文件公开访问 URL(带签名)
fileNamestr❌原始文件名(含后缀)
fileExtstr❌文件后缀名(如 pdf、docx)
fileRecordIdstr❌文件记录 ID
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalFile" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"合同.pdf","filePath":"oss://bucket/path/to/file.pdf"}'

createPersonalText · 上传纯文本到我的资源 ​

上传纯文本到当前数字员工的"我的资源"。

POST /openapi/createPersonalText

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
textContentstr✅纯文本正文
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态(初始多为 PENDING;失败则为 FAILED)
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalText" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"备忘","textContent":"这是一段小记正文"}'

createPersonalVoiceMeeting · 上传离线会议到我的资源 ​

上传离线会议音频到当前数字员工的"我的资源"。

POST /openapi/createPersonalVoiceMeeting

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
fileUrlstr✅离线会议音频文件 URL
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态(初始多为 PENDING;失败则为 FAILED)
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalVoiceMeeting" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"客户拜访录音","fileUrl":"https://oss.example.com/a.mp3"}'

createPersonalDingtalkMeeting · 上传钉钉会议到我的资源 ​

上传钉钉会议到当前数字员工的"我的资源"。

POST /openapi/createPersonalDingtalkMeeting

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
roomCodestr✅钉钉会议号
credentialIdstr❌凭证 ID(不传则使用系统默认配置)
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述
notesstr❌会议笔记内容,会参与辅助分析

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalDingtalkMeeting" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"客户会议","roomCode":"1234567890"}'

createPersonalAliDingMeeting · 上传阿里钉会议到我的资源 ​

上传阿里钉会议到当前数字员工的"我的资源"。

POST /openapi/createPersonalAliDingMeeting

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
ossUrlstr✅公开的音视频 OSS 地址
shanjiUrlstr✅原始的闪记链接
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述
notesstr❌会议笔记内容,会参与辅助分析

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalAliDingMeeting" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"周会","ossUrl":"https://oss.example.com/a.mp4","shanjiUrl":"https://shanji.example.com/x"}'

createPersonalAliDingDoc · 上传阿里钉在线文档到我的资源 ​

上传阿里钉在线文档到当前数字员工的"我的资源"。

POST /openapi/createPersonalAliDingDoc

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称(建议传入钉钉文档标题)
filePublicUrlstr✅阿里钉在线文档的可公开访问 URL
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态(初始多为 PENDING;on_create 失败则为 FAILED)
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID(缺省走默认根目录时为 null)
filePublicUrlstr文档公开 URL(echo 回入参)
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalAliDingDoc" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"产品方案","filePublicUrl":"https://doc.example.com/x"}'

createPersonalAliDingKnowledgeBase · 创建阿里钉整体知识库到我的资源 ​

创建阿里钉整体知识库到当前数字员工的"我的资源"。

POST /openapi/createPersonalAliDingKnowledgeBase

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
kbUrlstr✅阿里钉知识库的可公开访问 URL
kbNamestr❌知识库显示名称;不传时由后台从远程根节点名称回填
directoryIdstr❌目标目录 ID
objectBindingslist[ObjectBinding]❌多值对象绑定列表;写入知识库 metadata,同步时透传给子节点 source
syncConfigSyncConfig❌定时同步配置;不传时按禁用处理

响应字段:

字段类型说明
directoryIdstr新建知识库根目录 ID
namestr知识库显示名称
statusstr根目录状态(创建后 RUNNING;同步完成转 READY 或 FAILED)
kbUrlstr知识库 URL(echo 回入参)
operatingObjectNamestr所属数字员工名称(echo 回入参)
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalAliDingKnowledgeBase" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","kbUrl":"https://kb.example.com/x"}'

createPersonalFeishuMinute · 上传飞书妙记会议到我的资源 ​

上传飞书妙记会议到当前数字员工的"我的资源"。

POST /openapi/createPersonalFeishuMinute

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅资源显示名称
minuteTokenstr✅飞书妙记 token(妙记唯一标识符)
credentialIdstr✅凭证 ID(关联 rbj_credential 表)
directoryIdstr❌目标目录 ID
descriptionstr❌资源描述

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态
scopestr资源 scope,固定为 PERSONAL
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalFeishuMinute" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"周会纪要","minuteToken":"minute_xxx","credentialId":"cred_1"}'

createPersonalDirectory · 在我的资源下创建个人目录 ​

在"我的资源"下创建个人目录(分类)。

POST /openapi/createPersonalDirectory

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
namestr✅目录名称
parentDirectoryIdstr❌父目录 ID
descriptionstr❌目录描述

响应字段:

字段类型说明
directoryIdstr新建目录 ID
namestr目录名称
pathstr目录完整路径(自动计算)
descriptionstr目录描述
parentDirectoryIdstr父目录 ID(回填默认根目录时返回回填后的 ID)
operatingObjectNamestr所属数字员工名称
directoryKindstr目录 KB 归属类型:normal / aliding_kb_root / aliding_kb_internal
gmtCreateint创建时间戳(毫秒)
gmtModifiedint修改时间戳(毫秒)
bash
curl -X POST "https://<gateway-domain>/openapi/createPersonalDirectory" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","name":"合同模板"}'

listPersonalDirectoryContents · 下钻查询我的资源目录内容 ​

下钻查询"我的资源"目录下的子目录与资源。

POST /openapi/listPersonalDirectoryContents

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
directoryIdstr✅目录 ID
pageint❌页码(默认 1)
pageSizeint❌每页数量,1-100(默认 20)
sortFieldstr❌排序字段:name / gmt_create / gmt_modified(默认 name)
sortOrderstr❌排序方向:asc / desc(默认 asc)
sourceTypeslist[str]❌资源类型筛选

响应字段:

字段类型说明
itemslist[PersonalDirectoryContentItem]目录下内容(子目录 + 资源)统一分页列表
totalint总数(不分页前的命中行数)
pageint当前页码
pageSizeint每页数量
bash
curl -X POST "https://<gateway-domain>/openapi/listPersonalDirectoryContents" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","directoryId":"dir_1"}'

getSource · 获取数据源详情 ​

OpenAPI 数据源详情查询。

POST /openapi/getSource

请求字段:

字段类型必填说明
sourceIdstr❌数据源 ID(租户内唯一)
includeDetailsbool❌是否返回详情(默认 false)

响应字段:

字段类型说明
sourceIdstr数据源 ID
sourceTypestr数据源类型
sourceKindstr数据源归属类型:normal / aliding_kb_doc
namestr数据源名称
descriptionstr数据源描述
statusstr数据源状态
scopestr可见范围:PERSONAL / TENANT
objectTypestr主对象类型(兼容字段)
objectIdstr主对象 ID(兼容字段)
operatingObjectNamestr运营对象名称
objectBindingslist[ObjectBindingItem]多值对象绑定列表
skillOutputIdstr技能产出 ID
sourceTagsstr资源标签 JSON 字符串
hasSettingsbool是否存在 settings 配置
hasNotesbool是否存在备注
hasStructuredTablesbool是否存在结构化表
hasUnstructuredDocsbool是否存在非结构化文档
gmtCreatestr创建时间 ISO8601
gmtModifiedstr修改时间 ISO8601
settingsdict数据源配置(仅 includeDetails=True)
notesstr备注(仅 includeDetails=True)
structuredTableslist[str]结构化表名列表(仅 includeDetails=True)
unstructuredDocslist[UnstructuredDocItem]非结构化文档明细(仅 includeDetails=True;不含 content)
bash
curl -X POST "https://<gateway-domain>/openapi/getSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","includeDetails":true}'

getSourceUploadSignature · 获取数据源文件 OSS 直传签名 URL ​

获取数据源文件 OSS 直传签名 URL,用于大文件直传。

POST /openapi/getSourceUploadSignature

请求字段:

字段类型必填说明
filenamestr✅文件名(含后缀,如 report.pdf)
operatingObjectNamestr❌Agent 命名空间标识(数字员工名称)
expiresint❌签名 URL 过期时间(秒),默认 3600
contentTypestr❌文件 Content-Type(不传则自动推断)
scopestr❌归属范围:source(个人,映射 PERSONAL)/ knowledge(企业知识库,映射 TENANT)

响应字段:

字段类型说明
objectNamestrOSS 对象名
fileUrlstr文件 OSS 内部 URL
filePublicUrlstr文件公开访问 URL
uploadSignatureUrlstr签名上传 URL(PUT 方式)
fileRecordIdstr文件记录 ID
methodstr上传 HTTP 方法(固定为 PUT)
expiresInint签名 URL 有效时长(秒)
contentTypestr文件 Content-Type
bash
curl -X POST "https://<gateway-domain>/openapi/getSourceUploadSignature" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"filename":"report.pdf","scope":"source"}'

moveResource · 在个人目录间移动资源 ​

在个人目录间移动资源。

POST /openapi/moveResource

请求字段:

字段类型必填说明
sourceDirectoryIdstr✅源目录 ID(资源当前所在的个人目录)
targetDirectoryIdstr✅目标目录 ID(资源即将移动到的个人目录)
sourceIdstr✅待移动的资源 ID

响应字段:

字段类型说明
successbool是否移动成功
sourceIdstr资源 ID(echo 回入参)
sourceDirectoryIdstr源目录 ID(echo 回入参)
targetDirectoryIdstr目标目录 ID(echo 回入参)
bash
curl -X POST "https://<gateway-domain>/openapi/moveResource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceDirectoryId":"dir_1","targetDirectoryId":"dir_2","sourceId":"src_1"}'

renameSource · 重命名数据源 ​

重命名数据源(轻量级操作)。

POST /openapi/renameSource

请求字段:

字段类型必填说明
sourceIdstr✅数据源 ID(租户内唯一)
newNamestr✅新的数据源名称

响应字段:

字段类型说明
sourceIdstr数据源 ID
namestr重命名后的数据源名称
statusstr数据源状态
gmtModifiedstr最近修改时间,ISO8601 格式
bash
curl -X POST "https://<gateway-domain>/openapi/renameSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","newName":"客户合同-最终版"}'

updateDirectory · 更新个人目录 ​

更新个人目录基础信息。

POST /openapi/updateDirectory

请求字段:

字段类型必填说明
directoryIdstr✅目录唯一标识(业务 ID,非主键 ID)
namestr❌新目录名称;缺省表示不更新
descriptionstr❌新目录描述;缺省表示不更新
parentIdint❌新父目录主键 ID;缺省表示不更新父目录
pathstr❌新目录路径;传入时会级联更新当前目录及全部子目录的 path

响应字段:

字段类型说明
successbool是否更新成功
directoryIdstr目录唯一标识(echo 回入参)
bash
curl -X POST "https://<gateway-domain>/openapi/updateDirectory" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"directoryId":"dir_1234567890","name":"客户资料"}'

retryDirectoryFailedSources · 重试个人目录下失败数据源 ​

获取个人目录下失败的数据源并批量重试(递归包含子目录)。

POST /openapi/retryDirectoryFailedSources

请求字段:

字段类型必填说明
directoryIdstr✅目录 ID(递归包含子目录下的失败资源)

响应字段:

字段类型说明
directoryIdstr目录 ID
failedCountint目录下失败资源总数
enqueuedCountint成功入队重试的数量
skippedCountint跳过(非 FAILED 或无权限)的数量
enqueuedIdslist[str]成功入队的 source_id 列表
failedSourceslist[FailedSourceItem]目录下检测到的失败数据源列表
bash
curl -X POST "https://<gateway-domain>/openapi/retryDirectoryFailedSources" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"directoryId":"dir_1234567890"}'

previewPersonalSource · 预览个人知识库知识 ​

预览个人知识库下指定知识的内容(仅允许预览本人资源,PERSONAL 类型目录)。

POST /openapi/previewPersonalSource

请求字段:

字段类型必填说明
sourceIdstr✅知识 ID(数据源唯一标识)

响应字段:

字段类型说明
previewTypestr预览类型:OSS_IMM / IMAGE / AUDIO / VIDEO / HTML / DING_TALK / VOICE_MEETING / CONTENT
previewUrlstr预览 URL(OSS_IMM、DING_TALK、VOICE_MEETING 使用)
contentstr文本内容(CONTENT 类型使用)
fileNamestr文件名(OSS_IMM 类型使用)
fileExtstr文件扩展名(OSS_IMM 类型使用)
publicUrlstr公开下载 URL
bash
curl -X POST "https://<gateway-domain>/openapi/previewPersonalSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_123"}'

listOutputFiles · 查询当前用户产出列表 ​

查询当前用户的产出列表。

POST /openapi/listOutputFiles

请求:无请求体参数。

响应字段:

字段类型说明
itemslist[ListOutputFilesRecord]产出列表
totalint符合条件的产出总数
pageint当前页码
pageSizeint每页数量
bash
curl -X POST "https://<gateway-domain>/openapi/listOutputFiles" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

saveOutputFileToResource · 将产出批量保存为个人资源 ​

将产出明细批量保存为个人资源(链接引用或拷贝)。

POST /openapi/saveOutputFileToResource

请求字段:

字段类型必填说明
itemIdslist[str]❌产出明细 ID 列表,单批最多 50 条
modeLiteral["link","copy"]❌保存方式:link-链接引用,copy-拷贝入库
directoryIdstr❌目标个人目录 ID

响应字段:

字段类型说明
resultslist[SaveOutputFileToResourceItem]逐条结果,与入参 itemIds 同序;单条失败不影响其他
bash
curl -X POST "https://<gateway-domain>/openapi/saveOutputFileToResource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"itemIds":["item_1"],"mode":"link","directoryId":"dir_1"}'

企业知识库 ​

listVisibleKnowledgeBases · 查询数字员工可见知识库列表 ​

查询数字员工可见的企业知识库顶层目录。

POST /openapi/listVisibleKnowledgeBases

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)

响应字段:

字段类型说明
itemslist[VisibleKnowledgeBaseItem]数字员工可见的企业知识库顶层目录列表
totalint返回条数(不分页)
bash
curl -X POST "https://<gateway-domain>/openapi/listVisibleKnowledgeBases" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent"}'

listVisibleKnowledgeBaseContents · 下钻查询可见知识库目录内容 ​

下钻查询数字员工可见知识库目录下的子目录与资源。

POST /openapi/listVisibleKnowledgeBaseContents

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称(运营对象 name)
directoryIdstr✅目录 ID(必传非空,需在数字员工 linked_directories 及子目录范围内)
pageint❌页码(默认 1)
pageSizeint❌每页数量,1-100(默认 20)
sortFieldstr❌排序字段:name / gmt_create / gmt_modified(默认 name)
sortOrderstr❌排序方向:asc / desc(默认 asc)
sourceTypeslist[str]❌资源类型筛选(有值时仅返回资源)

响应字段:

字段类型说明
itemslist[VisibleKnowledgeBaseContentItem]目录下内容统一分页列表
totalint总数(不分页前的命中行数)
pageint当前页码
pageSizeint每页数量
bash
curl -X POST "https://<gateway-domain>/openapi/listVisibleKnowledgeBaseContents" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"my-agent","directoryId":"dir_1"}'

listAdminKnowledgeBases · 后台查询/下钻企业知识库 ​

后台企业知识库列表 / 下钻查询。

POST /openapi/listAdminKnowledgeBases

请求字段:

字段类型必填说明
directoryIdstr❌目录 ID(下钻时传入)
pageint❌页码(默认 1)
pageSizeint❌每页数量,1-100(默认 20)
sortFieldstr❌排序字段:name / gmtCreate / gmtModified(默认 name)
sortOrderstr❌排序方向:asc / desc(默认 asc)
keywordstr❌搜索关键词,仅 directoryId 为空/root 时生效
sourceTypeslist[str]❌资源类型过滤,仅下钻时生效

响应字段:

字段类型说明
itemslist[AdminKnowledgeBaseItem]内容列表(KB 列表仅 directory;下钻含 directory + resource)
totalint符合条件的总数
pageint当前页码
pageSizeint每页数量
bash
curl -X POST "https://<gateway-domain>/openapi/listAdminKnowledgeBases" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"pageSize":20,"sortField":"name","sortOrder":"asc"}'

submitSourceToKnowledgeBase · 将个人资源提交到企业知识库 ​

将个人资源提交到企业知识库(租户目录)。

POST /openapi/submitSourceToKnowledgeBase

请求字段:

字段类型必填说明
sourceIdstr✅要提交的个人资源ID(必须 scope=PERSONAL 且当前用户为 creator)
targetDirectoryIdstr✅目标企业知识库目录ID(必须为 TENANT 类型目录)

响应字段:

字段类型说明
sourceIdstr资源ID(迁移后保持不变)
scopestr提交后资源 scope,成功路径下固定为 TENANT
targetDirectoryIdstr资源当前绑定的目标企业知识库目录ID
bash
curl -X POST "https://<gateway-domain>/openapi/submitSourceToKnowledgeBase" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","targetDirectoryId":"dir_1234567890"}'

createKnowledgeBaseFile · 上传文件到企业知识库 ​

上传文件到企业知识库(需要知识库管理权限)。

POST /openapi/createKnowledgeBaseFile

请求字段:

字段类型必填说明
operatingObjectNamestr❌数字员工名称(运营对象 name)
namestr✅资源显示名称
filePathstr✅文件 OSS 持久化地址
filePublicUrlstr❌文件公开访问 URL(带签名)
fileNamestr❌原始文件名(含后缀)
fileExtstr❌文件后缀名(如 pdf、docx)
fileRecordIdstr❌文件记录 ID
directoryIdstr❌目标分类 ID
descriptionstr❌资源描述
knowledgeIdstr❌知识库 ID
sourceTagsstr❌资源标签(JSON 字符串列表)

响应字段:

字段类型说明
sourceIdstr新建资源 ID
namestr资源显示名称
statusstr资源状态
scopestr资源 scope,固定为 TENANT
directoryIdstr绑定的目录 ID
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/createKnowledgeBaseFile" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"合同模板.pdf","filePath":"oss://bucket/path/to/file.pdf","directoryId":"dir_1"}'

createKnowledgeBaseText · 上传纯文本到企业知识库 ​

上传纯文本到企业知识库(需要知识库管理权限)。

POST /openapi/createKnowledgeBaseText

请求字段:

字段类型必填说明
operatingObjectNamestr❌数字员工名称
namestr✅资源显示名称
textContentstr✅纯文本正文
directoryIdstr❌目标分类 ID
descriptionstr❌资源描述
knowledgeIdstr❌知识库 ID
sourceTagsstr❌资源标签(JSON 字符串列表)

响应字段:sourceId / name / status / scope(TENANT) / directoryId / gmtCreate(同 createKnowledgeBaseFile)。

bash
curl -X POST "https://<gateway-domain>/openapi/createKnowledgeBaseText" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"客户服务规范","textContent":"一、服务原则...","directoryId":"dir_1"}'

createKnowledgeBaseAliDingDoc · 上传阿里钉在线文档到企业知识库 ​

上传阿里钉在线文档到企业知识库(需要知识库管理权限)。

POST /openapi/createKnowledgeBaseAliDingDoc

请求字段:

字段类型必填说明
operatingObjectNamestr❌数字员工名称
namestr✅资源显示名称(建议传入钉钉文档标题)
filePublicUrlstr✅阿里钉在线文档的可公开访问 URL
directoryIdstr❌目标分类 ID
descriptionstr❌资源描述
knowledgeIdstr❌知识库 ID
sourceTagsstr❌资源标签(JSON 字符串列表)

响应字段:sourceId / name / status / scope(TENANT) / directoryId / filePublicUrl / gmtCreate。

bash
curl -X POST "https://<gateway-domain>/openapi/createKnowledgeBaseAliDingDoc" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"产品需求文档","filePublicUrl":"https://alidocs.dingtalk.com/i/xxx","directoryId":"dir_1"}'

createKnowledgeBaseDirectory · 创建企业知识库分类 ​

创建企业知识库分类(租户目录,需要知识库管理权限)。

POST /openapi/createKnowledgeBaseDirectory

请求字段:

字段类型必填说明
namestr✅分类名称(企业知识库目录名称)
parentDirectoryIdstr❌父分类 ID;不传挂在租户根目录下
descriptionstr❌分类描述

响应字段:

字段类型说明
directoryIdstr新建分类 ID
namestr分类名称
pathstr分类完整路径(自动计算)
descriptionstr分类描述
parentDirectoryIdstr父分类 ID;挂在根目录时返回 null
directoryKindstr目录 KB 归属类型:normal / aliding_kb_root / aliding_kb_internal
gmtCreateint创建时间戳(毫秒)
gmtModifiedint修改时间戳(毫秒)
bash
curl -X POST "https://<gateway-domain>/openapi/createKnowledgeBaseDirectory" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"合同模板","description":"各类标准合同"}'

getKnowledgeBaseSource · 获取企业知识库知识详情 ​

获取企业知识库下指定知识的详情(需要知识库查看权限)。

POST /openapi/getKnowledgeBaseSource

请求字段:

字段类型必填说明
sourceIdstr❌知识 ID(数据源唯一标识)

响应字段:

字段类型说明
sourceIdstr知识 ID
sourceTypestr知识类型(TEXT / FILE / ONLINE_DOC 等)
namestr知识名称
descriptionstr知识描述
statusstr处理状态(READY / RUNNING / FAILED 等)
statusMessagestr状态附加信息(如失败原因)
sourceKindstr知识 KB 归属类型:aliding_kb_doc / normal
sourceTagsstr知识标签(JSON 字符串列表)
directoryIdstr所属分类 ID
directoryPathstr所属分类完整路径
gmtCreateint创建时间戳(毫秒)
gmtModifiedint修改时间戳(毫秒)
bash
curl -X POST "https://<gateway-domain>/openapi/getKnowledgeBaseSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890"}'

listKnowledgeBaseDirectories · 获取企业知识库分类列表 ​

获取企业知识库分类列表(子目录树,需要知识库查看权限)。

POST /openapi/listKnowledgeBaseDirectories

请求字段:

字段类型必填说明
directoryIdstr❌父分类 ID;不传时返回根目录下所有分类树
sortFieldstr❌排序字段:name / gmt_create / gmt_modified(默认 gmt_create)
sortOrderstr❌排序方向:asc / desc(默认 desc)

响应字段:

字段类型说明
directorieslist[dict[str, Any]]分类树(嵌套,含 directoryId/name/description/path/directoryKind/gmtCreate/gmtModified/children)
totalCountint分类总数
bash
curl -X POST "https://<gateway-domain>/openapi/listKnowledgeBaseDirectories" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sortField":"gmt_create","sortOrder":"desc"}'

updateKnowledgeBaseDirectory · 修改企业知识库分类 ​

修改企业知识库分类(租户目录,需要知识库管理权限)。

POST /openapi/updateKnowledgeBaseDirectory

请求字段:

字段类型必填说明
directoryIdstr✅待修改的分类 ID
namestr❌新分类名称;不传不更新
descriptionstr❌新分类描述;不传不更新
parentDirectoryIdstr❌新父分类 ID;不传不移动,传入需为当前租户已存在的知识库目录

响应字段:

字段类型说明
successbool是否更新成功
directoryIdstr分类 ID(echo 回入参)
bash
curl -X POST "https://<gateway-domain>/openapi/updateKnowledgeBaseDirectory" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"directoryId":"dir_1234567890","name":"标准合同模板"}'

moveKnowledgeBaseResource · 在企业知识库目录间移动资源 ​

在企业知识库目录间移动资源(需要知识库管理权限)。

POST /openapi/moveKnowledgeBaseResource

请求字段:

字段类型必填说明
sourceDirectoryIdstr✅源目录 ID
targetDirectoryIdstr✅目标目录 ID
sourceIdstr✅待移动的资源 ID
knowledgeIdstr✅目标知识库 ID

响应字段:sourceId / sourceDirectoryId / targetDirectoryId / knowledgeId(均 echo 回入参)。

bash
curl -X POST "https://<gateway-domain>/openapi/moveKnowledgeBaseResource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceDirectoryId":"dir_1","targetDirectoryId":"dir_2","sourceId":"src_1","knowledgeId":"kb_1"}'

renameKnowledgeBaseSource · 重命名企业知识库数据源 ​

重命名企业知识库中的数据源(需要知识库管理权限)。

POST /openapi/renameKnowledgeBaseSource

请求字段:

字段类型必填说明
sourceIdstr✅数据源 ID(租户内唯一)
newNamestr✅新的数据源名称

响应字段:sourceId / name / status / gmtModified(同 renameSource)。

bash
curl -X POST "https://<gateway-domain>/openapi/renameKnowledgeBaseSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","newName":"公司制度-2026"}'

updateKnowledgeBaseSourceTags · 更新企业知识库数据源标签 ​

更新企业知识库数据源的资源标签(需要知识库管理权限)。

POST /openapi/updateKnowledgeBaseSourceTags

请求字段:

字段类型必填说明
sourceIdstr✅数据源 ID(租户内唯一)
sourceTagsstr❌资源标签(JSON 字符串列表)

响应字段:

字段类型说明
sourceIdstr数据源 ID
sourceTagsstr更新后的资源标签
gmtModifiedstr最近修改时间,ISO8601 格式
bash
curl -X POST "https://<gateway-domain>/openapi/updateKnowledgeBaseSourceTags" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","sourceTags":"[\"合同\",\"2026\"]"}'

retryKnowledgeBaseFailedSources · 重试企业知识库目录下失败数据源 ​

获取企业知识库目录下失败的数据源并批量重试(递归包含子目录)。

POST /openapi/retryKnowledgeBaseFailedSources

请求字段:

字段类型必填说明
directoryIdstr✅企业知识库目录 ID(递归包含子目录)

响应字段:directoryId / failedCount / enqueuedCount / skippedCount / enqueuedIds / failedSources(同 retryDirectoryFailedSources,failedSources 为 list[KbFailedSourceItem])。

bash
curl -X POST "https://<gateway-domain>/openapi/retryKnowledgeBaseFailedSources" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"directoryId":"dir_1234567890"}'

previewKnowledgeBaseSource · 预览企业知识库知识 ​

预览企业知识库下指定知识的内容(需要 DEVELOPMENT_KB_VIEW 知识库查看权限,TENANT 类型目录)。

POST /openapi/previewKnowledgeBaseSource

请求字段:

字段类型必填说明
sourceIdstr✅知识 ID(数据源唯一标识)

响应字段:previewType / previewUrl / content / fileName / fileExt / publicUrl(同 previewPersonalSource)。

bash
curl -X POST "https://<gateway-domain>/openapi/previewKnowledgeBaseSource" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_123"}'

定时任务 ​

createScheduledTask · 创建定时任务 ​

创建定时任务。

POST /openapi/createScheduledTask

请求字段:

字段类型必填说明
namestr✅任务名称(最多 50 字)
descriptionlist[SegmentItem]❌任务描述(segments 格式),支持 text/web_search/mention/skill 类型
digitalEmployeeNamestr❌数字员工名称
triggerConfigTriggerConfigRequest❌触发配置,含触发模式、Cron 表达式等;timezone/language 由服务端自动注入
taskDetailTaskDetailRequest❌任务详情(理解结果回传),含任务理解、相关语义、相关对象、相关技能
isOpenbool❌是否公开访问(默认 true)
segmentslist[SegmentItem]❌富文本消息片段,支持 @对象(type=mention)和 /技能(type=skill)

响应字段:

字段类型说明
taskIdstr新建任务 ID
bash
curl -X POST "https://<gateway-domain>/openapi/createScheduledTask" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"每日销售报告","digitalEmployeeName":"销售助手"}'

updateScheduledTask · 更新定时任务 ​

更新已有定时任务定义。

POST /openapi/updateScheduledTask

请求字段:

字段类型必填说明
taskIdstr✅任务 ID
namestr❌任务名称(最多50字)
descriptionlist[SegmentItem]❌任务描述(segments 格式),支持 text/web_search/mention/skill
digitalEmployeeNamestr❌数字员工名称
triggerConfigTriggerConfigRequest❌触发配置(触发模式、Cron 等);timezone/language 服务端自动注入
taskDetailTaskDetailRequest❌任务详情(理解结果回传)
isOpenbool❌是否公开访问
segmentslist[SegmentItem]❌富文本消息片段,支持 @对象与 /技能

响应字段:

字段类型说明
taskIdstr任务 ID(回显)
updatedbool是否实际产生更新
bash
curl -X POST "https://<gateway-domain>/openapi/updateScheduledTask" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"taskId":"12345","name":"每日销售日报","isOpen":false}'

listScheduledTasks · 获取定时任务列表 ​

获取当前用户的定时任务列表。

POST /openapi/listScheduledTasks

请求字段:

字段类型必填说明
pageint❌页码(默认 1)
pageSizeint❌每页条数(1~100,默认 20)
keywordstr❌任务名模糊搜索
digitalEmployeeNamestr❌按数字员工名称过滤

响应字段:

字段类型说明
itemslist[ScheduledTaskItem]任务列表
totalint满足条件的总数
pageint当前页码
pageSizeint每页条数
hasMorebool是否有更多数据
bash
curl -X POST "https://<gateway-domain>/openapi/listScheduledTasks" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"pageSize":20}'

executeScheduledTask · 立即执行定时任务 ​

立即执行指定的定时任务,创建手动触发的执行记录,并返回可透传给 Chat 链路的任务执行元数据。

POST /openapi/executeScheduledTask

请求字段:

字段类型必填说明
taskIdstr✅任务 ID

响应字段:

字段类型说明
executionIdstr执行记录 ID
taskExecutionScheduledTaskExecutionPayload可透传给 Chat metadata.task_execution 的执行元数据

taskExecution(ScheduledTaskExecutionPayload)结构:

字段类型说明
taskIdstr任务 ID
executionIdstr执行记录 ID
taskUnderstandstr任务理解内容
operatingObjectNamestr数字员工名称
skillCodesarray<str>关联技能编码列表
enableWebSearchboolean是否启用联网搜索
billingIdstr计费 ID,供 Chat 回调结束计费
tenantIdstr任务所属租户 ID
userIdstr任务所属用户 ID
taskNamestr任务名称
modelstr执行模型档位:model_max(旗舰)/model_plus(标准)/model_flash(轻量)
bash
curl -X POST "https://<gateway-domain>/openapi/executeScheduledTask" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"taskId":"task_123"}'

getScheduledTaskExecutionDetail · 获取定时任务执行详情 ​

获取单条执行记录的完整详情。

POST /openapi/getScheduledTaskExecutionDetail

请求字段:

字段类型必填说明
executionIdstr✅执行记录 ID

响应字段:

字段类型说明
executionIdstr执行 ID
taskIdstr任务 ID
triggerTypestr触发类型
digitalEmployeeNamestr数字员工名称
triggerInfodict[str, Any]触发信息
statusstr执行状态
skillCodeslist[str]关联技能编码列表
titlestr执行结果标题
contentstr执行完整内容
outputContentstr结构化输出内容
errorMessagestr错误信息
metadatadict[str, Any]元数据
fileslist[dict[str, Any]]产出文件列表
startedAtstr开始时间 ISO8601
completedAtstr完成时间 ISO8601
creatorstr创建人
gmtCreatestr创建时间 ISO8601
bash
curl -X POST "https://<gateway-domain>/openapi/getScheduledTaskExecutionDetail" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"executionId":"exec_456"}'

getScheduledTaskExecutionRecords · 获取定时任务执行记录 ​

按操作对象聚合查询所有任务的执行记录时间线。

POST /openapi/getScheduledTaskExecutionRecords

请求字段:

字段类型必填说明
digitalEmployeeNamestr✅数字员工名称

响应字段:

字段类型说明
taskslist[ScheduledTaskTimeline]所有定时任务的时间线
bash
curl -X POST "https://<gateway-domain>/openapi/getScheduledTaskExecutionRecords" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"digitalEmployeeName":"销售助手"}'

getScheduledTaskPushOptions · 获取定时任务推送配置选项 ​

查询当前用户可用于定时任务推送的渠道与推送方式。

POST /openapi/getScheduledTaskPushOptions

请求字段:

字段类型必填说明
digitalEmployeeNamestr✅数字员工名称

响应字段:

字段类型说明
channelsarray<ScheduledTaskPushChannelOption>推送渠道列表
emptyHintstr无已绑定三方账号时的提示

channels[](ScheduledTaskPushChannelOption)结构:

字段类型说明
channelTypestr渠道枚举值
channelNamestr渠道展示名
methodsarray<ScheduledTaskPushMethodOption>推送方式列表

methods[](ScheduledTaskPushMethodOption)结构:

字段类型说明
methodstr推送方式:channel_bot/direct
namestr推送方式展示名
enabledboolean是否可选
disabledReasonstr置灰原因
bash
curl -X POST "https://<gateway-domain>/openapi/getScheduledTaskPushOptions" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"digitalEmployeeName":"销售助手"}'

getScheduledTaskUnderstandDetail · 获取定时任务理解详情 ​

通过 LLM 理解用户自然语言输入,提取语义实体、相关对象和相关技能。

POST /openapi/getScheduledTaskUnderstandDetail

请求字段:

字段类型必填说明
userInputstr✅自然语言任务描述
digitalEmployeeNamestr❌数字员工名称,用于过滤可用技能
segmentslist[SegmentItem]❌富文本消息片段,支持 @对象(type=mention)和 /技能(type=skill)

响应字段:

字段类型说明
taskUnderstandstr润色后的任务理解
relatedSemanticslist[SemanticEntityOpen]相关语义实体列表
relatedObjectslist[RelatedObjectOpen]相关对象列表
relatedSkillslist[RelatedSkillOpen]相关技能列表
bash
curl -X POST "https://<gateway-domain>/openapi/getScheduledTaskUnderstandDetail" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"userInput":"每天早上汇总昨日销售数据"}'

主对象数据 ​

queryPrimaryObjectData · 分页查询主对象数据 ​

OpenAPI 分页查询主对象数据。

POST /openapi/queryPrimaryObjectData

请求字段:

字段类型必填说明
operatingObjectNamestr✅运营对象名称(如 customer_1)
pageint❌页码(默认 1)
pageSizeint❌每页数量,1-100(默认 20)
keywordstr❌关键字搜索(匹配 name;schema 定义 description 时同时匹配)
onlyFavoritesbool❌仅返回关注的主对象(默认 false)

响应字段:

字段类型说明
totalint总数
pageint当前页码
pageSizeint每页数量
itemslist[dict[str, Any]]主对象数据列表(字段因 schema 定义而异)
bash
curl -X POST "https://<gateway-domain>/openapi/queryPrimaryObjectData" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"customer_1","page":1,"pageSize":20}'

togglePrimaryObjectFavorite · 关注/取消关注主对象 ​

批量关注或取消关注主对象。

POST /openapi/togglePrimaryObjectFavorite

请求字段:

字段类型必填说明
objectTypestr✅对象类型(如 customer、project)
operatingObjectNamestr✅运营对象名称(如 customer_1)
objectIdslist[str]✅主对象业务ID列表
actionLiteral["add","remove"]✅操作:add-关注,remove-取消关注

响应字段:

字段类型说明
resultslist[TogglePrimaryObjectFavoriteResult]每条对象的处理结果
favoriteCountint该用户的关注总数(针对该对象类型)
bash
curl -X POST "https://<gateway-domain>/openapi/togglePrimaryObjectFavorite" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"objectType":"customer","operatingObjectName":"customer_1","objectIds":["C-001"],"action":"add"}'

replaceObjectBindings · 全量替换数据源对象绑定 ​

全量替换数据源的对象绑定(先删后插,同一事务)。

POST /openapi/replaceObjectBindings

请求字段:

字段类型必填说明
sourceIdstr✅数据源 ID(租户内唯一)
objectBindingslist[ObjectBindingItem]✅新的对象绑定列表(全量替换;传空表示清空所有绑定)

响应字段:

字段类型说明
sourceIdstr数据源 ID
objectBindingslist[ObjectBindingItem]替换后的对象绑定列表
bash
curl -X POST "https://<gateway-domain>/openapi/replaceObjectBindings" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"src_1234567890","objectBindings":[]}'

用户、Credit 与账单 ​

getUserInfo · 获取当前用户信息 ​

OpenAPI 获取当前用户信息。

GET /openapi/getUserInfo

请求:无请求体参数。

响应字段:

字段类型说明
userIdint用户 ID
userCodestr用户代码
isAdminbool是否为超级管理员
tenantIdint当前租户 ID
tenantNamestr当前租户名称
tenantTypeTenantType当前租户类型
crmTypestr当前租户 CRM 类型
tenantListlist[TenantInfo]用户所属租户列表
namestr用户名称
avatarstr用户头像 URL
languagePreferencestr用户语言偏好
profileRolestr用户角色
profileRoleInfostr用户角色描述(profileRole 为 Others 时)
offeringstr用户服务描述
parsedOfferingstr用户服务解析结果(JSON)
selfIntroductionstr用户自我介绍
isSystemTenantbool当前登录租户是否为系统租户(tenantId=10000)
bash
curl -X GET "https://<gateway-domain>/openapi/getUserInfo" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json"

updateUserInfo · 更新当前用户信息 ​

更新当前登录用户的基本信息。

POST /openapi/updateUserInfo

请求字段:

字段类型必填说明
namestr❌用户名称
avatarstr❌用户头像 URL
languagePreferencestr❌语言偏好:zh-CN, en-US
profileRoleInfostr❌用户角色描述(profileRole 为 Others 时使用),最多100字符
offeringstr❌用户服务描述,最多1000字符
selfIntroductionstr❌用户自我介绍,最多1000字符

响应字段:

字段类型说明
successbool是否更新成功
messagestr结果描述
userUserInfo更新后的用户信息
bash
curl -X POST "https://<gateway-domain>/openapi/updateUserInfo" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"name":"张三","languagePreference":"zh-CN"}'

getUserCreditUsage · 查询用户已消耗 Credit ​

OpenAPI 查询用户已消耗 credit(实时)。

POST /openapi/getUserCreditUsage

请求:无请求体参数。

响应字段:

字段类型说明
tenantIdint租户 ID
userIdint用户 ID
creditLimitDecimal用户 credit 限额
usedCreditsDecimal已消耗 credit(实时)
remainingCreditsDecimal剩余 credit(实时)
shadowCreditLimitDecimal影子 credit 限额
shadowUsedCreditsDecimal已消耗影子 credit(实时)
shadowRemainingCreditsDecimal剩余影子 credit(实时)
bash
curl -X POST "https://<gateway-domain>/openapi/getUserCreditUsage" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

listBilling · 查询账单列表 ​

OpenAPI 查询账单列表。

POST /openapi/listBilling

请求字段:

字段类型必填说明
userIdint❌用户 ID(可选筛选)
operationstr❌操作类型(可选筛选)
statusstr❌状态(可选筛选)
startTimedatetime❌开始时间范围
endTimedatetime❌结束时间范围
bizTypestr❌业务来源类型(可选筛选)
bizIdstr❌业务来源 ID(可选筛选)
ignoreZerobool❌是否过滤 credit 消耗为 0 的账单(默认 true)
pageint❌页码(默认 1)
pageSizeint❌每页条数(默认 20)

响应字段:

字段类型说明
listlist[BillingItemResponse]账单列表
totalint总数
pageint页码
pageSizeint每页条数
bash
curl -X POST "https://<gateway-domain>/openapi/listBilling" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"pageSize":20,"ignoreZero":true}'

用户与权限管理 ​

createUser · 创建用户并加入租户 ​

智能创建 WINNEXO 自建账号用户并加入当前租户(账号已存在则直接加入)。

POST /openapi/createUser

请求字段:

字段类型必填说明
accountIdstr✅WINNEXO 登录账号(唯一标识)
displayNamestr✅用户显示名称(租户内唯一)
roleCodesarray<str>❌系统角色:SUPER_ADMIN / SYSTEM_ADMIN / SEMANTIC_ADMIN / SKILL_ADMIN / KB_ADMIN / AGENT_ADMIN / APPLICATION_USER(默认 APPLICATION_USER)
passwordEncryptedstr❌RSA-OAEP-SHA256 加密后的 base64 密文;不传用系统默认密码

响应字段:

字段类型说明
userIdint平台用户ID
accountIdstrWINNEXO 登录账号
displayNamestr用户显示名称
isNewUserboolean是否为新创建用户
isDefaultPasswordboolean是否使用系统默认密码(true 时建议通知用户修改)
bash
curl -X POST "https://<gateway-domain>/openapi/createUser" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"accountId":"zhangsan","displayName":"张三","roleCodes":["APPLICATION_USER"]}'

updateUser · 修改用户信息(含启停用) ​

修改用户显示名、角色、启停用状态、用户组。除 userId 外均可选(不传不改,至少改一个);roleCodes/userGroupIds 为全量替换。

POST /openapi/updateUser

请求字段:

字段类型必填说明
userIdint✅目标用户ID
displayNamestr❌新显示名称(传则不可为空)
roleCodesarray<str>❌新角色列表(全量替换,至少一个)
isActiveboolean❌启用/停用(false=停用,true=启用)
userGroupIdsarray<str>❌新用户组ID列表(全量替换)

响应字段:userId(int, 被修改的用户ID)。HTTP 200 即表示成功。

bash
curl -X POST "https://<gateway-domain>/openapi/updateUser" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"userId":1001,"displayName":"张三丰","isActive":true}'

getUser · 查询用户详情 ​

查询用户详情,userId / accountId 任传一个(都传以 userId 为准)。

POST /openapi/getUser

请求字段:

字段类型必填说明
userIdint❌用户ID(与 accountId 二选一)
accountIdstr❌WINNEXO 登录账号(与 userId 二选一)

响应字段:

字段类型说明
userIdint用户ID
accountIdstrWINNEXO 登录账号
displayNamestr用户显示名称
isActiveboolean启用/停用状态
roleCodesarray<str>系统角色 code 列表
userGroupIdsarray<str>所属用户组ID列表
gmtCreatestr加入租户时间
lastLoginTimestr最后登录时间
bash
curl -X POST "https://<gateway-domain>/openapi/getUser" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"userId":1001}'

listUsers · 分页查询租户成员列表 ​

分页查询租户成员列表,支持状态、角色、关键词筛选。

POST /openapi/listUsers

请求字段:

字段类型必填说明
pageint❌页码(默认 1)
pageSizeint❌每页数量(最大 100,默认 20)
keywordstr❌搜索关键词(模糊匹配显示名和账号)
isActiveboolean❌启用/停用状态筛选
roleCodesarray<str>❌按角色筛选

响应字段:total(int) / page(int) / pageSize(int) / items(array<ListUsersItemResponse>)。

items[]:userId / accountId / displayName / isActive / roleCodes / gmtCreate / lastLoginTime。

bash
curl -X POST "https://<gateway-domain>/openapi/listUsers" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"pageSize":20,"keyword":"张"}'

removeUser · 从租户移除用户 ​

从当前租户移除用户(保留用户主体),同时移除其角色/用户组关联与数字员工授权,含最后超管保护。

POST /openapi/removeUser

请求字段:

字段类型必填说明
userIdint✅要移除的用户ID

响应字段:userId(int, 被移除的用户ID)。HTTP 200 即表示成功。

bash
curl -X POST "https://<gateway-domain>/openapi/removeUser" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"userId":1001}'

resetPassword · 重置用户密码 ​

管理员重置用户密码;不传 passwordEncrypted 则重置为系统默认密码。仅支持 WINNEXO 自建账号。

POST /openapi/resetPassword

请求字段:

字段类型必填说明
userIdint✅目标用户ID
passwordEncryptedstr❌RSA-OAEP-SHA256 加密后的新密码 base64 密文;不传重置为默认密码

响应字段:userId(int) / isDefaultPassword(boolean, 是否重置为系统默认密码)。

bash
curl -X POST "https://<gateway-domain>/openapi/resetPassword" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"userId":1001}'

getTokenInfo · 查询用户的 Token 状态 ​

查询用户的 INSTANCE Token 状态(仅个人 Token 可调)。userId 为空时查自身;超管/系管可代查同租户用户。

POST /openapi/getTokenInfo

请求字段(可选):

字段类型必填说明
userIdint❌目标用户 ID(空则自身,管理员可代操作)

响应字段:

字段类型说明
enabledbooleanToken 是否开启(存在 ACTIVE 状态)
tokenMaskedstr脱敏后的 Token 值
gmtCreatestrToken 创建时间(ISO 8601)
bash
curl -X POST "https://<gateway-domain>/openapi/getTokenInfo" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

enableToken · 开启 API Token ​

开启用户的 INSTANCE Token(幂等)。明文仅首次开启时返回一次。仅个人 Token 可调。

POST /openapi/enableToken

请求字段(可选):userId(int, 空则自身,管理员可代操作)。

响应字段:

字段类型说明
tokenstrToken 明文(仅本次返回,请妥善保管)
tokenMaskedstr脱敏后的 Token 值
bash
curl -X POST "https://<gateway-domain>/openapi/enableToken" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

disableToken · 关闭 API Token ​

关闭用户的 INSTANCE Token(ACTIVE → INACTIVE,幂等)。仅个人 Token 可调。

POST /openapi/disableToken

请求字段(可选):userId(int, 空则自身)。

响应字段:disabled(boolean, 操作是否成功)。

bash
curl -X POST "https://<gateway-domain>/openapi/disableToken" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

resetToken · 重置 API Token ​

重置用户的 INSTANCE Token:旧 ACTIVE Token 永久失效(RESET),生成新 ACTIVE Token。仅个人 Token 可调。

POST /openapi/resetToken

请求字段(可选):userId(int, 空则自身)。

响应字段:

字段类型说明
tokenstr新 Token 明文(仅本次返回)
tokenMaskedstr脱敏后的新 Token 值
bash
curl -X POST "https://<gateway-domain>/openapi/resetToken" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

grantAgentUsers · 授权用户/用户组使用数字员工 ​

授权用户或用户组使用指定数字员工(已存在则更新)。需 MANAGE 权限。userIds 与 userGroupIds 二选一。

POST /openapi/grantAgentUsers

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称
userIdsarray<int>❌被授权用户 ID 列表(与 userGroupIds 二选一)
userGroupIdsarray<str>❌被授权用户组 ID 列表(16 位 hex)
expireDateint❌授权截止时间戳(毫秒),不传永不过期
permissionsarray<str>❌权限:USE 和/或 MANAGE(默认仅 USE)

响应字段:grantedCount(int, 本次处理的授权记录数)。

bash
curl -X POST "https://<gateway-domain>/openapi/grantAgentUsers" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"销售助手","userIds":[1001,1002],"permissions":["USE"]}'

revokeAgentUsers · 撤销用户/用户组的数字员工使用权限 ​

撤销用户或用户组对指定数字员工的使用权限。需 MANAGE 权限。userIds 与 userGroupIds 二选一。

POST /openapi/revokeAgentUsers

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称
userIdsarray<int>❌被撤销用户 ID 列表(与 userGroupIds 二选一)
userGroupIdsarray<str>❌被撤销用户组 ID 列表

响应字段:revokedCount(int, 本次成功撤销的记录数)。

bash
curl -X POST "https://<gateway-domain>/openapi/revokeAgentUsers" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"销售助手","userIds":[1001,1002]}'

listAuthorizedAgents · 查询调用方有指定权限的数字员工名称列表 ​

查询当前调用方拥有指定权限(USE/MANAGE)的数字员工名称列表。请求体可选,默认按 USE。

POST /openapi/listAuthorizedAgents

请求字段(可选):permission(str, USE / MANAGE,默认 USE)。

响应字段:agentNames(array<str>, 有指定权限的数字员工名称列表)。

bash
curl -X POST "https://<gateway-domain>/openapi/listAuthorizedAgents" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"permission":"USE"}'

listAuthorizedUsers · 查询数字员工已授权的用户/用户组列表 ​

查询某数字员工已授权的用户/用户组列表(需 APPLICATION_AGENT_VIEW)。

POST /openapi/listAuthorizedUsers

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称
keywordstr❌搜索关键词(按用户名或组名模糊匹配)
granteeTypestr❌筛选:USER / USER_GROUP / 不传全部
permissionstr❌权限过滤:USE / MANAGE

响应字段:authMode(str, SPECIFIED_USERS / ALL_USERS) / total(int) / items(array<AuthorizedUserItem>)。

items[](AuthorizedUserItem):id / granteeId / granteeType(USER/USER_GROUP) / userId / userGroupId / userName / userGroupName / memberCount / permissions / expireDate / grantedBy / gmtCreate / gmtModified。

bash
curl -X POST "https://<gateway-domain>/openapi/listAuthorizedUsers" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"销售助手","granteeType":"USER"}'

updateAgentAuthMode · 更新数字员工使用权限授权模式 ​

切换数字员工的使用权限授权模式。需 MANAGE 权限。

POST /openapi/updateAgentAuthMode

请求字段:

字段类型必填说明
operatingObjectNamestr✅数字员工名称
authModestr✅SPECIFIED_USERS=指定用户(需显式授权),ALL_USERS=所有用户(无需授权)

响应字段:updated(boolean, 是否更新成功)。

bash
curl -X POST "https://<gateway-domain>/openapi/updateAgentAuthMode" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"operatingObjectName":"销售助手","authMode":"ALL_USERS"}'

组织同步 ​

createCustomOrg · 注册纯自定义组织 ​

注册一个纯自定义组织,用于后续通过 syncOrgStructure 推送部门树(仅支持部门树同步,不支持成员关系同步)。

POST /openapi/createCustomOrg

请求字段:

字段类型必填说明
corpIdstr✅自定义组织标识,格式 ^[a-z0-9][a-z0-9\-]{2,63}$(3-64 位)
corpNamestr❌组织展示名称(不传与 corpId 相同,最长 128)

响应字段:

字段类型说明
corpIdstr注册成功的组织标识
corpNamestr组织展示名称
platformTypestr平台类型,固定为 custom
bash
curl -X POST "https://<gateway-domain>/openapi/createCustomOrg" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"corpId":"acme-corp","corpName":"Acme 公司"}'

syncOrgStructure · 推送组织架构同步 ​

接收客户端推送的部门树和成员关系,创建异步同步任务,返回 taskId 供 querySyncResult 轮询。单次推送 departments + members 总量上限 50000。

POST /openapi/syncOrgStructure

请求字段:

字段类型必填说明
platformTypestr✅平台类型:saml / oauth2 / custom
corpIdstr✅企业标识(需与 listAvailableConfigs 返回一致)
ssoSettingsIdstr❌SSO 配置 ID(多个 IdP 共用 corpId 时必传;custom 不需)
syncMembersboolean❌是否同步成员关系(默认 false;custom 强制 false)
departmentsarray<PushDepartmentItem>✅部门列表(至少一个根部门)
membersarray<PushMemberItem>❌成员列表(syncMembers=true 时必须提供)

departments[](PushDepartmentItem):deptId(✅) / deptName(✅,最长128) / parentDeptId(null 为根部门) / order(默认0)。
members[](PushMemberItem):deptId(✅) / accountId(✅,需与 rbj_user_account.account_id 匹配) / name(可选)。

响应字段:

字段类型说明
taskIdnumber异步同步任务 ID,用于 querySyncResult 轮询
statusstr任务初始状态(PENDING)
bash
curl -X POST "https://<gateway-domain>/openapi/syncOrgStructure" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"platformType":"custom","corpId":"acme-corp","syncMembers":false,"departments":[{"deptId":"d1","deptName":"总部","parentDeptId":null,"order":0}]}'

querySyncResult · 查询组织同步结果 ​

根据 taskId 查询组织同步任务的执行状态和结果(状态:PENDING → RUNNING → COMPLETED / FAILED / TIMEOUT / CANCELED,建议轮询 3-5 秒)。

POST /openapi/querySyncResult

请求字段:

字段类型必填说明
taskIdnumber✅同步任务 ID(由 syncOrgStructure 返回)

响应字段:

字段类型说明
taskIdnumber任务 ID
statusstr任务状态(PENDING / RUNNING / COMPLETED / FAILED / TIMEOUT / CANCELED)
platformTypestr平台类型
corpIdstr企业标识
submittedAtstr任务提交时间(ISO 8601)
startedAtstr任务开始执行时间
completedAtstr任务完成时间
durationSecondsnumber执行时长(秒)
summarystr执行摘要(人可读)
errorMessagestr错误信息(失败时有值)
deptStatsDeptStatsResponse部门同步统计(完成时有值)
memberStatsMemberStatsResponse成员同步统计(syncMembers=true 且完成时有值)

deptStats:totalExternal / created / renamed / moved / deleted / skipped(均 number)。
memberStats:totalExternal / relationshipAdded / relationshipRemoved / unchanged / failed(均 number)。

bash
curl -X POST "https://<gateway-domain>/openapi/querySyncResult" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"taskId":123456}'

listAvailableConfigs · 枚举可用的组织同步配置 ​

枚举当前租户下所有可用的组织同步配置,涵盖 wecom / saml / oauth2 / custom 四种平台类型。

POST /openapi/listAvailableConfigs

请求:无请求体参数。

响应字段:

字段类型说明
configsarray<OrgSyncConfigItem>可用的组织同步配置列表

configs[](OrgSyncConfigItem):

字段类型说明
platformTypestr平台类型:wecom / saml / oauth2 / custom
corpIdstr企业标识(wecom=corpId, saml=idpEntityId, oauth2=clientId, custom=客户自定义)
corpNamestr企业展示名称
ssoSettingsIdstrSSO 配置 ID(custom 为 null)
ssoSettingsNamestrSSO 配置名称(custom 为 null)
bash
curl -X POST "https://<gateway-domain>/openapi/listAvailableConfigs" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{}'

最佳实践 ​

✓
「调技能优先于调会话」——快捷技能是已经被你或管理员配好的“成品能力”,参数稳定、结果可预期。直接调会话相当于让对方现场和数字员工聊一通,结果飘。
✓
「先用 CLI 调通,再改成代码」——所有 OpenAPI 能力 CLI 都封装好了,先在终端验证参数和返回结构,再翻成代码。
i
「Token 不要写死在代码里」——读环境变量,部署时通过 secret manager 注入。

📌 配套阅读:CLI、编写自定义技能包、能力中心