Skip to main content

Get Credential

Retrieves the details of a specified Credential. The response is a Credential object with sensitive values masked in the auth field.

Prerequisites

Endpoint and authentication configured. For details, see API overview and authentication.

Endpoint

GET /vaults/{vault_id}/credentials/{credential_id}

Path parameters

vault_id string (必选)Vault ID, format vlt_xxxcredential_id string (必选)Credential ID, format cred_xxx

Request example

curl "$AGENTSTUDIO_URL/vaults/vlt_xxx/credentials/cred_xxx" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

Response fields

id stringCredential ID, format cred_xxxtype stringFixed as credentialvault_id stringVault ID that the Credential belongs todisplay_name stringHuman-readable name of the Credentialauth objectAuthentication information with sensitive values masked (e.g. secret_value is not returned)auth.type stringAuth type; currently only environment_variable is supportedauth.secret_name stringEnvironment variable nameauth.networking objectNetwork policyauth.networking.allowed_hosts arrayList of domains allowed for real-key substitutionauth.injection_location objectSubstitution location. The location is the request header; placeholders in the request body and query parameters are not replacedauth.injection_location.header booleanWhether to enable request-header substitutionmetadata objectCustom business key-value pairsarchived_at string | nullArchive time; null if not archivedcreated_at stringCreation time, ISO 8601updated_at stringLast update time, ISO 8601request_id stringUnique request identifier

Response

{
  "id": "cred_xxx",
  "type": "credential",
  "vault_id": "vlt_xxx",
  "display_name": "Third-party API key",
  "auth": {
    "type": "environment_variable",
    "secret_name": "API_KEY",
    "networking": {
      "allowed_hosts": [
        "api.example.com",
        "*.example.com"
      ]
    },
    "injection_location": {
      "header": true
    }
  },
  "metadata": {},
  "archived_at": null,
  "created_at": "2026-07-10T08:00:00Z",
  "updated_at": "2026-07-10T08:00:00Z",
  "request_id": "req_xxx"
}

Error codes

HTTP statusError codeDescription
400InvalidParameterRequired parameter missing or invalid.
401InvalidApiKeyInvalid API-key provided.