Menu
AWS Secrets Manager API Reference
AWS Secrets Manager API Reference Guide (API Version 2017-10-17)

DescribeSecret

Retrieves the details of a secret. It does not include the encrypted fields. Only those fields that are populated with a value are returned in the response.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:DescribeSecret

Related operations

Request Syntax

{ "SecretId": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

SecretId

The identifier of the secret whose details you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Required: Yes

Response Syntax

{ "ARN": "string", "DeletedDate": number, "Description": "string", "KmsKeyId": "string", "LastAccessedDate": number, "LastChangedDate": number, "LastRotatedDate": number, "Name": "string", "RotationEnabled": boolean, "RotationLambdaARN": "string", "RotationRules": { "AutomaticallyAfterDays": number }, "Tags": [ { "Key": "string", "Value": "string" } ], "VersionIdsToStages": { "string" : [ "string" ] } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

ARN

The ARN of the secret.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

DeletedDate

This value exists if the secret is scheduled for deletion. Some time after the specified date and time, Secrets Manager deletes the secret and all of its versions.

If a secret is scheduled for deletion, then its details, including the encrypted secret information, is not accessible. To cancel a scheduled deletion and restore access, use RestoreSecret.

Type: Timestamp

Description

The user-provided description of the secret.

Type: String

Length Constraints: Maximum length of 2048.

KmsKeyId

The ARN or alias of the AWS KMS customer master key (CMK) that's used to encrypt the SecretString or SecretBinary fields in each version of the secret. If you don't provide a key, then Secrets Manager defaults to encrypting the secret fields with the default AWS KMS CMK (the one named awssecretsmanager) for this account.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 2048.

LastAccessedDate

The last date that this secret was accessed. This value is truncated to midnight of the date and therefore shows only the date, not the time.

Type: Timestamp

LastChangedDate

The last date and time that this secret was modified in any way.

Type: Timestamp

LastRotatedDate

The most recent date and time that the Secrets Manager rotation process was successfully completed. This value is null if the secret has never rotated.

Type: Timestamp

Name

The user-provided friendly name of the secret.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

RotationEnabled

Specifies whether automatic rotation is enabled for this secret.

To enable rotation, use RotateSecret with AutomaticallyRotateAfterDays set to a value greater than 0. To disable rotation, use CancelRotateSecret.

Type: Boolean

RotationLambdaARN

The ARN of a Lambda function that's invoked by Secrets Manager to rotate the secret either automatically per the schedule or manually by a call to RotateSecret.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 2048.

RotationRules

A structure that contains the rotation configuration for this secret.

Type: RotationRulesType object

Tags

The list of user-defined tags that are associated with the secret. To add tags to a secret, use TagResource. To remove tags, use UntagResource.

Type: Array of Tag objects

VersionIdsToStages

A list of all of the currently assigned VersionStage staging labels and the VersionId that each is attached to. Staging labels are used to keep track of the different versions during the rotation process.

Note

A version that does not have any staging labels attached is considered deprecated and subject to deletion. Such versions are not included in this list.

Type: String to array of strings map

Key Length Constraints: Minimum length of 32. Maximum length of 64.

Array Members: Minimum number of 1 item. Maximum number of 20 items.

Length Constraints: Minimum length of 1. Maximum length of 256.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceError

An error occurred on the server side.

HTTP Status Code: 500

ResourceNotFoundException

We can't find the resource that you asked for.

HTTP Status Code: 400

Example

The following example shows how to get the details about a secret. The JSON request string input and response output are shown formatted with white space and line breaks for better readability. Submit your input as a single line JSON string.

Sample Request

POST / HTTP/1.1 Host: secretsmanager.region.domain Accept-Encoding: identity X-Amz-Target: secretsmanager.DescribeSecret Content-Type: application/x-amz-json-1.1 User-Agent: <user-agent-string> X-Amz-Date: <date> Authorization: AWS4-HMAC-SHA256 Credential=<credentials>,SignedHeaders=<headers>, Signature=<signature> Content-Length: <payload-size-bytes> { "SecretId": "MyTestDatabaseSecret" }

Sample Response

HTTP/1.1 200 OK Date: <date> Content-Type: application/x-amz-json-1.1 Content-Length: <response-size-bytes> Connection: keep-alive x-amzn-RequestId: <request-id-guid> { "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3", "Name": "MyTestDatabaseSecret", "Description": "My test database secret created with the CLI", "LastChangedDate": 1523477145.729, "RotationEnabled": true, "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda", "RotationRules": { "AutomaticallyAfterDays": 30 }, "LastRotatedDate": 1525747253.72 "Tags": [ { "Key": "SecondTag", "Value": "AnotherValue" }, { "Key": "FirstTag", "Value": "SomeValue" } ], "VersionIdsToStages": { "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1": [ "AWSPREVIOUS" ], "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2": [ "AWSCURRENT" ] } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: