All Products
Search
Document Center

Key Management Service:ListKeyVersions

Last Updated:Apr 03, 2026

Queries all versions of a specified CMK.

Operation description

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

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

KeyId

string

Yes

The globally unique ID of the CMK. You can also set this parameter to an alias that is bound to the CMK. For more information, see Use aliases.

0b30658a-ed1a-4922-b8f7-a673ca9c****

PageNumber

integer

No

The number of the page to return.

Pages start from page 1.

Default value: 1.

1

PageSize

integer

No

The number of entries to return on each page.

Valid values: 0 to 101.

Default value: 10.

10

Response elements

Element

Type

Description

Example

object

PageSize

integer

The number of entries returned per page.

10

RequestId

string

The request ID.

f71204c4-53cd-4eea-b405-653ba2db7e86

PageNumber

integer

The page number of the returned page.

1

TotalCount

integer

The total number of returned key versions.

3

KeyVersions

object

KeyVersion

array<object>

An array that consists of key versions.

object

KeyId

string

The globally unique ID of the CMK.

Note

If you set the KeyId parameter to the alias of the CMK, the ID of the CMK to which the alias is bound is returned.

0b30658a-ed1a-4922-b8f7-a673ca9c****

KeyVersionId

string

The globally unique ID of the CMK version.

1e3304fd-68ac-4d5b-8886-ae5f01a1****

CreationDate

string

The date and time when the CMK version was created. The time is displayed in UTC.

2016-03-25T10:42:40Z

Examples

Success response

JSON format

{
  "PageSize": 10,
  "RequestId": "f71204c4-53cd-4eea-b405-653ba2db7e86",
  "PageNumber": 1,
  "TotalCount": 3,
  "KeyVersions": {
    "KeyVersion": [
      {
        "KeyId": "0b30658a-ed1a-4922-b8f7-a673ca9c****",
        "KeyVersionId": "1e3304fd-68ac-4d5b-8886-ae5f01a1****",
        "CreationDate": "2016-03-25T10:42:40Z"
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified parameter is not valid. An invalid value is specified for the parameter.
404 InvalidAccessKeyId.NotFound The Access Key ID provided does not exist in our records.
404 Forbidden.KeyNotFound The specified Key is not found. The error message returned because the specified CMK does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.