

# CreateLegalHold
<a name="API_CreateLegalHold"></a>

Creates a legal hold on a recovery point (backup). A legal hold is a restraint on altering or deleting a backup until an authorized user cancels the legal hold. Any actions to delete or disassociate a recovery point will fail with an error if one or more active legal holds are on the recovery point.

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

```
POST /legal-holds/ HTTP/1.1
Content-type: application/json

{
   "Description": "string",
   "IdempotencyToken": "string",
   "RecoveryPointSelection": { 
      "DateRange": { 
         "FromDate": number,
         "ToDate": number
      },
      "ResourceIdentifiers": [ "string" ],
      "VaultNames": [ "string" ]
   },
   "Tags": { 
      "string" : "string" 
   },
   "Title": "string"
}
```

## URI Request Parameters
<a name="API_CreateLegalHold_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_CreateLegalHold_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [Description](#API_CreateLegalHold_RequestSyntax) **   <a name="Backup-CreateLegalHold-request-Description"></a>
The description of the legal hold.  
Type: String  
Required: Yes

 ** [IdempotencyToken](#API_CreateLegalHold_RequestSyntax) **   <a name="Backup-CreateLegalHold-request-IdempotencyToken"></a>
This is a user-chosen string used to distinguish between otherwise identical calls. Retrying a successful request with the same idempotency token results in a success message with no action taken.  
Type: String  
Required: No

 ** [RecoveryPointSelection](#API_CreateLegalHold_RequestSyntax) **   <a name="Backup-CreateLegalHold-request-RecoveryPointSelection"></a>
The criteria to assign a set of resources, such as resource types or backup vaults.  
Type: [RecoveryPointSelection](API_RecoveryPointSelection.md) object  
Required: No

 ** [Tags](#API_CreateLegalHold_RequestSyntax) **   <a name="Backup-CreateLegalHold-request-Tags"></a>
Optional tags to include. A tag is a key-value pair you can use to manage, filter, and search for your resources. Allowed characters include UTF-8 letters, numbers, spaces, and the following characters: \$1 - = . \$1 : /.   
Type: String to string map  
Required: No

 ** [Title](#API_CreateLegalHold_RequestSyntax) **   <a name="Backup-CreateLegalHold-request-Title"></a>
The title of the legal hold.  
Type: String  
Required: Yes

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

```
HTTP/1.1 200
Content-type: application/json

{
   "CreationDate": number,
   "Description": "string",
   "LegalHoldArn": "string",
   "LegalHoldId": "string",
   "RecoveryPointSelection": { 
      "DateRange": { 
         "FromDate": number,
         "ToDate": number
      },
      "ResourceIdentifiers": [ "string" ],
      "VaultNames": [ "string" ]
   },
   "Status": "string",
   "Title": "string"
}
```

## Response Elements
<a name="API_CreateLegalHold_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.

 ** [CreationDate](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-CreationDate"></a>
The time when the legal hold was created.  
Type: Timestamp

 ** [Description](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-Description"></a>
The description of the legal hold.  
Type: String

 ** [LegalHoldArn](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-LegalHoldArn"></a>
The Amazon Resource Name (ARN) of the legal hold.  
Type: String

 ** [LegalHoldId](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-LegalHoldId"></a>
The ID of the legal hold.  
Type: String

 ** [RecoveryPointSelection](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-RecoveryPointSelection"></a>
The criteria to assign to a set of resources, such as resource types or backup vaults.  
Type: [RecoveryPointSelection](API_RecoveryPointSelection.md) object

 ** [Status](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-Status"></a>
The status of the legal hold.  
Type: String  
Valid Values: `CREATING | ACTIVE | CANCELING | CANCELED` 

 ** [Title](#API_CreateLegalHold_ResponseSyntax) **   <a name="Backup-CreateLegalHold-response-Title"></a>
The title of the legal hold.  
Type: String

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

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

 ** InvalidParameterValueException **   
Indicates that something is wrong with a parameter's value. For example, the value is out of range.    
 ** Context **   
  
 ** Type **   

HTTP Status Code: 400

 ** LimitExceededException **   
A limit in the request has been exceeded; for example, a maximum number of items allowed in a request.    
 ** Context **   
  
 ** Type **   

HTTP Status Code: 400

 ** MissingParameterValueException **   
Indicates that a required parameter is missing.    
 ** Context **   
  
 ** Type **   

HTTP Status Code: 400

 ** ServiceUnavailableException **   
The request failed due to a temporary failure of the server.    
 ** Context **   
  
 ** Type **   

HTTP Status Code: 500

## See Also
<a name="API_CreateLegalHold_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/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/backup-2018-11-15/CreateLegalHold) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/backup-2018-11-15/CreateLegalHold) 