列出¶
GET /api/v1/workspace/accesskey/list
概述¶
列出当前工作空间内未绑定账号的有效 API Key 记录。
调用前和使用步骤¶
调用需要当前工作空间的 workspace.openAPIKeyManage 权限。下方示例节选常用字段。 列表没有分页,非 Owner 不会看到 Owner Key。默认先排 Owner 记录,同组按记录 ID 倒序。取得 uuid 后可查询详情。手工创建且未绑定账号的工作空间 Key,可由空间 Owner 读取完整凭据。非 Owner 仅对本次使用的这条 Key 读到完整值,其他记录会掩码;个人、Agent 等其他来源也会掩码。请对日志和工单中的响应做脱敏。
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间调用凭据。记录 UUID 与调用凭据是不同字段。 例子: <DF-API-KEY>获取或填写方式: 从当前工作空间 API Key 管理取得完整凭据。 |
Query 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| search | string | 按名称模糊匹配,省略或留空不筛选。 允许 null: False 例子: 应用获取或填写方式: 从工作空间 API Key 管理页面复制名称,也可以填名称的一部分。 |
|
| orderBy | string | 列表排序字段;省略使用默认排序。 允许 null: False 可选值: ['createAt', 'callCount', 'lastCallAt'] 例子: lastCallAt获取或填写方式: 按需求选择创建时间 createAt、调用次数 callCount 或最近调用 lastCallAt。 |
|
| order | string | 默认 desc;与 orderBy 一起使用。 允许 null: False 可选值: ['asc', 'desc'] 例子: desc获取或填写方式: 选择升序 asc 或降序 desc。 |
参数补充说明¶
示例中的资源标识为占位值,请替换为目标工作空间的实际值。
请求例子¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
'https://openapi.guance.com/api/v1/workspace/accesskey/list' \
--data-urlencode "search=应用" \
--data-urlencode "orderBy=lastCallAt" \
--data-urlencode "order=desc"
响应¶
HTTP 200,application/json。
| 字段 | 类型 | 说明 |
|---|---|---|
| content | array<object> |
符合条件的 Key 记录。 |
| content[].uuid | string | API Key 记录的 UUID,常见前缀 wsak_。用于 API Key 管理接口的路径。 |
| content[].name | string | API Key 的名称。 |
| content[].workspaceUUID | string | 所属工作空间。 |
| content[].createdWay | string | API Key 的创建来源。 |
| content[].remark | string | API Key 的备注。 |
| content[].isOwnerRole | integer 或 boolean | 该 API Key 是否具备空间拥有者角色。 |
| content[].callCount | integer | 记录的调用次数。 |
| content[].lastCallAt | integer | 最近一次记录的调用时间,Unix 秒,无记录可为 -1。 |
| content[].createAt | integer | 记录创建时间,Unix 秒。 |
| content[].accountUUID | string | 显式绑定的账号 UUID,未绑定为空字符串。 |
| content[].effectiveAccountUUID | string | 鉴权使用的身份标识。未绑定时为该 API Key 记录 UUID。 |
| content[].accountInfo | object 或 null | 绑定账号资料,未绑定时为 null。 |
| content[].roles | array<object> |
有效角色集合,顺序不固定。 |
| content[].roles[].uuid | string | 角色 UUID。 |
| content[].roles[].name | string | 角色名称。 |
| content[].permissions | array<string> |
有效权限标识集合,顺序不固定。 |
| content[].rolePermissions | object | 各角色拥有的权限标识,以角色 UUID 为键,权限字符串数组为值。 |
| content[].declaration | object 或 null | 工作空间声明。 |
| content[].ak | string | Access Key 标识。可能按当前身份掩码。 |
| content[].sk | string | Secret Key 凭据。可能按当前身份掩码。应按敏感信息处理响应。 |
| content[].creatorInfo | object | 创建者资料,查不到时为空对象。 |
{
"code": 200,
"content": [
{
"uuid": "wsak_example",
"name": "应用数据读取",
"workspaceUUID": "wksp_example",
"createdWay": "manual",
"remark": "",
"isOwnerRole": 0,
"callCount": 14,
"lastCallAt": 1785427200,
"createAt": 1785423600,
"accountUUID": "",
"effectiveAccountUUID": "wsak_example",
"accountInfo": null,
"roles": [
{
"uuid": "role_example",
"name": "应用数据只读"
}
],
"permissions": [
"routine.defaultAccess"
],
"rolePermissions": {
"role_example": [
"routine.defaultAccess"
]
},
"declaration": null,
"ak": "*************abcd",
"sk": "*************ef01",
"creatorInfo": {}
}
],
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 传入未声明的参数或参数值未通过校验 | 参数校验失败,消息指出无效字段。 | 核对各字段的位置和可选值。 |