All Products
Search
Document Center

Key Management Service:UpdateSecretVersionStage

Last Updated:Jul 31, 2025

Updates the version stage of a generic secret.

  • This operation is supported only for generic secrets. You can perform the following actions:

    • 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 the version stage to another secret version.

  • Each generic secret can have a maximum of eight version stages.

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

Debugging

You can call this operation directly in OpenAPI Explorer. This eliminates the need to calculate signatures. After a successful call, OpenAPI Explorer automatically generates sample code for the SDK.

Request parameters

Name

Type

Required

Example

Description

Action

String

Yes

UpdateSecretVersionStage

The operation you want to perform. Set the value to UpdateSecretVersionStage.

SecretName

String

Yes

secret001

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

Note

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

VersionStage

String

Yes

ACSCurrent

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. Valid values: 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. Set this parameter to a custom stage.

Note

ACSCurrent and ACSPrevious are system-defined stages and cannot be deleted. They can only be moved from one secret version to another.

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

Specify this parameter, MoveToVersion, and RemoveFromVersion. Valid values: ACSCurrent, ACSPrevious, or a custom stage.

RemoveFromVersion

String

No

001

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

Note

Specify at least one: RemoveFromVersion or MoveToVersion.

MoveToVersion

String

No

002

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

Note
  • Specify at least one: RemoveFromVersion or MoveToVersion.

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

Response parameters

Name

Type

Example

Description

SecretName

String

secret001

The name of the secret.

RequestId

String

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

The ID of the request. This ID is a unique identifier generated by Alibaba Cloud for the request. You can use the ID to troubleshoot issues.

Examples

Request example

http(s)://[Endpoint]/?Action=UpdateSecretVersionStage
&SecretName=secret001
&VersionStage=ACSCurrent
&RemoveFromVersion=001
&MoveToVersion=002
&Common request parameters

Response example

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateSecretVersionStageResponse>
    <SecretName>secret001</SecretName>
    <RequestId>8cad259f-4d77-40ec-bbd7-b9c47a423bb9</RequestId>
</UpdateSecretVersionStageResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, see the API Error Center.