All Products
Search
Document Center

Key Management Service:ScheduleKeyDeletion

Last Updated:Aug 28, 2026

Schedules the deletion of a CMK. The CMK enters the PendingDeletion state and is deleted after a specified waiting period.

Operation description

During the scheduled period, the CMK is in the PendingDeletion state and cannot be used to encrypt data, decrypt data, or generate data keys.

After a CMK is deleted, it cannot be recovered. Data encrypted by the CMK and data keys generated by the CMK cannot be decrypted. To prevent accidental deletion, KMS supports only scheduled key deletion, not direct deletion. If you want to delete a CMK, call the DisableKey operation to disable the CMK.

You must specify a waiting period of 7 to 366 days. The waiting period starts from the time you submit the request. You can call the CancelKeyDeletion operation to cancel the key deletion task before the waiting period ends.

For details about the required RAM access policy, 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 customer master key (CMK).

7906979c-8e06-46a2-be2d-68e3ccbc****

PendingWindowInDays

integer

Yes

The waiting period before the CMK is deleted. During this period, the CMK is in the PendingDeletion state. After the period ends, the deletion cannot be canceled.

Valid values: 7 to 366.

Unit: days.

7

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

3da5b8cc-8107-40ac-a170-793cd181d7b7

Examples

Success response

JSON format

{
  "RequestId": "3da5b8cc-8107-40ac-a170-793cd181d7b7"
}

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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.