CreateAgent - 创建数据网关 Agent 身份
创建数据网关 Agent 身份
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| AgentName |
string |
是 |
Agent 名称,同一租户内不可重复,最大长度 128 个字符。 |
order-analysis-agent |
| Description |
string |
否 |
Agent 的描述信息,最大长度 512 个字符。 |
An agent for querying and analyzing order data |
| AgentType |
string |
否 |
Agent 的权限继承类型,标识其权限来源;不传时默认为 HUMAN_BOUND。 枚举值:
|
HUMAN_BOUND |
| ExpireAfterSeconds |
integer |
否 |
自动签发的 API Key 的有效期,单位为秒,取值范围 1~31536000(最长 1 年)。 |
2592000 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| Data |
object |
创建成功后返回的 Agent 信息及其自动签发的 API Key。 |
|
| AgentId |
string |
Agent 的全局唯一 ID。 |
agt-1a2b3c4d5e6f |
| AgentName |
string |
Agent 名称。 |
order-analysis-agent |
| AgentType |
string |
Agent 的权限继承类型。取值:HUMAN_BOUND(继承用户权限)、PERMISSION_NARROW(权限收窄)、STANDALONE(独立身份主体,不继承其他主体权限)。 |
HUMAN_BOUND |
| ApiKey |
object |
为新建 Agent 自动签发的 API Key(一次性返回明文 secret) |
|
| AgentId |
string |
API Key 所属 Agent 的 ID。 |
agt-1a2b3c4d5e6f |
| AgentName |
string |
API Key 所属 Agent 的名称。 |
order-analysis-agent |
| AgentType |
string |
API Key 所属 Agent 的权限继承类型。 |
HUMAN_BOUND |
| CreatedAt |
string |
API Key 的创建时间,RFC 3339 格式的时间字符串。 |
2025-12-11T14:04:32Z |
| CreatorId |
string |
创建该 API Key 的用户 ID。 |
usr-1a2b3c4d |
| CreatorName |
string |
创建该 API Key 的用户名称。 |
John Doe |
| Description |
string |
API Key 的描述信息。 |
Access Token automatically issued when the Agent is created |
| ExpireTime |
string |
API Key 的过期时间,RFC 3339 格式的时间字符串。 |
2026-12-11T14:04:32Z |
| Id |
integer |
API Key 的主键 ID。 |
1001 |
| IsRevoked |
boolean |
API Key 是否已被吊销。 |
|
| KeyPrefix |
string |
API Key 明文的非敏感可见前缀,用于识别凭证;明文 Secret 不会再次返回。 |
dms_sk_1a2b |
| LastUsedTime |
string |
API Key 最近一次被使用的时间,RFC 3339 格式的时间字符串;从未使用时为空。 |
2025-12-12T09:30:00Z |
| Name |
string |
API Key 的名称。 |
order-analysis-agent-default |
| Secret |
string |
API Key 的明文 Secret,仅在本次创建响应中一次性返回,请妥善保存;后续接口不会再次返回明文。 |
dms_sk_1a2b3c4d**** |
| Source |
string |
凭证来源。console 表示控制台签发,oauth 表示 OAuth 流程签发,install_token 表示安装即鉴权流程签发;本接口自动签发的 API Key 固定为 console。 |
console |
| CreatedAt |
string |
Agent 的创建时间,RFC 3339 格式的时间字符串。 |
2025-12-11T14:04:32Z |
| CreationType |
string |
Agent 的创建方式。manual 表示在控制台手工创建,auto 表示系统自动创建;本接口创建的 Agent 固定为 manual。 |
manual |
| Description |
string |
Agent 的描述信息。 |
An agent for querying and analyzing order data |
| OwnerId |
string |
Agent 归属人的用户 ID,即发起本次创建的当前用户。 |
usr-1a2b3c4d |
| Status |
string |
Agent 的状态。active 表示正常启用,disabled 表示已停用,deleted 表示已删除;新建 Agent 固定为 active。 |
active |
| ErrorCode |
string |
请求结果状态码,成功时为 success,失败时为具体错误码。 |
success |
| ErrorMessage |
string |
请求失败时返回的错误信息,成功时为空。 |
agentName must not be blank |
| RequestId |
string |
本次请求的唯一 ID,可用于问题排查与追踪。 |
67E910F2-4B62-5B0C-ACA3-7547695C**** |
| Success |
boolean |
本次请求是否成功。 |
示例
正常返回示例
JSON格式
{
"Data": {
"AgentId": "agt-1a2b3c4d5e6f",
"AgentName": "order-analysis-agent",
"AgentType": "HUMAN_BOUND",
"ApiKey": {
"AgentId": "agt-1a2b3c4d5e6f",
"AgentName": "order-analysis-agent",
"AgentType": "HUMAN_BOUND",
"CreatedAt": "2025-12-11T14:04:32Z",
"CreatorId": "usr-1a2b3c4d",
"CreatorName": "John Doe",
"Description": "Access Token automatically issued when the Agent is created",
"ExpireTime": "2026-12-11T14:04:32Z",
"Id": 1001,
"IsRevoked": true,
"KeyPrefix": "dms_sk_1a2b",
"LastUsedTime": "2025-12-12T09:30:00Z",
"Name": "order-analysis-agent-default",
"Secret": "dms_sk_1a2b3c4d****",
"Source": "console"
},
"CreatedAt": "2025-12-11T14:04:32Z",
"CreationType": "manual",
"Description": "An agent for querying and analyzing order data",
"OwnerId": "usr-1a2b3c4d",
"Status": "active"
},
"ErrorCode": "success",
"ErrorMessage": "agentName must not be blank",
"RequestId": "67E910F2-4B62-5B0C-ACA3-7547695C****",
"Success": true
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。