All Products
Search
Document Center

Key Management Service:RestoreSecret

Last Updated:Jul 29, 2025

Restores a deleted secret.

Operation description

You can only use this operation to restore a deleted secret that is within its recovery period. If you set ForceDeleteWithoutRecovery to true when you delete the secret, you cannot restore it.

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 you want to restore.

secret001

Response parameters

ParameterTypeDescriptionExample
object
SecretNamestring

The name of the secret.

secret001
RequestIdstring

The ID of the request.

e4885adf-548f-4ca5-8075-f540bbd3a55f

Examples

Sample success responses

JSONformat

{
  "SecretName": "secret001",
  "RequestId": "e4885adf-548f-4ca5-8075-f540bbd3a55f"
}

Error codes

HTTP status codeError codeError message
400InvalidParametersome of the specified parameters "\" is not valid
403Forbidden.NoPermissionThis operation is forbidden by permission system
404Forbidden.ResourceNotFoundResource not found
409Rejected.ResourceInUserestore normal secret
500InternalFailureInternal Failure

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