Skip to main content

列出 Credential

分页列出指定 Vault 下的 Credential,支持元数据和归档状态筛选。

接口

GET /vaults/{vault_id}/credentials 路径相对 Base URL。每个请求携带 Authorization: Bearer $DASHSCOPE_API_KEY,认证方式见认证。

路径参数

vault_id string (必选)父 Vault ID,按不透明 ID 使用

查询参数

limit integer (可选)每页数量,默认 20,范围 1–100。空字符串、0、负数、非数字或超出范围返回 400order string (可选)排序方向,asc 或 desc,默认 descafter string (可选)上一页的 last_id。从该项之后开始,不包含该项metadata[key] string (可选)元数据过滤条件,按 metadata 精确匹配,多个条件之间为 ANDstatus string (可选)Credential 状态:active 或 archived,默认两者都包含。也支持重复传入 status[],值会合并为筛选集合before 不是支持参数。Credential 只会列出路径 Vault 下的资源,after 游标必须属于同一个 Vault。

请求示例

curl -sS "$BASE_URL/vaults/vlt_xxx/credentials?limit=20&order=desc&status=active" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

响应字段

200,返回列表信封:object string列表对象类型,固定为 listdata array当前页的 Credential 数组first_id string / null当前页首项 ID。空页为 nulllast_id string / null当前页末项 ID,下一页的 after 使用该值。空页为 nullhas_more boolean是否还有更多匹配资源

Credential 字段

id stringCredential IDobject stringCredential 对象类型,固定为 vault.credentialvault_id string所属 Vault IDname string显示名称created_at integer创建时间,Unix 秒updated_at integer最近更新时间,Unix 秒metadata object元数据,字符串键值对;未设置时为 {}auth object认证配置。
type string认证类型,固定为 environment_variablesecret_name string环境变量名networking object目标域名配置。
type string网络访问类型,limited 或 unrestrictedallowed_hosts array允许的目标域名或 IPv4,仅 limited 时返回
响应不返回 secret_value、密钥标识或 injection_location。空页返回 data: [],first_id 和 last_id 为 null,has_more 为 false。

响应示例

{
  "object": "list",
  "data": [
    {
      "id": "vcrd_xxx",
      "object": "vault.credential",
      "vault_id": "vlt_xxx",
      "name": "crm-token",
      "created_at": 1793941200,
      "updated_at": 1793941200,
      "metadata": {"team": "support"},
      "auth": {
        "type": "environment_variable",
        "secret_name": "CRM_TOKEN",
        "networking": {
          "type": "limited",
          "allowed_hosts": ["api.example.com"]
        }
      }
    }
  ],
  "first_id": "vcrd_xxx",
  "last_id": "vcrd_xxx",
  "has_more": false
}

错误码

错误响应结构见错误码。
HTTP 状态码错误类型 / 错误码解决方案
400invalid_request_error / invalid_request_error按查询参数说明修正 limit、order 或 metadata 过滤条件
401authentication_error / invalid_api_key在请求头携带有效的 Authorization: Bearer $DASHSCOPE_API_KEY
404not_found_error / not_found_error父 Vault 不存在,或 after 游标不存在、已删除、跨父 Vault
500server_error / server_error稍后重试;持续失败时提交工单并提供 x-request-id