---
title: "POST /#X-Amz-Target=TrentService.CancelKeyDeletion"
method: POST
path: "/#X-Amz-Target=TrentService.CancelKeyDeletion"
---

# POST /#X-Amz-Target=TrentService.CancelKeyDeletion

`POST /#X-Amz-Target=TrentService.CancelKeyDeletion`

Cancels the deletion of a KMS key. When this operation succeeds, the key state of the KMS key is `Disabled`. To enable the KMS key, use EnableKey.

For more information about scheduling and canceling deletion of a KMS key, see [Deleting KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the _Key Management Service Developer Guide_.

The KMS key that you use for this operation must be in a compatible key state. For details, see [Key states of KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the _Key Management Service Developer Guide_.

**Cross-account use**: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

**Required permissions**: [kms:CancelKeyDeletion](https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

**Related operations**: ScheduleKeyDeletion

## Headers

- `X-Amz-Target` 'TrentService.CancelKeyDeletion', required

## Request body

- CancelKeyDeletionRequest
  - `KeyId` string, required — <p>Identifies the KMS key whose deletion is being canceled.</p> <p>Specify the key ID or key ARN of the KMS key.</p> <p>For example:</p> <ul> <li> <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> <li> <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code> </p> </li> </ul> <p>To get the key ID and key ARN for a KMS key, use <a>ListKeys</a> or <a>DescribeKey</a>.</p>

## Response `200`

Success

- CancelKeyDeletionResponse
  - `KeyId` string — The Amazon Resource Name (<a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN">key ARN</a>) of the KMS key whose deletion is canceled.

## Other responses

- `480` — NotFoundException
- `481` — InvalidArnException
- `482` — DependencyTimeoutException
- `483` — KMSInternalException
- `484` — KMSInvalidStateException

---

[API](https://skmtc.net/aws/apis/kms.md) · [All operations](https://skmtc.net/aws/apis/kms/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/kms/versions/f92d678d2025/schema)
