Rotate a credential's secret or update metadata. The name and networking settings cannot be changed.
Endpoint
POST /vaults/{vault_id}/credentials/{credential_id}
Paths are relative to the Base URL. Send Authorization: Bearer $DASHSCOPE_API_KEY on every request. For authentication details, see Authentication.
Path parameters
| Field | Required | Type | Description |
|---|---|---|---|
vault_id | Yes | string | Parent vault ID. Treat it as an opaque ID |
credential_id | Yes | string | Credential ID. Treat it as an opaque ID |
Request body
| Field | Required | Type | Description |
|---|---|---|---|
metadata | No | object | Metadata, when omitted, the current value is kept; null returns 400; {} clears it. Up to 16 items; key 1–64 characters, value up to 512 characters |
auth | No | object | Authentication information, when omitted, only metadata is updated; null returns 400 |
auth.type | Conditional | string | Authentication type, fixed as environment_variable |
auth.secret_value | Conditional | string | New secret value. Cannot be empty or whitespace-only; length and control character limits are the same as on create |
metadata and auth. Omitting both or sending {} returns 400. Updates can only change metadata and rotate secret_value; name, secret_name, and networking cannot be changed, and sending these fields returns 400 unknown_parameter.
metadata is replaced as a whole, not merged. Rotation keeps the existing environment variable name and networking settings. The response does not return secret_value, the key identifier, or injection_location.
Request example
Response example
Response fields
200, returns the updated credential:
| Field | Type | Description |
|---|---|---|
id | string | Credential ID |
object | string | Credential object type, fixed as vault.credential |
vault_id | string | Parent vault ID |
name | string | Display name |
created_at | integer | Creation time in Unix seconds |
updated_at | integer | Last update time in Unix seconds |
metadata | object | Metadata, string key-value pairs; {} when not set |
auth | object | Authentication settings. |
auth.type | string | Authentication type, fixed as environment_variable |
auth.secret_name | string | Environment variable name |
auth.networking | object | Target domain settings. |
auth.networking.type | string | Network access type, limited or unrestricted |
auth.networking.allowed_hosts | array | Domains or IPv4 addresses allowed for limited |
Error codes
For the error response structure, see Errors.
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / unknown_parameter | The request contains an unknown field, such as name, secret_name, or networking |
400 | invalid_request_error / invalid_type | Fix the field type as described |
400 | invalid_request_error / invalid_request_error | The request body is empty, auth.type is invalid, secret_value is blank, or metadata is null |
401 | authentication_error / invalid_api_key | Send a valid Authorization: Bearer $DASHSCOPE_API_KEY header |
404 | not_found_error / not_found_error | The credential does not exist, is deleted, does not belong to the parent vault, or belongs to another workspace |
409 | conflict_error / conflict_error | Retry later. If it keeps failing, submit a ticket with x-request-id |
500 | server_error / server_error | Retry later. If it keeps failing, submit a ticket with x-request-id |