All Products
Search
Document Center

Key Management Service:ListSecretVersionIds

Last Updated:Jul 29, 2025

Queries information about all versions of a secret.

Operation description

  • For more information about the access policy required for a RAM user or RAM role to call this OpenAPI, see Resource Access Management.

  • The version information does not include the secret value. By default, this operation returns only the secret versions that are marked with a version stage.

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 credential.

Note

When you access a credential that belongs to another Alibaba Cloud account, you must specify the ARN of the credential. The ARN of a credential is in the format of acs:kms:${region}:${account}:secret/${secret-name}.

secret001

IncludeDeprecated

string

No

Specifies whether to include credential versions that have no version stages in the response.

Valid values:

  • false (default): No

  • true: Yes

false

PageNumber

integer

No

The number of the page to return for a paged query. Default value: 1.

1

PageSize

integer

No

The number of entries to return on each page for a paged query. Default value: 20.

10

Response parameters

Parameter

Type

Description

Example

object

SecretName

string

The name of the credential.

secret001

RequestId

string

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

5b75d8b1-5b6a-4ec0-8e0c-c08befdfad47

PageSize

integer

The number of entries returned on each page.

10

PageNumber

integer

The page number of the returned page.

1

TotalCount

integer

The total number of entries.

4

VersionIds

object

VersionId

array<object>

A list of version information of the credential.

object

A list of version information of the credential.

VersionId

string

The version number.

00000000000000000000000000000000203

CreateTime

string

The time when the version was created.

2020-02-21T15:39:26Z

VersionStages

object

VersionStage

array

The stage labels of the version.

string

The stage labels of the version.

{ "VersionStage": [ "ACSCurrent", "UStage1", "Ustage2" ] }

Examples

Success response

JSON format

{
  "SecretName": "secret001",
  "RequestId": "5b75d8b1-5b6a-4ec0-8e0c-c08befdfad47",
  "PageSize": 10,
  "PageNumber": 1,
  "TotalCount": 4,
  "VersionIds": {
    "VersionId": [
      {
        "VersionId": "00000000000000000000000000000000203",
        "CreateTime": "2020-02-21T15:39:26Z",
        "VersionStages": {
          "VersionStage": [
            "{ \"VersionStage\": [ \"ACSCurrent\", \"UStage1\", \"Ustage2\" ] }"
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter some of the specified parameters "\" is not valid
500 InternalFailure Internal Failure
403 Forbidden.NoPermission This operation is forbidden by permission system
404 Forbidden.ResourceNotFound Resource not found

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.