

# Actions
<a name="API_Operations"></a>

The following actions are supported:
+  [BatchGetSecretValue](API_BatchGetSecretValue.md) 
+  [CancelRotateSecret](API_CancelRotateSecret.md) 
+  [CreateSecret](API_CreateSecret.md) 
+  [DeleteResourcePolicy](API_DeleteResourcePolicy.md) 
+  [DeleteSecret](API_DeleteSecret.md) 
+  [DescribeSecret](API_DescribeSecret.md) 
+  [GetRandomPassword](API_GetRandomPassword.md) 
+  [GetResourcePolicy](API_GetResourcePolicy.md) 
+  [GetSecretValue](API_GetSecretValue.md) 
+  [ListSecrets](API_ListSecrets.md) 
+  [ListSecretVersionIds](API_ListSecretVersionIds.md) 
+  [PutResourcePolicy](API_PutResourcePolicy.md) 
+  [PutSecretValue](API_PutSecretValue.md) 
+  [RemoveRegionsFromReplication](API_RemoveRegionsFromReplication.md) 
+  [ReplicateSecretToRegions](API_ReplicateSecretToRegions.md) 
+  [RestoreSecret](API_RestoreSecret.md) 
+  [RotateSecret](API_RotateSecret.md) 
+  [StopReplicationToReplica](API_StopReplicationToReplica.md) 
+  [TagResource](API_TagResource.md) 
+  [UntagResource](API_UntagResource.md) 
+  [UpdateSecret](API_UpdateSecret.md) 
+  [UpdateSecretVersionStage](API_UpdateSecretVersionStage.md) 
+  [ValidateResourcePolicy](API_ValidateResourcePolicy.md) 

# BatchGetSecretValue
<a name="API_BatchGetSecretValue"></a>

Retrieves the contents of the encrypted fields `SecretString` or `SecretBinary` for up to 20 secrets. To retrieve a single secret, call [GetSecretValue](API_GetSecretValue.md). 

To choose which secrets to retrieve, you can specify a list of secrets by name or ARN, or you can use filters. If Secrets Manager encounters errors such as `AccessDeniedException` while attempting to retrieve any of the secrets, you can see the errors in `Errors` in the response.

Secrets Manager generates CloudTrail `GetSecretValue` log entries for each secret you request when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:BatchGetSecretValue`, and you must have `secretsmanager:GetSecretValue` for each secret. If you use filters, you must also have `secretsmanager:ListSecrets`. If the secrets are encrypted using customer-managed keys instead of the AWS managed key `aws/secretsmanager`, then you also need `kms:Decrypt` permissions for the keys. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_BatchGetSecretValue_RequestSyntax"></a>

```
{
   "Filters": [ 
      { 
         "Key": "string",
         "Values": [ "string" ]
      }
   ],
   "MaxResults": number,
   "NextToken": "string",
   "SecretIdList": [ "string" ]
}
```

## Request Parameters
<a name="API_BatchGetSecretValue_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [Filters](#API_BatchGetSecretValue_RequestSyntax) **   <a name="SecretsManager-BatchGetSecretValue-request-Filters"></a>
The filters to choose which secrets to retrieve. You must include `Filters` or `SecretIdList`, but not both.  
Type: Array of [Filter](API_Filter.md) objects  
Array Members: Maximum number of 10 items.  
Required: No

 ** [MaxResults](#API_BatchGetSecretValue_RequestSyntax) **   <a name="SecretsManager-BatchGetSecretValue-request-MaxResults"></a>
The number of results to include in the response.  
If there are more results available, in the response, Secrets Manager includes `NextToken`. To get the next results, call `BatchGetSecretValue` again with the value from `NextToken`. To use this parameter, you must also use the `Filters` parameter.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 20.  
Required: No

 ** [NextToken](#API_BatchGetSecretValue_RequestSyntax) **   <a name="SecretsManager-BatchGetSecretValue-request-NextToken"></a>
A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call `BatchGetSecretValue` again with this value.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.  
Required: No

 ** [SecretIdList](#API_BatchGetSecretValue_RequestSyntax) **   <a name="SecretsManager-BatchGetSecretValue-request-SecretIdList"></a>
The ARN or names of the secrets to retrieve. You must include `Filters` or `SecretIdList`, but not both.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 20 items.  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: No

## Response Syntax
<a name="API_BatchGetSecretValue_ResponseSyntax"></a>

```
{
   "Errors": [ 
      { 
         "ErrorCode": "string",
         "Message": "string",
         "SecretId": "string"
      }
   ],
   "NextToken": "string",
   "SecretValues": [ 
      { 
         "ARN": "string",
         "CreatedDate": number,
         "Name": "string",
         "SecretBinary": blob,
         "SecretString": "string",
         "VersionId": "string",
         "VersionStages": [ "string" ]
      }
   ]
}
```

## Response Elements
<a name="API_BatchGetSecretValue_ResponseElements"></a>

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

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

 ** [Errors](#API_BatchGetSecretValue_ResponseSyntax) **   <a name="SecretsManager-BatchGetSecretValue-response-Errors"></a>
A list of errors Secrets Manager encountered while attempting to retrieve individual secrets.  
Type: Array of [APIErrorType](API_APIErrorType.md) objects

 ** [NextToken](#API_BatchGetSecretValue_ResponseSyntax) **   <a name="SecretsManager-BatchGetSecretValue-response-NextToken"></a>
Secrets Manager includes this value if there's more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call `BatchGetSecretValue` again with this value.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.

 ** [SecretValues](#API_BatchGetSecretValue_ResponseSyntax) **   <a name="SecretsManager-BatchGetSecretValue-response-SecretValues"></a>
A list of secret values.  
Type: Array of [SecretValueEntry](API_SecretValueEntry.md) objects

## Errors
<a name="API_BatchGetSecretValue_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** DecryptionFailure **   
Secrets Manager can't decrypt the protected secret text using the provided KMS key.   
HTTP Status Code: 400

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidNextTokenException **   
The `NextToken` value is invalid.  
HTTP Status Code: 400

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_BatchGetSecretValue_Examples"></a>

### Example
<a name="API_BatchGetSecretValue_Example_1"></a>

The following example shows how to retrieve the secret values for a group of secrets listed by name. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_BatchGetSecretValue_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.BatchGetSecretValue
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>

{
  "SecretIdList": ["MySecret1", "MySecret2", "MySecret3"]
}
```

#### Sample Response
<a name="API_BatchGetSecretValue_Example_1_Response"></a>

```
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>

  {
    "Errors":[],
    "SecretValues":
      [
        {
          "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret1-a1b2c3",
          "CreatedDate":1.700591229801E9,
          "Name":"MySecret1",
          "SecretString":"{\"username\":\"diego_ramirez\",\"password\":\"EXAMPLE-PASSWORD\",\"engine\":\"mysql\",\"host\":\"secretsmanagertutorial.cluster.us-west-2.rds.amazonaws.com\",\"port\":3306,\"dbClusterIdentifier\":\"secretsmanagertutorial\"}",
          "VersionId":"a1b2c3d4-5678-90ab-cdef-EXAMPLEaaaaa",
          "VersionStages": ["AWSCURRENT"]
        },
        {
          "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret2-a1b2c3",
          "CreatedDate":1.699911394105E9,
          "Name":"MySecret2",
          "SecretString":"{\"username\":\"akua_mansa\",\"password\":\"EXAMPLE-PASSWORD\"",
          "VersionId":"a1b2c3d4-5678-90ab-cdef-EXAMPLEbbbbb",
          "VersionStages":["AWSCURRENT"]
        },
        {
          "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret3-a1b2c3",
          "CreatedDate":1.699911394105E9,
          "Name":"MySecret3",
          "SecretString":"{\"username\":\"jie_liu\",\"password\":\"EXAMPLE-PASSWORD\"",
          "VersionId":"a1b2c3d4-5678-90ab-cdef-EXAMPLEccccc",
          "VersionStages":["AWSCURRENT"]
        }
      ]
    }
```

## See Also
<a name="API_BatchGetSecretValue_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/BatchGetSecretValue) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/BatchGetSecretValue) 

# CancelRotateSecret
<a name="API_CancelRotateSecret"></a>

Turns off automatic rotation, and if a rotation is currently in progress, cancels the rotation.

If you cancel a rotation in progress, it can leave the `VersionStage` labels in an unexpected state. You might need to remove the staging label `AWSPENDING` from the partially created version. You also need to determine whether to roll back to the previous version of the secret by moving the staging label `AWSCURRENT` to the version that has `AWSPENDING`. To determine which version has a specific staging label, call [ListSecretVersionIds](API_ListSecretVersionIds.md). Then use [UpdateSecretVersionStage](API_UpdateSecretVersionStage.md) to change staging labels. For more information, see [How rotation works](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html).

To turn on automatic rotation again, call [RotateSecret](API_RotateSecret.md).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:CancelRotateSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_CancelRotateSecret_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_CancelRotateSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_CancelRotateSecret_RequestSyntax) **   <a name="SecretsManager-CancelRotateSecret-request-SecretId"></a>
The ARN or name of the secret.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_CancelRotateSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "VersionId": "string"
}
```

## Response Elements
<a name="API_CancelRotateSecret_ResponseElements"></a>

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](#API_CancelRotateSecret_ResponseSyntax) **   <a name="SecretsManager-CancelRotateSecret-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_CancelRotateSecret_ResponseSyntax) **   <a name="SecretsManager-CancelRotateSecret-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [VersionId](#API_CancelRotateSecret_ResponseSyntax) **   <a name="SecretsManager-CancelRotateSecret-response-VersionId"></a>
The unique identifier of the version of the secret created during the rotation. This version might not be complete, and should be evaluated for possible deletion. We recommend that you remove the `VersionStage` value `AWSPENDING` from this version so that Secrets Manager can delete it. Failing to clean up a cancelled rotation can block you from starting future rotations.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

## Errors
<a name="API_CancelRotateSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_CancelRotateSecret_Examples"></a>

### Example
<a name="API_CancelRotateSecret_Example_1"></a>

The following example shows how to cancel rotation for a secret.

#### Sample Request
<a name="API_CancelRotateSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.CancelRotateSecret
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
<a name="API_CancelRotateSecret_Example_1_Response"></a>

```
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"
}
```

## See Also
<a name="API_CancelRotateSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/CancelRotateSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/CancelRotateSecret) 

# CreateSecret
<a name="API_CreateSecret"></a>

Creates a new secret. A *secret* can be a password, a set of credentials such as a user name and password, an OAuth token, or other secret information that you store in an encrypted form in Secrets Manager. The secret also includes the connection information to access a database or other service, which Secrets Manager doesn't encrypt. A secret in Secrets Manager consists of both the protected secret data and the important information needed to manage the secret.

For secrets that use *managed rotation*, you need to create the secret through the managing service. For more information, see [Secrets Manager secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html). 

For information about creating a secret in the console, see [Create a secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html).

To create a secret, you can provide the secret value to be encrypted in either the `SecretString` parameter or the `SecretBinary` parameter, but not both. If you include `SecretString` or `SecretBinary` then Secrets Manager creates an initial secret version and automatically attaches the staging label `AWSCURRENT` to it.

For database credentials you want to rotate, for Secrets Manager to be able to rotate the secret, you must make sure the JSON you store in the `SecretString` matches the [JSON structure of a database secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_secret_json_structure.html).

If you don't specify an AWS KMS encryption key, Secrets Manager uses the AWS managed key `aws/secretsmanager`. If this key doesn't already exist in your account, then Secrets Manager creates it for you automatically. All users and roles in the AWS account automatically have access to use `aws/secretsmanager`. Creating `aws/secretsmanager` can result in a one-time significant delay in returning the result.

If the secret is in a different AWS account from the credentials calling the API, then you can't use `aws/secretsmanager` to encrypt the secret, and you must create and use a customer managed AWS KMS key. 

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters except `SecretBinary` or `SecretString` because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:CreateSecret`. If you include tags in the secret, you also need `secretsmanager:TagResource`. To add replica Regions, you must also have `secretsmanager:ReplicateSecretToRegions`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

To encrypt the secret with a KMS key other than `aws/secretsmanager`, you need `kms:GenerateDataKey` and `kms:Decrypt` permission to the key. 

**Important**  
When you enter commands in a command shell, there is a risk of the command history being accessed or utilities having access to your command parameters. This is a concern if the command includes the value of a secret. Learn how to [Mitigate the risks of using command-line tools to store AWS Secrets Manager secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/security_cli-exposure-risks.html).

## Request Syntax
<a name="API_CreateSecret_RequestSyntax"></a>

```
{
   "AddReplicaRegions": [ 
      { 
         "KmsKeyId": "string",
         "Region": "string"
      }
   ],
   "ClientRequestToken": "string",
   "Description": "string",
   "ForceOverwriteReplicaSecret": boolean,
   "KmsKeyId": "string",
   "Name": "string",
   "SecretBinary": blob,
   "SecretString": "string",
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "Type": "string"
}
```

