List credentials

Updated at:

List credentials under a vault with pagination and filters for metadata and archive status.

Endpoint

Paths are relative to the Base URL. Send Authorization: Bearer $DASHSCOPE_API_KEY on every request. For authentication details, see Authentication.

GET/vaults/{vault_id}/credentials

Path parameters

vault_idstringRequired

Parent vault ID. Treat it as an opaque ID

Query parameters

limitintegerOptional

Page size. Default 20, range 1–100. An empty string, 0, a negative number, a non-number, or an out-of-range value returns 400

orderstringOptional

Sort direction, asc or desc. Default desc

afterstringOptional

The last_id from the previous page. Starts after that item and excludes it

metadata[key]stringOptional

Metadata filter, exact metadata match. Multiple conditions are combined with AND

statusstringOptional

Credential status: active or archived. Both are included by default. Repeated status[] parameters are also supported, and their values are merged into one filter set

before is not a supported parameter. Credentials are only listed under the vault in the path, and the after cursor must belong to the same vault.

Request example

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

resp = requests.get(
    f"{os.environ['BASE_URL']}/vaults/vlt_xxx/credentials",
    headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}"},
    params={"limit": 20, "order": "desc", "status": "active"},
)
print(resp.json())

Response fields

200, returns a list envelope:

objectstring

List object type, fixed as list

dataarray

Credentials on the current page

first_idstring / null

ID of the first item on the page; null for an empty page

last_idstring / null

ID of the last item on the page; use it as after for the next page. null for an empty page

has_moreboolean

Whether more matching resources exist

Credential fields

idstring

Credential ID

objectstring

Credential object type, fixed as vault.credential

vault_idstring

Vault ID that owns the credential

namestring

Display name

created_atinteger

Creation time in Unix seconds

updated_atinteger

Last update time in Unix seconds

metadataobject

Metadata, string key-value pairs; {} when not set

authobject

Authentication settings.

Properties

typestring

Authentication type, fixed as environment_variable

secret_namestring

Environment variable name

networkingobject

Target domain settings.

Properties

typestring

Network access type, limited or unrestricted

allowed_hostsarray

Allowed target domains or IPv4 addresses when limited

The response does not return secret_value, the key identifier, or injection_location. An empty page returns data: [], with first_id and last_id set to null and has_more set to false.

Response example

{
  "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
}

Error codes

For the error response structure, see Errors.

HTTP statusError type / codeSolution
400invalid_request_error / invalid_request_errorlimit, order, or a metadata filter is invalid
401authentication_error / invalid_api_keySend a valid Authorization: Bearer $DASHSCOPE_API_KEY header
404not_found_error / not_found_errorThe parent vault does not exist, or the after cursor does not exist, is deleted, or belongs to another parent vault
500server_error / server_errorRetry later. If it keeps failing, submit a ticket with x-request-id