All Products
Search
Document Center

Key Management Service:UpdateSecretVersionStage

Last Updated:Aug 15, 2025

Updates the version stage of a secret.

Operation description

  • For more information about the access policy that is required to call this operation as a Resource Access Management (RAM) user or RAM role, see Resource Access Management.

  • This operation supports only generic secrets. You can perform the following operations:

    • Add a version stage to a specified secret version.

    • Remove a version stage from a specified secret version.

    • Remove a version stage from a specified secret version and attach it to another secret version.

  • The total number of version stages for each generic secret cannot exceed 8.

This topic provides an example of how to update the version stage of the secret named secret001. In this example, the ACSCurrent stage is used to mark version 002.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

SecretName

string

Yes

The name or Alibaba Cloud Resource Name (ARN) of the secret.

Note

To access a secret in a different Alibaba Cloud account, you must specify the ARN of the secret. The ARN is in the format of acs:kms:${region}:${account}:secret/${secret-name}.

secret001

VersionStage

string

Yes

The version stage of the secret.

Scenario 1: Add a version stage to a specified secret version.

Specify this parameter and MoveToVersion. Do not specify RemoveFromVersion. This parameter can be set to ACSCurrent, ACSPrevious, or a custom stage.

Scenario 2: Remove a version stage from a specified secret version.

Specify this parameter and RemoveFromVersion. Do not specify MoveToVersion. This parameter must be set to a custom stage.

Note

ACSCurrent and ACSPrevious are system-reserved stages. You cannot directly remove them. You can only remove them from one secret version and attach them to another.

Scenario 3: Remove a version stage from a specified secret version and attach it to another secret version.

Specify this parameter, MoveToVersion, and RemoveFromVersion. This parameter can be set to ACSCurrent, ACSPrevious, or a custom stage.

ACSCurrent

RemoveFromVersion

string

No

The version number of the secret. This parameter specifies that the version stage set by VersionStage is removed from this version.

Note

You must specify at least one of RemoveFromVersion and MoveToVersion.

001

MoveToVersion

string

No

The version number of the secret. This parameter specifies that the version stage set by VersionStage is attached to this version.

Note
  • You must specify at least one of RemoveFromVersion and MoveToVersion.

  • If you set VersionStage to ACSCurrent or ACSPrevious, you must specify this parameter.

002

Response parameters

Parameter

Type

Description

Example

object

SecretName

string

The name of the secret.

secret001

RequestId

string

The ID of the request. Alibaba Cloud generates a unique ID for each request. You can use the ID to troubleshoot issues.

8cad259f-4d77-40ec-bbd7-b9c47a423bb9

Examples

Success response

JSON format

{
  "SecretName": "secret001",
  "RequestId": "8cad259f-4d77-40ec-bbd7-b9c47a423bb9"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter some of the specified parameters "\" is not valid
400 Rejected.LimitExceeded exceed secret limits error
400 Rejected.InvalidRequest param mismatch
400 Rejected.UnsupportedOperation secret stages in unnormal status
500 InternalFailure Internal Failure
403 Forbidden.NoPermission This operation is forbidden by permission system
404 Forbidden.ResourceNotFound Resource not found
409 Rejected.ResourceInDeleteWindow secret in delete peroid

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.