Update Credential

Updated at:

Updates the properties of a specified Credential. The type and secret_name fields in auth are immutable and cannot be modified.

Prerequisites

Endpoint and authentication configured. For details, see Overview and authentication.

Endpoint

POST/vaults/{vault_id}/credentials/{credential_id}

Path parameters

vault_idstringRequired

Vault ID, format vlt_xxx

credential_idstringRequired

Credential ID, format cred_xxx

Request body

authobjectOptional

Authentication information, always of the environment_variable type. The type and secret_name fields are immutable on update, and an empty secret_value means no change.

display_namestringOptional

Human-readable name of the Credential, max 255 characters

metadataobjectOptional

Custom key-value pairs for business metadata

Noteauth.secret_name must match ^[a-zA-Z][a-zA-Z0-9_]*$: start with a letter; only letters, digits, and underscores. It is immutable on update.

Request example

curl -X POST "$AGENTSTUDIO_URL/vaults/vlt_xxx/credentials/cred_xxx" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Production API key",
    "auth": {
      "type": "environment_variable",
      "secret_name": "API_KEY",
      "secret_value": "sk-new-value",
      "networking": {
        "allowed_hosts": [
          "api.example.com"
        ]
      },
      "injection_location": {
        "header": true
      }
    }
  }'

Response fields

idstring

Credential ID, format cred_xxx

typestring

Always credential

vault_idstring

Vault ID that the Credential belongs to

display_namestring

Human-readable name of the Credential

authobject

Authentication information with sensitive values masked

metadataobject

Custom key-value pairs

archived_atstring | null

Archive timestamp; null if not archived

created_atstring

Creation time, ISO 8601

updated_atstring

Last update time, ISO 8601

request_idstring

Unique request identifier

Response example

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

Error codes

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