All Products
Search
Document Center

Key Management Service:DeleteSecret

Last Updated:Jul 29, 2025

Deletes a secret.

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 deleted secret can be recovered within the recovery period. You can also forcibly delete a secret. A forcibly deleted secret cannot be recovered.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
SecretNamestringYes

The name of the secret.

secret001
ForceDeleteWithoutRecoverystringNo

Specifies whether to forcibly delete the secret. If this parameter is set to true, the secret cannot be recovered.

Valid values:

  • true
  • false (default value)
false
RecoveryWindowInDaysstringNo

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

10

Response parameters

ParameterTypeDescriptionExample
object
SecretNamestring

The name of the secret.

secret001
RequestIdstring

The ID of the request, which is used to locate and troubleshoot issues.

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

The time when the secret is scheduled to be deleted.

2022-09-15T07:02:14Z

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameterThe specified parameter is not valid.An invalid value is specified for the parameter.
404Forbidden.ResourceNotFoundResource not found-
404InvalidAccessKeyId.NotFoundThe Access Key ID provided does not exist in our records.-
409Rejected.ResourceInDeleteWindowsecret in delete peroid-
500InternalFailureInternal Failure-

For a list of error codes, visit the Service error codes.