All Products
Search
Document Center

Key Management Service:DeleteSecret

Last Updated:Aug 28, 2026

Schedules the deletion of a secret with an optional recovery period during which you can restore it.

Operation description

If you call this operation without specifying a recovery period, the deleted secret can be recovered within 30 days.

If you specify a recovery period, the secret can be recovered within that window. You can also forcibly delete a secret, in which case it cannot be recovered.

For more information about the access policy required for RAM users or RAM roles to call this operation, 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

SecretName

string

Yes

The name of the secret.

secret001

ForceDeleteWithoutRecovery

string

No

Whether to forcibly delete the secret. If set to true, the secret cannot be recovered.

Valid values:

  • true

  • false (default value)

false

RecoveryWindowInDays

string

No

The recovery period of the secret if you do not forcibly delete it. Default value: 30. Unit: days.

10

Response elements

Element

Type

Description

Example

object

SecretName

string

The name of the secret.

secret001

RequestId

string

The request ID.

38bbed2a-15e0-45ad-98d4-816ad2ccf4ea

PlannedDeleteTime

string

The time when the secret is scheduled to be deleted.

2022-09-15T07:02:14Z

Examples

Success response

JSON format

{
  "SecretName": "secret001",
  "RequestId": "38bbed2a-15e0-45ad-98d4-816ad2ccf4ea",
  "PlannedDeleteTime": "2022-09-15T07:02:14Z"
}

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.
500 InternalFailure Internal Failure
404 Forbidden.ResourceNotFound Resource not found
404 InvalidAccessKeyId.NotFound The Access Key ID provided does not exist in our records.
409 Rejected.ResourceInDeleteWindow secret in delete peroid

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.