ListCredentials - 查询凭证列表
分页查询指定工作空间内的凭证。通过 credentialType 按类型过滤,通过 nameLike 按凭证名称模糊过滤,通过 maxResults 指定单页最大记录数,通过 nextToken 获取下一页。未指定 maxResults 时服务端默认返回 10 条。
接口说明
分页查询工作空间内的凭证列表,支持按类型和名称过滤。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
agentcore:ListCredentials |
list |
*Credential
|
无 | 无 |
请求语法
GET /workspaces/{workspaceId}/credentials HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| workspaceId |
string |
是 |
工作空间 ID。 |
ws-123456 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| credentialType |
string |
否 |
按凭证类型过滤。当前仅支持 apiKey。 |
apiKey |
| name |
string |
否 |
按凭证名称过滤 |
credentialxxx |
| nameLike |
string |
否 |
按凭证名称模糊匹配的过滤条件。 |
model |
| maxResults |
integer |
否 |
单页返回的最大记录数,取值范围为 1~100。不指定该参数时默认返回 10 条。 |
10 |
| nextToken |
string |
否 |
查询下一页的游标。首次调用不指定该参数,后续调用指定上一次返回的 nextToken。 |
10 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| code |
string |
业务状态码。 |
SUCCESS |
| httpStatusCode |
integer |
HTTP 状态码。 |
200 |
| items |
array<object> |
凭证列表。 |
|
|
array<object> |
|||
| boundAgentsCounts |
integer |
已绑定该凭证的智能体数量。 |
2 |
| createdAt |
string |
创建时间,采用 RFC 3339 格式的 UTC 时间。 |
2026-08-12T03:04:05Z |
| credentialId |
string |
凭证 ID。 |
cred-123456 |
| credentialMetadata |
string |
凭证内容的脱敏结果。credentialType 为 apiKey 时,apiKey 的取值以等长的 * 返回。 |
{"apiKey":"****************"} |
| credentialType |
string |
凭证类型。当前仅支持 apiKey。 |
apiKey |
| description |
string |
凭证描述,长度不超过 256 个字符。 |
线上环境调用模型服务使用的 API Key |
| name |
string |
凭证名称。在工作空间内唯一,只能包含字母、数字、点、下划线和连字符,长度为 3~128 个字符,且不能使用运行时保留名称。 |
model-api-key |
| regionId |
string |
资源所在的地域 ID。 |
cn-hangzhou |
| resourceRefs |
array<object> |
凭证可应用的资源列表 |
|
|
object |
|||
| resourceId |
string |
资源的唯一标识。 |
agent-xxxx |
| resourceName |
string |
资源名称,资源已删除时为空。 |
my-agent |
| resourceType |
string |
资源类型,如 agent。 |
agent |
| resourceScope |
string |
凭证资源应用范围 |
ALL |
| updatedAt |
string |
最近一次修改的时间,采用 RFC 3339 格式的 UTC 时间。 |
2026-08-12T03:04:05Z |
| workspaceId |
string |
工作空间 ID。 |
ws-123456 |
| maxResults |
integer |
本次查询生效的单页最大记录数。 |
10 |
| message |
string |
响应消息。请求失败时返回错误描述。 |
success |
| nextToken |
string |
下一页游标。没有下一页时为空。 |
10 |
| requestId |
string |
请求 ID。 |
request-123456 |
| success |
boolean |
请求是否成功。 |
|
| totalCount |
integer |
符合查询条件的凭证总数。 |
42 |
示例
正常返回示例
JSON格式
{
"code": "SUCCESS",
"httpStatusCode": 200,
"items": [
{
"boundAgentsCounts": 2,
"createdAt": "2026-08-12T03:04:05Z",
"credentialId": "cred-123456",
"credentialMetadata": "{\"apiKey\":\"****************\"}",
"credentialType": "apiKey",
"description": "线上环境调用模型服务使用的 API Key",
"name": "model-api-key",
"regionId": "cn-hangzhou",
"resourceRefs": [
{
"resourceId": "agent-xxxx",
"resourceName": "my-agent",
"resourceType": "agent"
}
],
"resourceScope": "ALL",
"updatedAt": "2026-08-12T03:04:05Z",
"workspaceId": "ws-123456"
}
],
"maxResults": 10,
"message": "success",
"nextToken": "10",
"requestId": "request-123456",
"success": true,
"totalCount": 42
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。