GetCredential - 查询凭证
查询指定凭证的详细信息,并返回已绑定该凭证的智能体列表。凭证内容以脱敏形式返回。
接口说明
查询单个凭证的详细信息,敏感字段不返回。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
agentcore:GetCredential |
get |
*Credential
|
无 | 无 |
请求语法
GET /workspaces/{workspaceId}/credentials/{credentialId} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| workspaceId |
string |
是 |
工作空间 ID。 |
ws-123456 |
| credentialId |
string |
是 |
凭证 ID。 |
cred-123456 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
当前API无需请求参数
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| code |
string |
业务状态码。 |
SUCCESS |
| data |
object |
凭证详情。 |
|
| boundAgents |
array<object> |
已绑定该凭证的智能体列表。 |
|
|
object |
|||
| agentId |
string |
智能体 ID。 |
agent-123456 |
| agentName |
string |
智能体名称。 |
agent-01 |
| 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> |
每项包含 resourceType、resourceId、resourceName。资源已删除时 resourceName 为空。 |
|
|
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 |
| httpStatusCode |
integer |
HTTP 状态码。 |
200 |
| message |
string |
响应消息。请求失败时返回错误描述。 |
success |
| requestId |
string |
请求 ID。 |
request-123456 |
| success |
boolean |
请求是否成功。 |
示例
正常返回示例
JSON格式
{
"code": "SUCCESS",
"data": {
"boundAgents": [
{
"agentId": "agent-123456",
"agentName": "agent-01"
}
],
"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"
},
"httpStatusCode": 200,
"message": "success",
"requestId": "request-123456",
"success": true
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 404 | Resource.NotFound | The specified AgentCore credential does not exist. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。