## Request Parameters
<a name="API_CreateSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [AddReplicaRegions](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-AddReplicaRegions"></a>
A list of Regions and AWS KMS keys to replicate secrets.  
Type: Array of [ReplicaRegionType](API_ReplicaRegionType.md) objects  
Array Members: Minimum number of 1 item.  
Required: No

 ** [ClientRequestToken](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-ClientRequestToken"></a>
If you include `SecretString` or `SecretBinary`, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.   
If you use the AWS CLI or one of the AWS SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request. 
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a `ClientRequestToken` and include it in the request.  
This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a [UUID-type](https://wikipedia.org/wiki/Universally_unique_identifier) value to ensure uniqueness of your versions within the specified secret.   
+ If the `ClientRequestToken` value isn't already associated with a version of the secret then a new version of the secret is created. 
+ If a version with this value already exists and the version `SecretString` and `SecretBinary` values are the same as those in the request, then the request is ignored.
+ If a version with this value already exists and that version's `SecretString` and `SecretBinary` values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use [PutSecretValue](API_PutSecretValue.md) to create a new version.
This value becomes the `VersionId` of the new version.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [Description](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-Description"></a>
The description of the secret.  
Type: String  
Length Constraints: Maximum length of 2048.  
Required: No

 ** [ForceOverwriteReplicaSecret](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-ForceOverwriteReplicaSecret"></a>
Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.  
Type: Boolean  
Required: No

 ** [KmsKeyId](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-KmsKeyId"></a>
The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by `alias/`, for example `alias/aws/secretsmanager`. For more information, see [About aliases](https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html).  
To use a AWS KMS key in a different account, use the key ARN or the alias ARN.  
If you don't specify this value, then Secrets Manager uses the key `aws/secretsmanager`. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.  
If the secret is in a different AWS account from the credentials calling the API, then you can't use `aws/secretsmanager` to encrypt the secret, and you must create and use a customer managed AWS KMS key.   
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Required: No

 ** [Name](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-Name"></a>
The name of the new secret.  
The secret name can contain ASCII letters, numbers, and the following characters: /\$1\$1=.@-  
Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 512.  
Required: Yes

 ** [SecretBinary](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-SecretBinary"></a>
The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.  
Either `SecretString` or `SecretBinary` must have a value, but not both.  
This parameter is not available in the Secrets Manager console.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: Base64-encoded binary data object  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [SecretString](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-SecretString"></a>
The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.  
Either `SecretString` or `SecretBinary` must have a value, but not both.  
If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the `SecretString` parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [Tags](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-Tags"></a>
A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:  
 `[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}]`   
Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".  
If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an `Access Denied` error. For more information, see [Control access to secrets using tags](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac) and [Limit access to identities with tags that match secrets' tags](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2).  
For information about how to format a JSON parameter for the various command line tool environments, see [Using JSON for Parameters](https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json). If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.  
For tag quotas and naming restrictions, see [Service quotas for Tagging](https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas) in the * AWS General Reference guide*.  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

 ** [Type](#API_CreateSecret_RequestSyntax) **   <a name="SecretsManager-CreateSecret-request-Type"></a>
The exact string that identifies the partner that holds the external secret. For more information, see [Using Secrets Manager managed external secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html).  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 256.  
Required: No

## Response Syntax
<a name="API_CreateSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "ReplicationStatus": [ 
      { 
         "KmsKeyId": "string",
         "LastAccessedDate": number,
         "Region": "string",
         "Status": "string",
         "StatusMessage": "string"
      }
   ],
   "VersionId": "string"
}
```

## Response Elements
<a name="API_CreateSecret_ResponseElements"></a>

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](#API_CreateSecret_ResponseSyntax) **   <a name="SecretsManager-CreateSecret-response-ARN"></a>
The ARN of the new secret. The ARN includes the name of the secret followed by six random characters. This ensures that if you create a new secret with the same name as a deleted secret, then users with access to the old secret don't get access to the new secret because the ARNs are different.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_CreateSecret_ResponseSyntax) **   <a name="SecretsManager-CreateSecret-response-Name"></a>
The name of the new secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [ReplicationStatus](#API_CreateSecret_ResponseSyntax) **   <a name="SecretsManager-CreateSecret-response-ReplicationStatus"></a>
A list of the replicas of this secret and their status:  
+  `Failed`, which indicates that the replica was not created.
+  `InProgress`, which indicates that Secrets Manager is in the process of creating the replica.
+  `InSync`, which indicates that the replica was created.
Type: Array of [ReplicationStatusType](API_ReplicationStatusType.md) objects

 ** [VersionId](#API_CreateSecret_ResponseSyntax) **   <a name="SecretsManager-CreateSecret-response-VersionId"></a>
The unique identifier associated with the version of the new secret.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

## Errors
<a name="API_CreateSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** DecryptionFailure **   
Secrets Manager can't decrypt the protected secret text using the provided KMS key.   
HTTP Status Code: 400

 ** EncryptionFailure **   
Secrets Manager can't encrypt the protected secret text using the provided KMS key. Check that the KMS key is available, enabled, and not in an invalid state. For more information, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).  
HTTP Status Code: 400

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** LimitExceededException **   
The request failed because it would exceed one of the Secrets Manager quotas.  
HTTP Status Code: 400

 ** MalformedPolicyDocumentException **   
The resource policy has syntax errors.  
HTTP Status Code: 400

 ** PreconditionNotMetException **   
The request failed because you did not complete all the prerequisite steps.  
HTTP Status Code: 400

 ** ResourceExistsException **   
A resource with the ID you requested already exists.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_CreateSecret_Examples"></a>

### Example
<a name="API_CreateSecret_Example_1"></a>

The following example shows how to create a secret. Secrets Manager retrieves the credentials stored in the encrypted secret value from a file on disk named mycreds.json. For an example of mycreds.json, see [Creating a secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html#proc-create-api). The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_CreateSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.CreateSecret
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>

{
  "Name": "MyTestDatabaseSecret",
  "Description": "My test database secret created with the CLI",
  "SecretString": "{\"username\":\"david\",\"password\":\"EXAMPLE-PASSWORD\"}", "ClientRequestToken": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

#### Sample Response
<a name="API_CreateSecret_Example_1_Response"></a>

```
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",
  "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

## See Also
<a name="API_CreateSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/CreateSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/CreateSecret) 

# DeleteResourcePolicy
<a name="API_DeleteResourcePolicy"></a>

Deletes the resource-based permission policy attached to the secret. To attach a policy to a secret, use [PutResourcePolicy](API_PutResourcePolicy.md).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:DeleteResourcePolicy`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_DeleteResourcePolicy_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_DeleteResourcePolicy_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_DeleteResourcePolicy_RequestSyntax) **   <a name="SecretsManager-DeleteResourcePolicy-request-SecretId"></a>
The ARN or name of the secret to delete the attached resource-based policy for.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_DeleteResourcePolicy_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string"
}
```

## Response Elements
<a name="API_DeleteResourcePolicy_ResponseElements"></a>

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](#API_DeleteResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-DeleteResourcePolicy-response-ARN"></a>
The ARN of the secret that the resource-based policy was deleted for.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_DeleteResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-DeleteResourcePolicy-response-Name"></a>
The name of the secret that the resource-based policy was deleted for.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 512.

## Errors
<a name="API_DeleteResourcePolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_DeleteResourcePolicy_Examples"></a>

### Example
<a name="API_DeleteResourcePolicy_Example_1"></a>

The following example shows how to delete the resource-based policy that's attached to a secret.The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_DeleteResourcePolicy_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.DeleteResourcePolicy
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
<a name="API_DeleteResourcePolicy_Example_1_Response"></a>

```
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"
}
```

## See Also
<a name="API_DeleteResourcePolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/DeleteResourcePolicy) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/DeleteResourcePolicy) 

# DeleteSecret
<a name="API_DeleteSecret"></a>

Deletes a secret and all of its versions. You can specify a recovery window during which you can restore the secret. The minimum recovery window is 7 days. The default recovery window is 30 days. Secrets Manager attaches a `DeletionDate` stamp to the secret that specifies the end of the recovery window. At the end of the recovery window, Secrets Manager deletes the secret permanently.

You can't delete a primary secret that is replicated to other Regions. You must first delete the replicas using [RemoveRegionsFromReplication](API_RemoveRegionsFromReplication.md), and then delete the primary secret. When you delete a replica, it is deleted immediately.

You can't directly delete a version of a secret. Instead, you remove all staging labels from the version using [UpdateSecretVersionStage](API_UpdateSecretVersionStage.md). This marks the version as deprecated, and then Secrets Manager can automatically delete the version in the background.

To determine whether an application still uses a secret, you can create an Amazon CloudWatch alarm to alert you to any attempts to access a secret during the recovery window. For more information, see [ Monitor secrets scheduled for deletion](https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring_cloudwatch_deleted-secrets.html).

Secrets Manager performs the permanent secret deletion at the end of the waiting period as a background task with low priority. There is no guarantee of a specific time after the recovery window for the permanent delete to occur.

At any time before recovery window ends, you can use [RestoreSecret](API_RestoreSecret.md) to remove the `DeletionDate` and cancel the deletion of the secret.

When a secret is scheduled for deletion, you cannot retrieve the secret value. You must first cancel the deletion with [RestoreSecret](API_RestoreSecret.md) and then you can retrieve the secret.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:DeleteSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_DeleteSecret_RequestSyntax"></a>

```
{
   "ForceDeleteWithoutRecovery": boolean,
   "RecoveryWindowInDays": number,
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_DeleteSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ForceDeleteWithoutRecovery](#API_DeleteSecret_RequestSyntax) **   <a name="SecretsManager-DeleteSecret-request-ForceDeleteWithoutRecovery"></a>
Specifies whether to delete the secret without any recovery window. You can't use both this parameter and `RecoveryWindowInDays` in the same call. If you don't use either, then by default Secrets Manager uses a 30 day recovery window.  
Secrets Manager performs the actual deletion with an asynchronous background process, so there might be a short delay before the secret is permanently deleted. If you delete a secret and then immediately create a secret with the same name, use appropriate back off and retry logic.  
If you forcibly delete an already deleted or nonexistent secret, the operation does not return `ResourceNotFoundException`.  
Use this parameter with caution. This parameter causes the operation to skip the normal recovery window before the permanent deletion that Secrets Manager would normally impose with the `RecoveryWindowInDays` parameter. If you delete a secret with the `ForceDeleteWithoutRecovery` parameter, then you have no opportunity to recover the secret. You lose the secret permanently.
Type: Boolean  
Required: No

 ** [RecoveryWindowInDays](#API_DeleteSecret_RequestSyntax) **   <a name="SecretsManager-DeleteSecret-request-RecoveryWindowInDays"></a>
The number of days from 7 to 30 that Secrets Manager waits before permanently deleting the secret. You can't use both this parameter and `ForceDeleteWithoutRecovery` in the same call. If you don't use either, then by default Secrets Manager uses a 30 day recovery window.  
Type: Long  
Required: No

 ** [SecretId](#API_DeleteSecret_RequestSyntax) **   <a name="SecretsManager-DeleteSecret-request-SecretId"></a>
The ARN or name of the secret to delete.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_DeleteSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "DeletionDate": number,
   "Name": "string"
}
```

## Response Elements
<a name="API_DeleteSecret_ResponseElements"></a>

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](#API_DeleteSecret_ResponseSyntax) **   <a name="SecretsManager-DeleteSecret-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [DeletionDate](#API_DeleteSecret_ResponseSyntax) **   <a name="SecretsManager-DeleteSecret-response-DeletionDate"></a>
The date and time after which this secret Secrets Manager can permanently delete this secret, and it can no longer be restored. This value is the date and time of the delete request plus the number of days in `RecoveryWindowInDays`.  
Type: Timestamp

 ** [Name](#API_DeleteSecret_ResponseSyntax) **   <a name="SecretsManager-DeleteSecret-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

## Errors
<a name="API_DeleteSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_DeleteSecret_Examples"></a>

### Example
<a name="API_DeleteSecret_Example_1"></a>

The following example shows how to delete a secret with a recovery window of 7 days. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_DeleteSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.DeleteSecret
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",
  "RecoveryWindowInDays": 7
}
```

#### Sample Response
<a name="API_DeleteSecret_Example_1_Response"></a>

```
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",
  "DeletionDate":1.524085349095E9,
  "Name":"MyTestDatabaseSecret"
}
```

## See Also
<a name="API_DeleteSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/DeleteSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/DeleteSecret) 

# DescribeSecret
<a name="API_DescribeSecret"></a>

Retrieves the details of a secret. It does not include the encrypted secret value. Secrets Manager only returns fields that have a value in the response. 

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:DescribeSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_DescribeSecret_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_DescribeSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_DescribeSecret_RequestSyntax) **   <a name="SecretsManager-DescribeSecret-request-SecretId"></a>
The ARN or name of the secret.   
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_DescribeSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "CreatedDate": number,
   "DeletedDate": number,
   "Description": "string",
   "ExternalSecretRotationMetadata": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "ExternalSecretRotationRoleArn": "string",
   "KmsKeyId": "string",
   "LastAccessedDate": number,
   "LastChangedDate": number,
   "LastRotatedDate": number,
   "Name": "string",
   "NextRotationDate": number,
   "OwningService": "string",
   "PrimaryRegion": "string",
   "ReplicationStatus": [ 
      { 
         "KmsKeyId": "string",
         "LastAccessedDate": number,
         "Region": "string",
         "Status": "string",
         "StatusMessage": "string"
      }
   ],
   "RotationEnabled": boolean,
   "RotationLambdaARN": "string",
   "RotationRules": { 
      "AutomaticallyAfterDays": number,
      "Duration": "string",
      "ScheduleExpression": "string"
   },
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "Type": "string",
   "VersionIdsToStages": { 
      "string" : [ "string" ]
   }
}
```

## Response Elements
<a name="API_DescribeSecret_ResponseElements"></a>

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](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [CreatedDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-CreatedDate"></a>
The date the secret was created.  
Type: Timestamp

 ** [DeletedDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-DeletedDate"></a>
The date the secret is scheduled for deletion. If it is not scheduled for deletion, this field is omitted. When you delete a secret, Secrets Manager requires a recovery window of at least 7 days before deleting the secret. Some time after the deleted date, Secrets Manager deletes the secret, including all of its versions.  
If a secret is scheduled for deletion, then its details, including the encrypted secret value, is not accessible. To cancel a scheduled deletion and restore access to the secret, use [RestoreSecret](API_RestoreSecret.md).  
Type: Timestamp

 ** [Description](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-Description"></a>
The description of the secret.  
Type: String  
Length Constraints: Maximum length of 2048.

 ** [ExternalSecretRotationMetadata](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-ExternalSecretRotationMetadata"></a>
The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner. For more information about the required information, see [Managed external secrets partners](https://docs.aws.amazon.com/secretsmanager/latest/userguide/mes-partners.html).  
Type: Array of [ExternalSecretRotationMetadataItem](API_ExternalSecretRotationMetadataItem.md) objects

 ** [ExternalSecretRotationRoleArn](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-ExternalSecretRotationRoleArn"></a>
The Amazon Resource Name (ARN) of the role that allows Secrets Manager to rotate a secret held by a third-party partner. For more information, see [Security and permissions](https://docs.aws.amazon.com/secretsmanager/latest/userguide/mes-security.html).  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [KmsKeyId](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-KmsKeyId"></a>
The key ID or alias ARN of the AWS KMS key that Secrets Manager uses to encrypt the secret value. If the secret is encrypted with the AWS managed key `aws/secretsmanager`, this field is omitted. Secrets created using the console use an AWS KMS key ID.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.

 ** [LastAccessedDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-LastAccessedDate"></a>
The date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.  
Type: Timestamp

 ** [LastChangedDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-LastChangedDate"></a>
The last date and time that this secret was modified in any way.  
Type: Timestamp

 ** [LastRotatedDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-LastRotatedDate"></a>
The last date and time that Secrets Manager rotated the secret. If the secret isn't configured for rotation or rotation has been disabled, Secrets Manager returns null.  
Type: Timestamp

 ** [Name](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [NextRotationDate](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-NextRotationDate"></a>
The next rotation is scheduled to occur on or before this date. If the secret isn't configured for rotation or rotation has been disabled, Secrets Manager returns null. If rotation fails, Secrets Manager retries the entire rotation process multiple times. If rotation is unsuccessful, this date may be in the past.  
This date represents the latest date that rotation will occur, but it is not an approximate rotation date. In some cases, for example if you turn off automatic rotation and then turn it back on, the next rotation may occur much sooner than this date.  
Type: Timestamp

 ** [OwningService](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-OwningService"></a>
The ID of the service that created this secret. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.

 ** [PrimaryRegion](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-PrimaryRegion"></a>
The Region the secret is in. If a secret is replicated to other Regions, the replicas are listed in `ReplicationStatus`.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `^([a-z]+-)+\d+$` 

 ** [ReplicationStatus](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-ReplicationStatus"></a>
A list of the replicas of this secret and their status:   
+  `Failed`, which indicates that the replica was not created.
+  `InProgress`, which indicates that Secrets Manager is in the process of creating the replica.
+  `InSync`, which indicates that the replica was created.
Type: Array of [ReplicationStatusType](API_ReplicationStatusType.md) objects

 ** [RotationEnabled](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-RotationEnabled"></a>
Specifies whether automatic rotation is turned on for this secret. If the secret has never been configured for rotation, Secrets Manager returns null.  
To turn on rotation, use [RotateSecret](API_RotateSecret.md). To turn off rotation, use [CancelRotateSecret](API_CancelRotateSecret.md).  
Type: Boolean

 ** [RotationLambdaARN](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-RotationLambdaARN"></a>
The ARN of the Lambda function that Secrets Manager invokes to rotate the secret.   
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.

 ** [RotationRules](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-RotationRules"></a>
The rotation schedule and Lambda function for this secret. If the secret previously had rotation turned on, but it is now turned off, this field shows the previous rotation schedule and rotation function. If the secret never had rotation turned on, this field is omitted.  
Type: [RotationRulesType](API_RotationRulesType.md) object

 ** [Tags](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-Tags"></a>
The list of tags attached to the secret. To add tags to a secret, use [TagResource](API_TagResource.md). To remove tags, use [UntagResource](API_UntagResource.md).  
Type: Array of [Tag](API_Tag.md) objects

 ** [Type](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-Type"></a>
The exact string that identifies the partner that holds the external secret. For more information, see [Using Secrets Manager managed external secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html).  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 256.

 ** [VersionIdsToStages](#API_DescribeSecret_ResponseSyntax) **   <a name="SecretsManager-DescribeSecret-response-VersionIdsToStages"></a>
A list of the versions of the secret that have staging labels attached. Versions that don't have staging labels are considered deprecated and Secrets Manager can delete them.  
Secrets Manager uses staging labels to indicate the status of a secret version during rotation. The three staging labels for rotation are:   
+  `AWSCURRENT`, which indicates the current version of the secret.
+  `AWSPENDING`, which indicates the version of the secret that contains new secret information that will become the next current version when rotation finishes.

  During rotation, Secrets Manager creates an `AWSPENDING` version ID before creating the new secret version. To check if a secret version exists, call [GetSecretValue](API_GetSecretValue.md).
+  `AWSPREVIOUS`, which indicates the previous current version of the secret. You can use this as the *last known good* version.
For more information about rotation and staging labels, see [How rotation works](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html).  
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
<a name="API_DescribeSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_DescribeSecret_Examples"></a>

### Example
<a name="API_DescribeSecret_Example_1"></a>

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

#### Sample Request
<a name="API_DescribeSecret_Example_1_Request"></a>

```
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
<a name="API_DescribeSecret_Example_1_Response"></a>

```
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,
  "LastAccessedDate": 1606269226,
  "RotationEnabled": true,
  "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda",
  "RotationRules": {
    "AutomaticallyAfterDays": 14,
    "ScheduleExpression": "cron(0 16 1,15 * ? *)",
    "Duration": "2h"
  },
  "LastRotatedDate": 1525747253.72,
  "NextRotationDate": 1665165599000,
  "Tags": [
    {
      "Key": "SecondTag",
      "Value": "AnotherValue"
    },
    {
      "Key": "FirstTag",
      "Value": "SomeValue"
    }
  ],
  "VersionIdsToStages": {
    "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1": [
      "AWSPREVIOUS"
    ],
    "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2": [
      "AWSCURRENT"
    ]
  }
}
```

## See Also
<a name="API_DescribeSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/DescribeSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/DescribeSecret) 

# GetRandomPassword
<a name="API_GetRandomPassword"></a>

Generates a random password. We recommend that you specify the maximum length and include every character type that the system you are generating a password for can support. By default, Secrets Manager uses uppercase and lowercase letters, numbers, and the following characters in passwords: `!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~` 

Secrets Manager generates a CloudTrail log entry when you call this action.

 **Required permissions: ** `secretsmanager:GetRandomPassword`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_GetRandomPassword_RequestSyntax"></a>

```
{
   "ExcludeCharacters": "string",
   "ExcludeLowercase": boolean,
   "ExcludeNumbers": boolean,
   "ExcludePunctuation": boolean,
   "ExcludeUppercase": boolean,
   "IncludeSpace": boolean,
   "PasswordLength": number,
   "RequireEachIncludedType": boolean
}
```

## Request Parameters
<a name="API_GetRandomPassword_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ExcludeCharacters](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-ExcludeCharacters"></a>
A string of the characters that you don't want in the password.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 4096.  
Required: No

 ** [ExcludeLowercase](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-ExcludeLowercase"></a>
Specifies whether to exclude lowercase letters from the password. If you don't include this switch, the password can contain lowercase letters.  
Type: Boolean  
Required: No

 ** [ExcludeNumbers](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-ExcludeNumbers"></a>
Specifies whether to exclude numbers from the password. If you don't include this switch, the password can contain numbers.  
Type: Boolean  
Required: No

 ** [ExcludePunctuation](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-ExcludePunctuation"></a>
Specifies whether to exclude the following punctuation characters from the password: `! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~`. If you don't include this switch, the password can contain punctuation.  
Type: Boolean  
Required: No

 ** [ExcludeUppercase](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-ExcludeUppercase"></a>
Specifies whether to exclude uppercase letters from the password. If you don't include this switch, the password can contain uppercase letters.  
Type: Boolean  
Required: No

 ** [IncludeSpace](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-IncludeSpace"></a>
Specifies whether to include the space character. If you include this switch, the password can contain space characters.  
Type: Boolean  
Required: No

 ** [PasswordLength](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-PasswordLength"></a>
The length of the password. If you don't include this parameter, the default length is 32 characters.  
Type: Long  
Valid Range: Minimum value of 1. Maximum value of 4096.  
Required: No

 ** [RequireEachIncludedType](#API_GetRandomPassword_RequestSyntax) **   <a name="SecretsManager-GetRandomPassword-request-RequireEachIncludedType"></a>
Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation. If you don't include this switch, the password contains at least one of every character type.  
Type: Boolean  
Required: No

## Response Syntax
<a name="API_GetRandomPassword_ResponseSyntax"></a>

```
{
   "RandomPassword": "string"
}
```

## Response Elements
<a name="API_GetRandomPassword_ResponseElements"></a>

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

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

 ** [RandomPassword](#API_GetRandomPassword_ResponseSyntax) **   <a name="SecretsManager-GetRandomPassword-response-RandomPassword"></a>
A string with the password.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 4096.

## Errors
<a name="API_GetRandomPassword_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

## Examples
<a name="API_GetRandomPassword_Examples"></a>

### Example
<a name="API_GetRandomPassword_Example_1"></a>

The following example shows how to request a randomly generated password of 20 characters.

#### Sample Request
<a name="API_GetRandomPassword_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.GetRandomPassword
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>

{
  "PasswordLength": 20
}
```

#### Sample Response
<a name="API_GetRandomPassword_Example_1_Response"></a>

```
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>

{
  "RandomPassword":"N+Z43a,>vx7j O8^*<8i3"
}
```

## See Also
<a name="API_GetRandomPassword_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/GetRandomPassword) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/GetRandomPassword) 

# GetResourcePolicy
<a name="API_GetResourcePolicy"></a>

Retrieves the JSON text of the resource-based policy document attached to the secret. For more information about permissions policies attached to a secret, see [Permissions policies attached to a secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-policies.html).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:GetResourcePolicy`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_GetResourcePolicy_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_GetResourcePolicy_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_GetResourcePolicy_RequestSyntax) **   <a name="SecretsManager-GetResourcePolicy-request-SecretId"></a>
The ARN or name of the secret to retrieve the attached resource-based policy for.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_GetResourcePolicy_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "ResourcePolicy": "string"
}
```

## Response Elements
<a name="API_GetResourcePolicy_ResponseElements"></a>

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](#API_GetResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-GetResourcePolicy-response-ARN"></a>
The ARN of the secret that the resource-based policy was retrieved for.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_GetResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-GetResourcePolicy-response-Name"></a>
The name of the secret that the resource-based policy was retrieved for.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 512.

 ** [ResourcePolicy](#API_GetResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-GetResourcePolicy-response-ResourcePolicy"></a>
A JSON-formatted string that contains the permissions policy attached to the secret. For more information about permissions policies, see [Authentication and access control for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 20480.

## Errors
<a name="API_GetResourcePolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_GetResourcePolicy_Examples"></a>

### Example
<a name="API_GetResourcePolicy_Example_1"></a>

The following example shows how to retrieve the resource-based policy attached to a secret. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_GetResourcePolicy_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.GetResourcePolicy
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
<a name="API_GetResourcePolicy_Example_1_Response"></a>

```
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",
  "ResourcePolicy": "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::111122223333:root\",\"arn:aws:iam::444455556666:root\"]},\"Action\":[\"secretsmanager:GetSecretValue\"],\"Resource\":\"*\"}}"
}
```

## See Also
<a name="API_GetResourcePolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/GetResourcePolicy) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/GetResourcePolicy) 

# GetSecretValue
<a name="API_GetSecretValue"></a>

Retrieves the contents of the encrypted fields `SecretString` or `SecretBinary` from the specified version of a secret, whichever contains content.

To retrieve the values for a group of secrets, call [BatchGetSecretValue](API_BatchGetSecretValue.md).

We recommend that you cache your secret values by using client-side caching. Caching secrets improves speed and reduces your costs. For more information, see [Cache secrets for your applications](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets.html).

To retrieve the previous version of a secret, use `VersionStage` and specify AWSPREVIOUS. To revert to the previous version of a secret, call [UpdateSecretVersionStage](https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/update-secret-version-stage.html).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:GetSecretValue`. If the secret is encrypted using a customer-managed key instead of the AWS managed key `aws/secretsmanager`, then you also need `kms:Decrypt` permissions for that key. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_GetSecretValue_RequestSyntax"></a>

```
{
   "SecretId": "string",
   "VersionId": "string",
   "VersionStage": "string"
}
```

## Request Parameters
<a name="API_GetSecretValue_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_GetSecretValue_RequestSyntax) **   <a name="SecretsManager-GetSecretValue-request-SecretId"></a>
The ARN or name of the secret to retrieve. To retrieve a secret from another account, you must use an ARN.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [VersionId](#API_GetSecretValue_RequestSyntax) **   <a name="SecretsManager-GetSecretValue-request-VersionId"></a>
The unique identifier of the version of the secret to retrieve. If you include both this parameter and `VersionStage`, the two parameters must refer to the same secret version. If you don't specify either a `VersionStage` or `VersionId`, then Secrets Manager returns the `AWSCURRENT` version.  
This value is typically a [UUID-type](https://wikipedia.org/wiki/Universally_unique_identifier) value with 32 hexadecimal digits.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [VersionStage](#API_GetSecretValue_RequestSyntax) **   <a name="SecretsManager-GetSecretValue-request-VersionStage"></a>
The staging label of the version of the secret to retrieve.   
Secrets Manager uses staging labels to keep track of different versions during the rotation process. If you include both this parameter and `VersionId`, the two parameters must refer to the same secret version. If you don't specify either a `VersionStage` or `VersionId`, Secrets Manager returns the `AWSCURRENT` version.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Required: No

## Response Syntax
<a name="API_GetSecretValue_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "CreatedDate": number,
   "Name": "string",
   "SecretBinary": blob,
   "SecretString": "string",
   "VersionId": "string",
   "VersionStages": [ "string" ]
}
```

## Response Elements
<a name="API_GetSecretValue_ResponseElements"></a>

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](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [CreatedDate](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-CreatedDate"></a>
The date and time that this version of the secret was created. If you don't specify which version in `VersionId` or `VersionStage`, then Secrets Manager uses the `AWSCURRENT` version.  
Type: Timestamp

 ** [Name](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-Name"></a>
The friendly name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [SecretBinary](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-SecretBinary"></a>
The decrypted secret value, if the secret value was originally provided as binary data in the form of a byte array. When you retrieve a `SecretBinary` using the HTTP API, the Python SDK, or the AWS CLI, the value is Base64-encoded. Otherwise, it is not encoded.  
If the secret was created by using the Secrets Manager console, or if the secret value was originally provided as a string, then this field is omitted. The secret value appears in `SecretString` instead.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: Base64-encoded binary data object  
Length Constraints: Minimum length of 1. Maximum length of 65536.

 ** [SecretString](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-SecretString"></a>
The decrypted secret value, if the secret value was originally provided as a string or through the Secrets Manager console.  
If this secret was created by using the console, then Secrets Manager stores the information as a JSON structure of key/value pairs.   
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 65536.

 ** [VersionId](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-VersionId"></a>
The unique identifier of this version of the secret.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

 ** [VersionStages](#API_GetSecretValue_ResponseSyntax) **   <a name="SecretsManager-GetSecretValue-response-VersionStages"></a>
A list of all of the staging labels currently attached to this version of the secret.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 20 items.  
Length Constraints: Minimum length of 1. Maximum length of 256.

## Errors
<a name="API_GetSecretValue_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** DecryptionFailure **   
Secrets Manager can't decrypt the protected secret text using the provided KMS key.   
HTTP Status Code: 400

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_GetSecretValue_Examples"></a>

### Example
<a name="API_GetSecretValue_Example_1"></a>

The following example shows how to retrieve the secret value from a secret. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_GetSecretValue_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.GetSecretValue
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
<a name="API_GetSecretValue_Example_1_Response"></a>

```
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",
  "CreatedDate":1.523477145713E9,
  "Name":"MyTestDatabaseSecret",
  "SecretString":"{\n  \"username\":\"david\",\n  \"password\":\"EXAMPLE-PASSWORD\"\n}\n",
  "VersionId":"EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

## See Also
<a name="API_GetSecretValue_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/GetSecretValue) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/GetSecretValue) 

# ListSecrets
<a name="API_ListSecrets"></a>

Lists the secrets that are stored by Secrets Manager in the AWS account, not including secrets that are marked for deletion. To see secrets marked for deletion, use the Secrets Manager console.

All Secrets Manager operations are eventually consistent. ListSecrets might not reflect changes from the last five minutes. You can get more recent information for a specific secret by calling [DescribeSecret](API_DescribeSecret.md).

To list the versions of a secret, use [ListSecretVersionIds](API_ListSecretVersionIds.md).

To retrieve the values for the secrets, call [BatchGetSecretValue](API_BatchGetSecretValue.md) or [GetSecretValue](API_GetSecretValue.md).

For information about finding secrets in the console, see [Find secrets in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:ListSecrets`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_ListSecrets_RequestSyntax"></a>

```
{
   "Filters": [ 
      { 
         "Key": "string",
         "Values": [ "string" ]
      }
   ],
   "IncludePlannedDeletion": boolean,
   "MaxResults": number,
   "NextToken": "string",
   "SortBy": "string",
   "SortOrder": "string"
}
```

## Request Parameters
<a name="API_ListSecrets_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [Filters](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-Filters"></a>
The filters to apply to the list of secrets.  
Type: Array of [Filter](API_Filter.md) objects  
Array Members: Maximum number of 10 items.  
Required: No

 ** [IncludePlannedDeletion](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-IncludePlannedDeletion"></a>
Specifies whether to include secrets scheduled for deletion. By default, secrets scheduled for deletion aren't included.  
Type: Boolean  
Required: No

 ** [MaxResults](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-MaxResults"></a>
The number of results to include in the response.  
If there are more results available, in the response, Secrets Manager includes `NextToken`. To get the next results, call `ListSecrets` again with the value from `NextToken`.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** [NextToken](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-NextToken"></a>
A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call `ListSecrets` again with this value.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.  
Required: No

 ** [SortBy](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-SortBy"></a>
If not specified, secrets are listed by `CreatedDate`.  
Type: String  
Valid Values: `created-date | last-accessed-date | last-changed-date | name`   
Required: No

 ** [SortOrder](#API_ListSecrets_RequestSyntax) **   <a name="SecretsManager-ListSecrets-request-SortOrder"></a>
Secrets are listed by `CreatedDate`.   
Type: String  
Valid Values: `asc | desc`   
Required: No

## Response Syntax
<a name="API_ListSecrets_ResponseSyntax"></a>

```
{
   "NextToken": "string",
   "SecretList": [ 
      { 
         "ARN": "string",
         "CreatedDate": number,
         "DeletedDate": number,
         "Description": "string",
         "ExternalSecretRotationMetadata": [ 
            { 
               "Key": "string",
               "Value": "string"
            }
         ],
         "ExternalSecretRotationRoleArn": "string",
         "KmsKeyId": "string",
         "LastAccessedDate": number,
         "LastChangedDate": number,
         "LastRotatedDate": number,
         "Name": "string",
         "NextRotationDate": number,
         "OwningService": "string",
         "PrimaryRegion": "string",
         "RotationEnabled": boolean,
         "RotationLambdaARN": "string",
         "RotationRules": { 
            "AutomaticallyAfterDays": number,
            "Duration": "string",
            "ScheduleExpression": "string"
         },
         "SecretVersionsToStages": { 
            "string" : [ "string" ]
         },
         "Tags": [ 
            { 
               "Key": "string",
               "Value": "string"
            }
         ],
         "Type": "string"
      }
   ]
}
```

## Response Elements
<a name="API_ListSecrets_ResponseElements"></a>

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

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

 ** [NextToken](#API_ListSecrets_ResponseSyntax) **   <a name="SecretsManager-ListSecrets-response-NextToken"></a>
Secrets Manager includes this value if there's more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call `ListSecrets` again with this value.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.

 ** [SecretList](#API_ListSecrets_ResponseSyntax) **   <a name="SecretsManager-ListSecrets-response-SecretList"></a>
A list of the secrets in the account.  
Type: Array of [SecretListEntry](API_SecretListEntry.md) objects

## Errors
<a name="API_ListSecrets_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidNextTokenException **   
The `NextToken` value is invalid.  
HTTP Status Code: 400

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

## Examples
<a name="API_ListSecrets_Examples"></a>

### Example
<a name="API_ListSecrets_Example_1"></a>

The following example shows how to list the secrets in the account. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_ListSecrets_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.ListSecrets
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>

{}
```

#### Sample Response
<a name="API_ListSecrets_Example_1_Response"></a>

```
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>

{
  "SecretList":[
    {
      "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
      "Description":"My test database secret",
      "LastChangedDate":1.523477145729E9,
      "Name":"MyTestDatabaseSecret",
      "SecretVersionsToStages":{
        "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE":["AWSCURRENT"]
      }
    },
    {
      "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:AnotherDatabaseSecret-d4e5f6",
      "Description":"Another secret created for a different database",
      "LastChangedDate":1.523482025685E9,
      "Name":"AnotherDatabaseSecret",
      "SecretVersionsToStages":{
        "EXAMPLE3-90ab-cdef-fedc-ba987EXAMPLE":["AWSCURRENT"]
      }
    }
  ]
}
```

### Example
<a name="API_ListSecrets_Example_2"></a>

The following example shows how to list the secrets in the account that are tagged with `costcenter 12345`. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_ListSecrets_Example_2_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.ListSecrets
&Filter.1.Name=costcenter
&Filter.1.Value.1=12345
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>

{}
```

#### Sample Response
<a name="API_ListSecrets_Example_2_Response"></a>

```
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>

{
  "SecretList":[
    {
      "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
      "Description":"My test database secret",
      "LastChangedDate":1.523477145729E9,
      "Name":"MyTestDatabaseSecret",
      "SecretVersionsToStages":{
        "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE":["AWSCURRENT"]
      }
    },
    {
      "ARN":"arn:aws:secretsmanager:us-west-2:123456789012:secret:AnotherDatabaseSecret-d4e5f6",
      "Description":"Another secret created for a different database",
      "LastChangedDate":1.523482025685E9,
      "Name":"AnotherDatabaseSecret",
      "SecretVersionsToStages":{
        "EXAMPLE3-90ab-cdef-fedc-ba987EXAMPLE":["AWSCURRENT"]
      }
    }
  ]
}
```

## See Also
<a name="API_ListSecrets_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/ListSecrets) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/ListSecrets) 

# ListSecretVersionIds
<a name="API_ListSecretVersionIds"></a>

Lists the versions of a secret. Secrets Manager uses staging labels to indicate the different versions of a secret. For more information, see [ Secrets Manager concepts: Versions](https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version).

To list the secrets in the account, use [ListSecrets](API_ListSecrets.md).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:ListSecretVersionIds`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_ListSecretVersionIds_RequestSyntax"></a>

```
{
   "IncludeDeprecated": boolean,
   "MaxResults": number,
   "NextToken": "string",
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_ListSecretVersionIds_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [IncludeDeprecated](#API_ListSecretVersionIds_RequestSyntax) **   <a name="SecretsManager-ListSecretVersionIds-request-IncludeDeprecated"></a>
Specifies whether to include versions of secrets that don't have any staging labels attached to them. Versions without staging labels are considered deprecated and are subject to deletion by Secrets Manager. By default, versions without staging labels aren't included.  
Type: Boolean  
Required: No

 ** [MaxResults](#API_ListSecretVersionIds_RequestSyntax) **   <a name="SecretsManager-ListSecretVersionIds-request-MaxResults"></a>
The number of results to include in the response.  
If there are more results available, in the response, Secrets Manager includes `NextToken`. To get the next results, call `ListSecretVersionIds` again with the value from `NextToken`.   
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** [NextToken](#API_ListSecretVersionIds_RequestSyntax) **   <a name="SecretsManager-ListSecretVersionIds-request-NextToken"></a>
A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call `ListSecretVersionIds` again with this value.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.  
Required: No

 ** [SecretId](#API_ListSecretVersionIds_RequestSyntax) **   <a name="SecretsManager-ListSecretVersionIds-request-SecretId"></a>
The ARN or name of the secret whose versions you want to list.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_ListSecretVersionIds_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "NextToken": "string",
   "Versions": [ 
      { 
         "CreatedDate": number,
         "KmsKeyIds": [ "string" ],
         "LastAccessedDate": number,
         "VersionId": "string",
         "VersionStages": [ "string" ]
      }
   ]
}
```

## Response Elements
<a name="API_ListSecretVersionIds_ResponseElements"></a>

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](#API_ListSecretVersionIds_ResponseSyntax) **   <a name="SecretsManager-ListSecretVersionIds-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_ListSecretVersionIds_ResponseSyntax) **   <a name="SecretsManager-ListSecretVersionIds-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [NextToken](#API_ListSecretVersionIds_ResponseSyntax) **   <a name="SecretsManager-ListSecretVersionIds-response-NextToken"></a>
Secrets Manager includes this value if there's more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call `ListSecretVersionIds` again with this value.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.

 ** [Versions](#API_ListSecretVersionIds_ResponseSyntax) **   <a name="SecretsManager-ListSecretVersionIds-response-Versions"></a>
A list of the versions of the secret.  
Type: Array of [SecretVersionsListEntry](API_SecretVersionsListEntry.md) objects

## Errors
<a name="API_ListSecretVersionIds_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidNextTokenException **   
The `NextToken` value is invalid.  
HTTP Status Code: 400

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_ListSecretVersionIds_Examples"></a>

### Example
<a name="API_ListSecretVersionIds_Example_1"></a>

The following example shows how to retrieve a list of the versions of a secret, including versions which have no staging labels attached. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_ListSecretVersionIds_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.ListSecretVersionIds
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",
  "IncludeDeprecated": true
}
```

#### Sample Response
<a name="API_ListSecretVersionIds_Example_1_Response"></a>

```
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",
  "Versions":[
    {
      "CreatedDate":1.523477145713E9,
      "VersionId":"EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
      "VersionStages":["AWSPREVIOUS"]
    },
    {
      "CreatedDate":1.523486221391E9,
      "VersionId":"EXAMPLE2-90ab-cdef-fedc-ba987SECRET2",
      "VersionStages":["AWSCURRENT"]
    },
    {
      "CreatedDate": 1.51197446236E9,
      "VersionId": "EXAMPLE3-90ab-cdef-fedc-ba987SECRET3"
    }
  ]
}
```

## See Also
<a name="API_ListSecretVersionIds_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/ListSecretVersionIds) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/ListSecretVersionIds) 

# PutResourcePolicy
<a name="API_PutResourcePolicy"></a>

Attaches a resource-based permission policy to a secret. A resource-based policy is optional. For more information, see [Authentication and access control for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) 

For information about attaching a policy in the console, see [Attach a permissions policy to a secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:PutResourcePolicy`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_PutResourcePolicy_RequestSyntax"></a>

```
{
   "BlockPublicPolicy": boolean,
   "ResourcePolicy": "string",
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_PutResourcePolicy_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [BlockPublicPolicy](#API_PutResourcePolicy_RequestSyntax) **   <a name="SecretsManager-PutResourcePolicy-request-BlockPublicPolicy"></a>
Specifies whether to block resource-based policies that allow broad access to the secret, for example those that use a wildcard for the principal. By default, public policies aren't blocked.  
Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public access from being granted through the resource policies that are directly attached to your secrets. In addition to using these features, carefully inspect the following policies to confirm that they do not grant public access:  
+ Identity-based policies attached to associated AWS principals (for example, IAM roles)
+ Resource-based policies attached to associated AWS resources (for example, AWS Key Management Service (AWS KMS) keys)
To review permissions to your secrets, see [Determine who has permissions to your secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/determine-acccess_examine-iam-policies.html).
Type: Boolean  
Required: No

 ** [ResourcePolicy](#API_PutResourcePolicy_RequestSyntax) **   <a name="SecretsManager-PutResourcePolicy-request-ResourcePolicy"></a>
A JSON-formatted string for an AWS resource-based policy. For example policies, see [Permissions policy examples](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 20480.  
Required: Yes

 ** [SecretId](#API_PutResourcePolicy_RequestSyntax) **   <a name="SecretsManager-PutResourcePolicy-request-SecretId"></a>
The ARN or name of the secret to attach the resource-based policy.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_PutResourcePolicy_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string"
}
```

## Response Elements
<a name="API_PutResourcePolicy_ResponseElements"></a>

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](#API_PutResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-PutResourcePolicy-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_PutResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-PutResourcePolicy-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 512.

## Errors
<a name="API_PutResourcePolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** MalformedPolicyDocumentException **   
The resource policy has syntax errors.  
HTTP Status Code: 400

 ** PublicPolicyException **   
The `BlockPublicPolicy` parameter is set to true, and the resource policy did not prevent broad access to the secret.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_PutResourcePolicy_Examples"></a>

### Example
<a name="API_PutResourcePolicy_Example_1"></a>

The following example shows how to attach a resource-based policy to a secret. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_PutResourcePolicy_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.PutResourcePolicy
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",
  "ResourcePolicy": "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::111122223333:root\",\"arn:aws:iam::444455556666:root\"]},\"Action\":[\"secretsmanager:GetSecretValue\"],\"Resource\":\"*\"}}"
}
```

#### Sample Response
<a name="API_PutResourcePolicy_Example_1_Response"></a>

```
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"
}
```

## See Also
<a name="API_PutResourcePolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/PutResourcePolicy) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/PutResourcePolicy) 

# PutSecretValue
<a name="API_PutSecretValue"></a>

Creates a new version of your secret by creating a new encrypted value and attaching it to the secret. version can contain a new `SecretString` value or a new `SecretBinary` value. 

Do not call `PutSecretValue` at a sustained rate of more than once every 10 minutes. When you update the secret value, Secrets Manager creates a new version of the secret. Secrets Manager keeps 100 of the most recent versions, but it keeps *all* secret versions created in the last 24 hours. If you call `PutSecretValue` more than once every 10 minutes, you will create more versions than Secrets Manager removes, and you will reach the quota for secret versions.

You can specify the staging labels to attach to the new version in `VersionStages`. If you don't include `VersionStages`, then Secrets Manager automatically moves the staging label `AWSCURRENT` to this version. If this operation creates the first version for the secret, then Secrets Manager automatically attaches the staging label `AWSCURRENT` to it. If this operation moves the staging label `AWSCURRENT` from another version to this version, then Secrets Manager also automatically moves the staging label `AWSPREVIOUS` to the version that `AWSCURRENT` was removed from.

This operation is idempotent. If you call this operation with a `ClientRequestToken` that matches an existing version's VersionId, and you specify the same secret data, the operation succeeds but does nothing. However, if the secret data is different, then the operation fails because you can't modify an existing version; you can only create new ones.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters except `SecretBinary`, `SecretString`, or `RotationToken` because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:PutSecretValue`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

**Important**  
When you enter commands in a command shell, there is a risk of the command history being accessed or utilities having access to your command parameters. This is a concern if the command includes the value of a secret. Learn how to [Mitigate the risks of using command-line tools to store AWS Secrets Manager secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/security_cli-exposure-risks.html).

## Request Syntax
<a name="API_PutSecretValue_RequestSyntax"></a>

```
{
   "ClientRequestToken": "string",
   "RotationToken": "string",
   "SecretBinary": blob,
   "SecretId": "string",
   "SecretString": "string",
   "VersionStages": [ "string" ]
}
```

## Request Parameters
<a name="API_PutSecretValue_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ClientRequestToken](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-ClientRequestToken"></a>
A unique identifier for the new version of the secret.   
If you use the AWS CLI or one of the AWS SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request. 
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a `ClientRequestToken` and include it in the request.  
This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a [UUID-type](https://wikipedia.org/wiki/Universally_unique_identifier) value to ensure uniqueness of your versions within the specified secret.   
+ If the `ClientRequestToken` value isn't already associated with a version of the secret then a new version of the secret is created. 
+ If a version with this value already exists and that version's `SecretString` or `SecretBinary` values are the same as those in the request then the request is ignored. The operation is idempotent. 
+ If a version with this value already exists and the version of the `SecretString` and `SecretBinary` values are different from those in the request, then the request fails because you can't modify a secret version. You can only create new versions to store new secret values.
This value becomes the `VersionId` of the new version.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [RotationToken](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-RotationToken"></a>
A unique identifier that indicates the source of the request. Required for secret rotations using an IAM assumed role or cross-account rotation, in which you rotate a secret in one account by using a Lambda rotation function in another account. In both cases, the rotation function assumes an IAM role to call Secrets Manager, and then Secrets Manager validates the identity using the token. For more information, see [How rotation works](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html) and [Rotation by Lambda functions](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_lambda).  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: String  
Length Constraints: Minimum length of 36. Maximum length of 256.  
Pattern: `^[a-zA-Z0-9\-]+$`   
Required: No

 ** [SecretBinary](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-SecretBinary"></a>
The binary data to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then pass the contents of the file as a parameter.   
You must include `SecretBinary` or `SecretString`, but not both.  
You can't access this value from the Secrets Manager console.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: Base64-encoded binary data object  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [SecretId](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-SecretId"></a>
The ARN or name of the secret to add a new version to.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
If the secret doesn't already exist, use `CreateSecret` instead.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [SecretString](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-SecretString"></a>
The text to encrypt and store in the new version of the secret.   
You must include `SecretBinary` or `SecretString`, but not both.  
We recommend you create the secret string as JSON key/value pairs, as shown in the example.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [VersionStages](#API_PutSecretValue_RequestSyntax) **   <a name="SecretsManager-PutSecretValue-request-VersionStages"></a>
A list of staging labels to attach to this version of the secret. Secrets Manager uses staging labels to track versions of a secret through the rotation process.  
If you specify a staging label that's already associated with a different version of the same secret, then Secrets Manager removes the label from the other version and attaches it to this version. If you specify `AWSCURRENT`, and it is already attached to another version, then Secrets Manager also moves the staging label `AWSPREVIOUS` to the version that `AWSCURRENT` was removed from.  
If you don't include `VersionStages`, then Secrets Manager automatically moves the staging label `AWSCURRENT` to this version.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 20 items.  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Required: No

## Response Syntax
<a name="API_PutSecretValue_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "VersionId": "string",
   "VersionStages": [ "string" ]
}
```

## Response Elements
<a name="API_PutSecretValue_ResponseElements"></a>

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](#API_PutSecretValue_ResponseSyntax) **   <a name="SecretsManager-PutSecretValue-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_PutSecretValue_ResponseSyntax) **   <a name="SecretsManager-PutSecretValue-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [VersionId](#API_PutSecretValue_ResponseSyntax) **   <a name="SecretsManager-PutSecretValue-response-VersionId"></a>
The unique identifier of the version of the secret.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

 ** [VersionStages](#API_PutSecretValue_ResponseSyntax) **   <a name="SecretsManager-PutSecretValue-response-VersionStages"></a>
The list of staging labels that are currently attached to this version of the secret. Secrets Manager uses staging labels to track a version as it progresses through the secret rotation process.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 20 items.  
Length Constraints: Minimum length of 1. Maximum length of 256.

## Errors
<a name="API_PutSecretValue_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** DecryptionFailure **   
Secrets Manager can't decrypt the protected secret text using the provided KMS key.   
HTTP Status Code: 400

 ** EncryptionFailure **   
Secrets Manager can't encrypt the protected secret text using the provided KMS key. Check that the KMS key is available, enabled, and not in an invalid state. For more information, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).  
HTTP Status Code: 400

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** LimitExceededException **   
The request failed because it would exceed one of the Secrets Manager quotas.  
HTTP Status Code: 400

 ** ResourceExistsException **   
A resource with the ID you requested already exists.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_PutSecretValue_Examples"></a>

### Example
<a name="API_PutSecretValue_Example_1"></a>

The following example shows how to create a new version of a secret. The `ClientRequestToken` becomes the `VersionId` of the new version. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_PutSecretValue_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.PutSecretValue
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",
  "SecretString": "{\"username\":\"david\",\"password\":\"EXAMPLE-PASSWORD\"}",
  "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE"
}
```

#### Sample Response
<a name="API_PutSecretValue_Example_1_Response"></a>

```
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",
  "VersionId":"EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
  "VersionStages":[
      "AWSCURRENT"
  ]
}
```

## See Also
<a name="API_PutSecretValue_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/PutSecretValue) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/PutSecretValue) 

# RemoveRegionsFromReplication
<a name="API_RemoveRegionsFromReplication"></a>

For a secret that is replicated to other Regions, deletes the secret replicas from the Regions you specify.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:RemoveRegionsFromReplication`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_RemoveRegionsFromReplication_RequestSyntax"></a>

```
{
   "RemoveReplicaRegions": [ "string" ],
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_RemoveRegionsFromReplication_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [RemoveReplicaRegions](#API_RemoveRegionsFromReplication_RequestSyntax) **   <a name="SecretsManager-RemoveRegionsFromReplication-request-RemoveReplicaRegions"></a>
The Regions of the replicas to remove.  
Type: Array of strings  
Array Members: Minimum number of 1 item.  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `^([a-z]+-)+\d+$`   
Required: Yes

 ** [SecretId](#API_RemoveRegionsFromReplication_RequestSyntax) **   <a name="SecretsManager-RemoveRegionsFromReplication-request-SecretId"></a>
The ARN or name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_RemoveRegionsFromReplication_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "ReplicationStatus": [ 
      { 
         "KmsKeyId": "string",
         "LastAccessedDate": number,
         "Region": "string",
         "Status": "string",
         "StatusMessage": "string"
      }
   ]
}
```

## Response Elements
<a name="API_RemoveRegionsFromReplication_ResponseElements"></a>

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](#API_RemoveRegionsFromReplication_ResponseSyntax) **   <a name="SecretsManager-RemoveRegionsFromReplication-response-ARN"></a>
The ARN of the primary secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [ReplicationStatus](#API_RemoveRegionsFromReplication_ResponseSyntax) **   <a name="SecretsManager-RemoveRegionsFromReplication-response-ReplicationStatus"></a>
The status of replicas for this secret after you remove Regions.  
Type: Array of [ReplicationStatusType](API_ReplicationStatusType.md) objects

## Errors
<a name="API_RemoveRegionsFromReplication_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_RemoveRegionsFromReplication_Examples"></a>

### Example
<a name="API_RemoveRegionsFromReplication_Example_1"></a>

The following example shows how to remove the replica secrets in Europe (London) and Europe (Paris) The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RemoveRegionsFromReplication_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RemoveRegionsFromReplication
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",
  "RemoveReplicaRegions": "eu-west-2 eu-west-3"
}
```

#### Sample Response
<a name="API_RemoveRegionsFromReplication_Example_1_Response"></a>

```
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",
  "ReplicationStatus":[
      {
          "Region": "eu-west-1",
          "KmsKeyId": "alias/aws/secretsmanager",
          "Status": "InSync",
          "StatusMessage": "Replication succeeded"

      }
  ]
}
```

## See Also
<a name="API_RemoveRegionsFromReplication_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/RemoveRegionsFromReplication) 

# ReplicateSecretToRegions
<a name="API_ReplicateSecretToRegions"></a>

Replicates the secret to a new Regions. See [Multi-Region secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/create-manage-multi-region-secrets.html).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:ReplicateSecretToRegions`. If the primary secret is encrypted with a KMS key other than `aws/secretsmanager`, you also need `kms:Decrypt` permission to the key. To encrypt the replicated secret with a KMS key other than `aws/secretsmanager`, you need `kms:GenerateDataKey` and `kms:Encrypt` to the key. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_ReplicateSecretToRegions_RequestSyntax"></a>

```
{
   "AddReplicaRegions": [ 
      { 
         "KmsKeyId": "string",
         "Region": "string"
      }
   ],
   "ForceOverwriteReplicaSecret": boolean,
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_ReplicateSecretToRegions_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [AddReplicaRegions](#API_ReplicateSecretToRegions_RequestSyntax) **   <a name="SecretsManager-ReplicateSecretToRegions-request-AddReplicaRegions"></a>
A list of Regions in which to replicate the secret.  
Type: Array of [ReplicaRegionType](API_ReplicaRegionType.md) objects  
Array Members: Minimum number of 1 item.  
Required: Yes

 ** [ForceOverwriteReplicaSecret](#API_ReplicateSecretToRegions_RequestSyntax) **   <a name="SecretsManager-ReplicateSecretToRegions-request-ForceOverwriteReplicaSecret"></a>
Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.  
Type: Boolean  
Required: No

 ** [SecretId](#API_ReplicateSecretToRegions_RequestSyntax) **   <a name="SecretsManager-ReplicateSecretToRegions-request-SecretId"></a>
The ARN or name of the secret to replicate.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_ReplicateSecretToRegions_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "ReplicationStatus": [ 
      { 
         "KmsKeyId": "string",
         "LastAccessedDate": number,
         "Region": "string",
         "Status": "string",
         "StatusMessage": "string"
      }
   ]
}
```

## Response Elements
<a name="API_ReplicateSecretToRegions_ResponseElements"></a>

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](#API_ReplicateSecretToRegions_ResponseSyntax) **   <a name="SecretsManager-ReplicateSecretToRegions-response-ARN"></a>
The ARN of the primary secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [ReplicationStatus](#API_ReplicateSecretToRegions_ResponseSyntax) **   <a name="SecretsManager-ReplicateSecretToRegions-response-ReplicationStatus"></a>
The status of replication.  
Type: Array of [ReplicationStatusType](API_ReplicationStatusType.md) objects

## Errors
<a name="API_ReplicateSecretToRegions_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_ReplicateSecretToRegions_Examples"></a>

### Example
<a name="API_ReplicateSecretToRegions_Example_1"></a>

The following example replicates a secret to eu-west-3. The replica is encrypted with the AWS managed key `aws/secretsmanager`. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_ReplicateSecretToRegions_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.ReplicateSecretToRegions
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": "MyTestSecret",
  "AddReplicaRegions": [ { "Region": "eu-west-3" }] ,
  "ForceOverwriteReplicaSecret": true
}
```

#### Sample Response
<a name="API_ReplicateSecretToRegions_Example_1_Response"></a>

```
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:MyTestSecret-1a2b3c",
  "ReplicationStatus": [
        {
            "Region": "eu-west-3",
            "KmsKeyId": "alias/aws/secretsmanager",
            "Status": "InProgress"
        }
    ]
}
```

## See Also
<a name="API_ReplicateSecretToRegions_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/ReplicateSecretToRegions) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/ReplicateSecretToRegions) 

# RestoreSecret
<a name="API_RestoreSecret"></a>

Cancels the scheduled deletion of a secret by removing the `DeletedDate` time stamp. You can access a secret again after it has been restored.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:RestoreSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_RestoreSecret_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_RestoreSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_RestoreSecret_RequestSyntax) **   <a name="SecretsManager-RestoreSecret-request-SecretId"></a>
The ARN or name of the secret to restore.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_RestoreSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string"
}
```

## Response Elements
<a name="API_RestoreSecret_ResponseElements"></a>

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](#API_RestoreSecret_ResponseSyntax) **   <a name="SecretsManager-RestoreSecret-response-ARN"></a>
The ARN of the secret that was restored.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_RestoreSecret_ResponseSyntax) **   <a name="SecretsManager-RestoreSecret-response-Name"></a>
The name of the secret that was restored.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

## Errors
<a name="API_RestoreSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_RestoreSecret_Examples"></a>

### Example
<a name="API_RestoreSecret_Example_1"></a>

The following example shows how to restore a secret that was previously scheduled for deletion. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RestoreSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RestoreSecret
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
<a name="API_RestoreSecret_Example_1_Response"></a>

```
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"
}
```

## See Also
<a name="API_RestoreSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/RestoreSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/RestoreSecret) 

# RotateSecret
<a name="API_RotateSecret"></a>

Configures and starts the asynchronous process of rotating the secret. For information about rotation, see [Rotate secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html) in the *Secrets Manager User Guide*. If you include the configuration parameters, the operation sets the values for the secret and then immediately starts a rotation. If you don't include the configuration parameters, the operation starts a rotation with the values already stored in the secret. 

When rotation is successful, the `AWSPENDING` staging label might be attached to the same version as the `AWSCURRENT` version, or it might not be attached to any version. If the `AWSPENDING` staging label is present but not attached to the same version as `AWSCURRENT`, then any later invocation of `RotateSecret` assumes that a previous rotation request is still in progress and returns an error. When rotation is unsuccessful, the `AWSPENDING` staging label might be attached to an empty secret version. For more information, see [Troubleshoot rotation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot_rotation.html) in the *Secrets Manager User Guide*.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:RotateSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). You also need `lambda:InvokeFunction` permissions on the rotation function. For more information, see [ Permissions for rotation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html).

## Request Syntax
<a name="API_RotateSecret_RequestSyntax"></a>

```
{
   "ClientRequestToken": "string",
   "ExternalSecretRotationMetadata": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "ExternalSecretRotationRoleArn": "string",
   "RotateImmediately": boolean,
   "RotationLambdaARN": "string",
   "RotationRules": { 
      "AutomaticallyAfterDays": number,
      "Duration": "string",
      "ScheduleExpression": "string"
   },
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_RotateSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ClientRequestToken](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-ClientRequestToken"></a>
A unique identifier for the new version of the secret. You only need to specify this value if you implement your own retry logic and you want to ensure that Secrets Manager doesn't attempt to create a secret version twice.  
If you use the AWS CLI or one of the AWS SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request. 
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a `ClientRequestToken` and include it in the request.  
This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a [UUID-type](https://wikipedia.org/wiki/Universally_unique_identifier) value to ensure uniqueness of your versions within the specified secret.   
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [ExternalSecretRotationMetadata](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-ExternalSecretRotationMetadata"></a>
The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner. For more information about the required information, see [Using Secrets Manager managed external secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/managed-external-secrets.html)   
Type: Array of [ExternalSecretRotationMetadataItem](API_ExternalSecretRotationMetadataItem.md) objects  
Required: No

 ** [ExternalSecretRotationRoleArn](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-ExternalSecretRotationRoleArn"></a>
The Amazon Resource Name (ARN) of the role that allows Secrets Manager to rotate a secret held by a third-party partner. For more information, see [Security and permissions](https://docs.aws.amazon.com/secretsmanager/latest/userguide/mes-security.html).  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.  
Required: No

 ** [RotateImmediately](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-RotateImmediately"></a>
Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. The rotation schedule is defined in [RotateSecret:RotationRules](#SecretsManager-RotateSecret-request-RotationRules).  
The default for `RotateImmediately` is `true`. If you don't specify this value, Secrets Manager rotates the secret immediately.  
If you set `RotateImmediately` to `false`, Secrets Manager tests the rotation configuration by running the [`testSecret` step](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) of the Lambda rotation function. This test creates an `AWSPENDING` version of the secret and then removes it.  
When changing an existing rotation schedule and setting `RotateImmediately` to `false`:  
+ If using `AutomaticallyAfterDays` or a `ScheduleExpression` with `rate()`, the previously scheduled rotation might still occur.
+ To prevent unintended rotations, use a `ScheduleExpression` with `cron()` for granular control over rotation windows.
Rotation is an asynchronous process. For more information, see [How rotation works](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html).  
Type: Boolean  
Required: No

 ** [RotationLambdaARN](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-RotationLambdaARN"></a>
For secrets that use a Lambda rotation function to rotate, the ARN of the Lambda rotation function.   
For secrets that use *managed rotation*, omit this field. For more information, see [Managed rotation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_managed.html) in the *Secrets Manager User Guide*.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Required: No

 ** [RotationRules](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-RotationRules"></a>
A structure that defines the rotation configuration for this secret.  
When changing an existing rotation schedule and setting `RotateImmediately` to `false`:  
+ If using `AutomaticallyAfterDays` or a `ScheduleExpression` with `rate()`, the previously scheduled rotation might still occur.
+ To prevent unintended rotations, use a `ScheduleExpression` with `cron()` for granular control over rotation windows.
Type: [RotationRulesType](API_RotationRulesType.md) object  
Required: No

 ** [SecretId](#API_RotateSecret_RequestSyntax) **   <a name="SecretsManager-RotateSecret-request-SecretId"></a>
The ARN or name of the secret to rotate.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_RotateSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "VersionId": "string"
}
```

## Response Elements
<a name="API_RotateSecret_ResponseElements"></a>

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](#API_RotateSecret_ResponseSyntax) **   <a name="SecretsManager-RotateSecret-response-ARN"></a>
The ARN of the secret.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_RotateSecret_ResponseSyntax) **   <a name="SecretsManager-RotateSecret-response-Name"></a>
The name of the secret.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [VersionId](#API_RotateSecret_ResponseSyntax) **   <a name="SecretsManager-RotateSecret-response-VersionId"></a>
The ID of the new version of the secret.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

## Errors
<a name="API_RotateSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_RotateSecret_Examples"></a>

### Example
<a name="API_RotateSecret_Example_1"></a>

The following example configures rotation for a secret using a cron expression. The first rotation happens immediately after the changes are stored in the secret. The rotation schedule is the first and 15th day of every month. The rotation window begins at 4:00 PM UTC and ends at 6:00 PM. The `ClientRequestToken` field becomes the `VersionId` of the new version created during the rotation. The rotation function runs asynchronously in the background.

The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RotateSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RotateSecret
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",
  "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestDatabaseRotationLambda",
  "RotationRules": {"ScheduleExpression": "cron(0 16 1,15 * ? *)", "Duration": "2h"},
  "RotateImmediately": true,
  "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

#### Sample Response
<a name="API_RotateSecret_Example_1_Response"></a>

```
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",
  "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

### Example
<a name="API_RotateSecret_Example_2"></a>

The following example shows how to change a rotation schedule safely when setting `RotateImmediately` to `false` and using `cron()` for precise control over rotation timing. This example schedules rotation for the 1st day of each month at 4:00 PM UTC. Setting `RotateImmediately` to `false` prevents an immediate rotation, while using `cron()` prevents unintended rotations that might occur with `rate()` expressions when changing schedules. The `ClientRequestToken` field becomes the `VersionId` of the new version created during the rotation. The rotation function runs asynchronously in the background.

The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RotateSecret_Example_2_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RotateSecret
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",
  "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestDatabaseRotationLambda",
  "RotationRules": {"ScheduleExpression": "cron(0 16 1 * ? *)"},
  "RotateImmediately": false,
  "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

#### Sample Response
<a name="API_RotateSecret_Example_2_Response"></a>

```
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",
  "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

### Example
<a name="API_RotateSecret_Example_3"></a>

The following example configures rotation for a secret using a rate expression. The first rotation happens immediately after the changes are stored in the secret. The rotation schedule is every 10 days. The `ClientRequestToken` field becomes the `VersionId` of the new version created during the rotation. The rotation function runs asynchronously in the background.

The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RotateSecret_Example_3_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RotateSecret
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",
  "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestDatabaseRotationLambda",
  "RotationRules": {"ScheduleExpression": "rate(10 days)"},
  "RotateImmediately": true,
  "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

#### Sample Response
<a name="API_RotateSecret_Example_3_Response"></a>

```
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",
  "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

### Example
<a name="API_RotateSecret_Example_4"></a>

The following example starts an immediate rotation, so the secret must already have rotation configured. The `ClientRequestToken` field becomes the `VersionId` of the new version created during the rotation. The rotation function runs asynchronously in the background. 

The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_RotateSecret_Example_4_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.RotateSecret
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",
  "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

#### Sample Response
<a name="API_RotateSecret_Example_4_Response"></a>

```
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",
  "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

## See Also
<a name="API_RotateSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/RotateSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/RotateSecret) 

# StopReplicationToReplica
<a name="API_StopReplicationToReplica"></a>

Removes the link between the replica secret and the primary secret and promotes the replica to a primary secret in the replica Region.

You must call this operation from the Region in which you want to promote the replica to a primary secret.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:StopReplicationToReplica`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_StopReplicationToReplica_RequestSyntax"></a>

```
{
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_StopReplicationToReplica_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_StopReplicationToReplica_RequestSyntax) **   <a name="SecretsManager-StopReplicationToReplica-request-SecretId"></a>
The name of the secret or the replica ARN. The replica ARN is the same as the original primary secret ARN expect the Region is changed to the replica Region.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

## Response Syntax
<a name="API_StopReplicationToReplica_ResponseSyntax"></a>

```
{
   "ARN": "string"
}
```

## Response Elements
<a name="API_StopReplicationToReplica_ResponseElements"></a>

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](#API_StopReplicationToReplica_ResponseSyntax) **   <a name="SecretsManager-StopReplicationToReplica-response-ARN"></a>
The ARN of the promoted secret. The ARN is the same as the original primary secret except the Region is changed.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

## Errors
<a name="API_StopReplicationToReplica_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_StopReplicationToReplica_Examples"></a>

### Example
<a name="API_StopReplicationToReplica_Example_1"></a>

The following example is intended for a primary secret in `us-west-2` that has a replica in `ap-south-1`. The example removes the replica from the primary secret and promotes it to a primary secret in `ap-south-1`.

#### Sample Request
<a name="API_StopReplicationToReplica_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.StopReplicationToReplica
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": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyExampleSecret-a1b2c3"
        }
```

#### Sample Response
<a name="API_StopReplicationToReplica_Example_1_Response"></a>

```
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:ap-south-1:123456789012:secret:MyExampleSecret-a1b2c3",
}
```

## See Also
<a name="API_StopReplicationToReplica_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/StopReplicationToReplica) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/StopReplicationToReplica) 

# TagResource
<a name="API_TagResource"></a>

Attaches tags to a secret. Tags consist of a key name and a value. Tags are part of the secret's metadata. They are not associated with specific versions of the secret. This operation appends tags to the existing list of tags.

For tag quotas and naming restrictions, see [Service quotas for Tagging](https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas) in the * AWS General Reference guide*.

**Important**  
If you use tags as part of your security strategy, then adding or removing a tag can change permissions. If successfully completing this operation would result in you losing your permissions for this secret, then the operation is blocked and returns an Access Denied error.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:TagResource`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_TagResource_RequestSyntax"></a>

```
{
   "SecretId": "string",
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ]
}
```

## Request Parameters
<a name="API_TagResource_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_TagResource_RequestSyntax) **   <a name="SecretsManager-TagResource-request-SecretId"></a>
The identifier for the secret to attach tags to. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [Tags](#API_TagResource_RequestSyntax) **   <a name="SecretsManager-TagResource-request-Tags"></a>
The tags to attach to the secret as a JSON text string argument. Each element in the list consists of a `Key` and a `Value`.  
For storing multiple values, we recommend that you use a JSON text string argument and specify key/value pairs. For more information, see [Specifying parameter values for the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html) in the AWS CLI User Guide.  
Type: Array of [Tag](API_Tag.md) objects  
Required: Yes

## Response Elements
<a name="API_TagResource_ResponseElements"></a>

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

## Errors
<a name="API_TagResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_TagResource_Examples"></a>

### Example
<a name="API_TagResource_Example_1"></a>

The following example shows how to attach two tags to a secret. There is no output from this API. To see the result, use the [DescribeSecret](API_DescribeSecret.md) operation.

#### Sample Request
<a name="API_TagResource_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.TagResource
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": "MyExampleSecret",
  "Tags": [
    {
      "Key": "FirstTag",
      "Value": "SomeValue"
    },
    {
      "Key": "SecondTag",
      "Value": "AnotherValue"
    }
  ]
}
```

#### Sample Response
<a name="API_TagResource_Example_1_Response"></a>

```
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>
```

## See Also
<a name="API_TagResource_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/TagResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/TagResource) 

# UntagResource
<a name="API_UntagResource"></a>

Removes specific tags from a secret.

This operation is idempotent. If a requested tag is not attached to the secret, no error is returned and the secret metadata is unchanged.

**Important**  
If you use tags as part of your security strategy, then removing a tag can change permissions. If successfully completing this operation would result in you losing your permissions for this secret, then the operation is blocked and returns an Access Denied error.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:UntagResource`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_UntagResource_RequestSyntax"></a>

```
{
   "SecretId": "string",
   "TagKeys": [ "string" ]
}
```

## Request Parameters
<a name="API_UntagResource_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [SecretId](#API_UntagResource_RequestSyntax) **   <a name="SecretsManager-UntagResource-request-SecretId"></a>
The ARN or name of the secret.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [TagKeys](#API_UntagResource_RequestSyntax) **   <a name="SecretsManager-UntagResource-request-TagKeys"></a>
A list of tag key names to remove from the secret. You don't specify the value. Both the key and its associated value are removed.  
This parameter requires a JSON text string argument.  
For storing multiple values, we recommend that you use a JSON text string argument and specify key/value pairs. For more information, see [Specifying parameter values for the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html) in the AWS CLI User Guide.  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Required: Yes

## Response Elements
<a name="API_UntagResource_ResponseElements"></a>

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

## Errors
<a name="API_UntagResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_UntagResource_Examples"></a>

### Example
<a name="API_UntagResource_Example_1"></a>

The following example shows how to remove two tags from secret metadata. For each, both the tag and the associated value are removed. There is no output from this API. To see the result, use the [DescribeSecret](API_DescribeSecret.md) operation.

#### Sample Request
<a name="API_UntagResource_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UntagResource
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",
  "TagKeys": [
    "FirstTag", "SecondTag"
  ]
}
```

#### Sample Response
<a name="API_UntagResource_Example_1_Response"></a>

```
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>
```

## See Also
<a name="API_UntagResource_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/UntagResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/UntagResource) 

# UpdateSecret
<a name="API_UpdateSecret"></a>

Modifies the details of a secret, including metadata and the secret value. To change the secret value, you can also use [PutSecretValue](API_PutSecretValue.md).

To change the rotation configuration of a secret, use [RotateSecret](API_RotateSecret.md) instead.

To change a secret so that it is managed by another service, you need to recreate the secret in that service. See [Secrets Manager secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).

We recommend you avoid calling `UpdateSecret` at a sustained rate of more than once every 10 minutes. When you call `UpdateSecret` to update the secret value, Secrets Manager creates a new version of the secret. Secrets Manager removes outdated versions when there are more than 100, but it does not remove versions created less than 24 hours ago. If you update the secret value more than once every 10 minutes, you create more versions than Secrets Manager removes, and you will reach the quota for secret versions.

If you include `SecretString` or `SecretBinary` to create a new secret version, Secrets Manager automatically moves the staging label `AWSCURRENT` to the new version. Then it attaches the label `AWSPREVIOUS` to the version that `AWSCURRENT` was removed from.

If you call this operation with a `ClientRequestToken` that matches an existing version's `VersionId`, the operation results in an error. You can't modify an existing version, you can only create a new version. To remove a version, remove all staging labels from it. See [UpdateSecretVersionStage](API_UpdateSecretVersionStage.md).

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters except `SecretBinary` or `SecretString` because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:UpdateSecret`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). If you use a customer managed key, you must also have `kms:GenerateDataKey`, `kms:Encrypt`, and `kms:Decrypt` permissions on the key. If you change the KMS key and you don't have `kms:Encrypt` permission to the new key, Secrets Manager does not re-encrypt existing secret versions with the new key. For more information, see [ Secret encryption and decryption](https://docs.aws.amazon.com/secretsmanager/latest/userguide/security-encryption.html).

**Important**  
When you enter commands in a command shell, there is a risk of the command history being accessed or utilities having access to your command parameters. This is a concern if the command includes the value of a secret. Learn how to [Mitigate the risks of using command-line tools to store AWS Secrets Manager secrets](https://docs.aws.amazon.com/secretsmanager/latest/userguide/security_cli-exposure-risks.html).

## Request Syntax
<a name="API_UpdateSecret_RequestSyntax"></a>

```
{
   "ClientRequestToken": "string",
   "Description": "string",
   "KmsKeyId": "string",
   "SecretBinary": blob,
   "SecretId": "string",
   "SecretString": "string",
   "Type": "string"
}
```

## Request Parameters
<a name="API_UpdateSecret_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ClientRequestToken](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-ClientRequestToken"></a>
If you include `SecretString` or `SecretBinary`, then Secrets Manager creates a new version for the secret, and this parameter specifies the unique identifier for the new version.  
If you use the AWS CLI or one of the AWS SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request. 
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a `ClientRequestToken` and include it in the request.  
This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a [UUID-type](https://wikipedia.org/wiki/Universally_unique_identifier) value to ensure uniqueness of your versions within the specified secret.   
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [Description](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-Description"></a>
The description of the secret.  
Type: String  
Length Constraints: Maximum length of 2048.  
Required: No

 ** [KmsKeyId](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-KmsKeyId"></a>
The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt new secret versions as well as any existing versions with the staging labels `AWSCURRENT`, `AWSPENDING`, or `AWSPREVIOUS`. If you don't have `kms:Encrypt` permission to the new key, Secrets Manager does not re-encrypt existing secret versions with the new key. For more information about versions and staging labels, see [Concepts: Version](https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version).  
A key alias is always prefixed by `alias/`, for example `alias/aws/secretsmanager`. For more information, see [About aliases](https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html).  
If you set this to an empty string, Secrets Manager uses the AWS managed key `aws/secretsmanager`. If this key doesn't already exist in your account, then Secrets Manager creates it for you automatically. All users and roles in the AWS account automatically have access to use `aws/secretsmanager`. Creating `aws/secretsmanager` can result in a one-time significant delay in returning the result.   
You can only use the AWS managed key `aws/secretsmanager` if you call this operation using credentials from the same AWS account that owns the secret. If the secret is in a different account, then you must use a customer managed key and provide the ARN of that KMS key in this field. The user making the call must have permissions to both the secret and the KMS key in their respective accounts.
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Required: No

 ** [SecretBinary](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-SecretBinary"></a>
The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.   
Either `SecretBinary` or `SecretString` must have a value, but not both.  
You can't access this parameter in the Secrets Manager console.  
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: Base64-encoded binary data object  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [SecretId](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-SecretId"></a>
The ARN or name of the secret.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [SecretString](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-SecretString"></a>
The text data to encrypt and store in the new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.   
Either `SecretBinary` or `SecretString` must have a value, but not both.   
Sensitive: This field contains sensitive information, so the service does not include it in AWS CloudTrail log entries. If you create your own log entries, you must also avoid logging the information in this field.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 65536.  
Required: No

 ** [Type](#API_UpdateSecret_RequestSyntax) **   <a name="SecretsManager-UpdateSecret-request-Type"></a>
The exact string that identifies the third-party partner that holds the external secret. For more information, see [Managed external secret partners](https://docs.aws.amazon.com/secretsmanager/latest/userguide/mes-partners.html).  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 256.  
Required: No

## Response Syntax
<a name="API_UpdateSecret_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string",
   "VersionId": "string"
}
```

## Response Elements
<a name="API_UpdateSecret_ResponseElements"></a>

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](#API_UpdateSecret_ResponseSyntax) **   <a name="SecretsManager-UpdateSecret-response-ARN"></a>
The ARN of the secret that was updated.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_UpdateSecret_ResponseSyntax) **   <a name="SecretsManager-UpdateSecret-response-Name"></a>
The name of the secret that was updated.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

 ** [VersionId](#API_UpdateSecret_ResponseSyntax) **   <a name="SecretsManager-UpdateSecret-response-VersionId"></a>
If Secrets Manager created a new version of the secret during this operation, then `VersionId` contains the unique identifier of the new version.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.

## Errors
<a name="API_UpdateSecret_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** DecryptionFailure **   
Secrets Manager can't decrypt the protected secret text using the provided KMS key.   
HTTP Status Code: 400

 ** EncryptionFailure **   
Secrets Manager can't encrypt the protected secret text using the provided KMS key. Check that the KMS key is available, enabled, and not in an invalid state. For more information, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).  
HTTP Status Code: 400

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** LimitExceededException **   
The request failed because it would exceed one of the Secrets Manager quotas.  
HTTP Status Code: 400

 ** MalformedPolicyDocumentException **   
The resource policy has syntax errors.  
HTTP Status Code: 400

 ** PreconditionNotMetException **   
The request failed because you did not complete all the prerequisite steps.  
HTTP Status Code: 400

 ** ResourceExistsException **   
A resource with the ID you requested already exists.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_UpdateSecret_Examples"></a>

### Example
<a name="API_UpdateSecret_Example_1"></a>

The following example shows how to change the description of a secret. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_UpdateSecret_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecret
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",
  "Description": "This is a new description for the secret.",
  "ClientRequestToken": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE"
}
```

#### Sample Response
<a name="API_UpdateSecret_Example_1_Response"></a>

```
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"
}
```

### Example
<a name="API_UpdateSecret_Example_2"></a>

This example shows how to update the KMS key that Secrets Manager uses to encrypt the secret value. The KMS key must be in the same Region as the secret. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_UpdateSecret_Example_2_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecret
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",
  "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE"
}
```

#### Sample Response
<a name="API_UpdateSecret_Example_2_Response"></a>

```
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"
}
```

### Example
<a name="API_UpdateSecret_Example_3"></a>

The following example shows how to create a new version of the secret by updating the `SecretString` field. The `ClientRequestToken` parameter becomes the `VersionId` of the new version. Alternatively, you can use the [PutSecretValue](API_PutSecretValue.md) operation. The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_UpdateSecret_Example_3_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecret
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",
  "SecretString": "{<JSON STRING WITH CREDENTIALS>}",
  "ClientRequestToken": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

#### Sample Response
<a name="API_UpdateSecret_Example_3_Response"></a>

```
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",
  "VersionId":"EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

## See Also
<a name="API_UpdateSecret_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/UpdateSecret) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/UpdateSecret) 

# UpdateSecretVersionStage
<a name="API_UpdateSecretVersionStage"></a>

Modifies the staging labels attached to a version of a secret. Secrets Manager uses staging labels to track a version as it progresses through the secret rotation process. Each staging label can be attached to only one version at a time. To add a staging label to a version when it is already attached to another version, Secrets Manager first removes it from the other version first and then attaches it to this one. For more information about versions and staging labels, see [Concepts: Version](https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version). 

The staging labels that you specify in the `VersionStage` parameter are added to the existing list of staging labels for the version. 

You can move the `AWSCURRENT` staging label to this version by including it in this call.

**Note**  
Whenever you move `AWSCURRENT`, Secrets Manager automatically moves the label `AWSPREVIOUS` to the version that `AWSCURRENT` was removed from.

If this action results in the last label being removed from a version, then the version is considered to be 'deprecated' and can be deleted by Secrets Manager.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:UpdateSecretVersionStage`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_UpdateSecretVersionStage_RequestSyntax"></a>

```
{
   "MoveToVersionId": "string",
   "RemoveFromVersionId": "string",
   "SecretId": "string",
   "VersionStage": "string"
}
```

## Request Parameters
<a name="API_UpdateSecretVersionStage_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [MoveToVersionId](#API_UpdateSecretVersionStage_RequestSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-request-MoveToVersionId"></a>
The ID of the version to add the staging label to. To remove a label from a version, then do not specify this parameter.  
If the staging label is already attached to a different version of the secret, then you must also specify the `RemoveFromVersionId` parameter.   
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [RemoveFromVersionId](#API_UpdateSecretVersionStage_RequestSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-request-RemoveFromVersionId"></a>
The ID of the version that the staging label is to be removed from. If the staging label you are trying to attach to one version is already attached to a different version, then you must include this parameter and specify the version that the label is to be removed from. If the label is attached and you either do not specify this parameter, or the version ID does not match, then the operation fails.  
Type: String  
Length Constraints: Minimum length of 32. Maximum length of 64.  
Required: No

 ** [SecretId](#API_UpdateSecretVersionStage_RequestSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-request-SecretId"></a>
The ARN or the name of the secret with the version and staging labelsto modify.  
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See [Finding a secret from a partial ARN](https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [VersionStage](#API_UpdateSecretVersionStage_RequestSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-request-VersionStage"></a>
The staging label to add to this version.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Required: Yes

## Response Syntax
<a name="API_UpdateSecretVersionStage_ResponseSyntax"></a>

```
{
   "ARN": "string",
   "Name": "string"
}
```

## Response Elements
<a name="API_UpdateSecretVersionStage_ResponseElements"></a>

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](#API_UpdateSecretVersionStage_ResponseSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-response-ARN"></a>
The ARN of the secret that was updated.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.

 ** [Name](#API_UpdateSecretVersionStage_ResponseSyntax) **   <a name="SecretsManager-UpdateSecretVersionStage-response-Name"></a>
The name of the secret that was updated.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.

## Errors
<a name="API_UpdateSecretVersionStage_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** LimitExceededException **   
The request failed because it would exceed one of the Secrets Manager quotas.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_UpdateSecretVersionStage_Examples"></a>

### Example
<a name="API_UpdateSecretVersionStage_Example_1"></a>

The following example shows how to add a staging label to a version of a secret. You can review the results by calling [ListSecretVersionIds](API_ListSecretVersionIds.md). The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string. 

#### Sample Request
<a name="API_UpdateSecretVersionStage_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecretVersionStage
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",
  "VersionStage": "STAGINGLABEL1",
  "MoveToVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

#### Sample Response
<a name="API_UpdateSecretVersionStage_Example_1_Response"></a>

```
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"
}
```

### Example
<a name="API_UpdateSecretVersionStage_Example_2"></a>

The following example shows you how to remove a staging label from a version of a secret. You can review the results by calling [ListSecretVersionIds](API_ListSecretVersionIds.md). The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_UpdateSecretVersionStage_Example_2_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecretVersionStage
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",
  "VersionStage": "STAGINGLABEL1",
  "RemoveFromVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
```

#### Sample Response
<a name="API_UpdateSecretVersionStage_Example_2_Response"></a>

```
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"
}
```

### Example
<a name="API_UpdateSecretVersionStage_Example_3"></a>

The following example shows you how to move a staging label from one version of a secret to another. You can review the results by calling [ListSecretVersionIds](API_ListSecretVersionIds.md). The JSON request string input and response output displays formatted code with white space and line breaks for better readability. Submit your input as a single line JSON string.

#### Sample Request
<a name="API_UpdateSecretVersionStage_Example_3_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.UpdateSecretVersionStage
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",
  "VersionStage": "AWSCURRENT",
  "RemoveFromVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
  "MoveToVersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
```

#### Sample Response
<a name="API_UpdateSecretVersionStage_Example_3_Response"></a>

```
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"
}
```

## See Also
<a name="API_UpdateSecretVersionStage_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/UpdateSecretVersionStage) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/UpdateSecretVersionStage) 

# ValidateResourcePolicy
<a name="API_ValidateResourcePolicy"></a>

Validates that a resource policy does not grant a wide range of principals access to your secret. A resource-based policy is optional for secrets.

The API performs three checks when validating the policy:
+ Sends a call to [Zelkova](https://aws.amazon.com/blogs/security/protect-sensitive-data-in-the-cloud-with-automated-reasoning-zelkova/), an automated reasoning engine, to ensure your resource policy does not allow broad access to your secret, for example policies that use a wildcard for the principal.
+ Checks for correct syntax in a policy.
+ Verifies the policy does not lock out a caller.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see [Logging Secrets Manager events with AWS CloudTrail](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html).

 **Required permissions: ** `secretsmanager:ValidateResourcePolicy` and `secretsmanager:PutResourcePolicy`. For more information, see [ IAM policy actions for Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) and [Authentication and access control in Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html). 

## Request Syntax
<a name="API_ValidateResourcePolicy_RequestSyntax"></a>

```
{
   "ResourcePolicy": "string",
   "SecretId": "string"
}
```

## Request Parameters
<a name="API_ValidateResourcePolicy_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ResourcePolicy](#API_ValidateResourcePolicy_RequestSyntax) **   <a name="SecretsManager-ValidateResourcePolicy-request-ResourcePolicy"></a>
A JSON-formatted string that contains an AWS resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For example policies, see [Permissions policy examples](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 20480.  
Required: Yes

 ** [SecretId](#API_ValidateResourcePolicy_RequestSyntax) **   <a name="SecretsManager-ValidateResourcePolicy-request-SecretId"></a>
The ARN or name of the secret with the resource-based policy you want to validate.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: No

## Response Syntax
<a name="API_ValidateResourcePolicy_ResponseSyntax"></a>

```
{
   "PolicyValidationPassed": boolean,
   "ValidationErrors": [ 
      { 
         "CheckName": "string",
         "ErrorMessage": "string"
      }
   ]
}
```

## Response Elements
<a name="API_ValidateResourcePolicy_ResponseElements"></a>

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

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

 ** [PolicyValidationPassed](#API_ValidateResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-ValidateResourcePolicy-response-PolicyValidationPassed"></a>
True if your policy passes validation, otherwise false.  
Type: Boolean

 ** [ValidationErrors](#API_ValidateResourcePolicy_ResponseSyntax) **   <a name="SecretsManager-ValidateResourcePolicy-response-ValidationErrors"></a>
Validation errors if your policy didn't pass validation.  
Type: Array of [ValidationErrorsEntry](API_ValidationErrorsEntry.md) objects

## Errors
<a name="API_ValidateResourcePolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Errors](CommonErrors.md).

 ** InternalServiceError **   
An error occurred on the server side.  
HTTP Status Code: 500

 ** InvalidParameterException **   
The parameter name or value is invalid.  
HTTP Status Code: 400

 ** InvalidRequestException **   
A parameter value is not valid for the current state of the resource.  
Possible causes:  
+ The secret is scheduled for deletion.
+ You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. 
+ The secret is managed by another service, and you must use that service to update it. For more information, see [Secrets managed by other AWS services](https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html).
HTTP Status Code: 400

 ** MalformedPolicyDocumentException **   
The resource policy has syntax errors.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
Secrets Manager can't find the resource that you asked for.  
HTTP Status Code: 400

## Examples
<a name="API_ValidateResourcePolicy_Examples"></a>

### Example
<a name="API_ValidateResourcePolicy_Example_1"></a>

The following example shows how to validate a JSON policy.

#### Sample Request
<a name="API_ValidateResourcePolicy_Example_1_Request"></a>

```
POST / HTTP/1.1
Host: secretsmanager.region.domain
Accept-Encoding: identity
X-Amz-Target: secretsmanager.ValidateResourcePolicy
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",
      "ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}"
  }
```

## See Also
<a name="API_ValidateResourcePolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/secretsmanager-2017-10-17/ValidateResourcePolicy) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/secretsmanager-2017-10-17/ValidateResourcePolicy) 