

# DeleteMessage
<a name="API_DeleteMessage"></a>

Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s `EventName` is `aws:DELETE_MESSAGE`. This replicates the [ DeleteMessage](https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-deletemessage-publish.html) WebSocket operation in the Amazon IVS Chat Messaging API.

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

```
POST /DeleteMessage HTTP/1.1
Content-type: application/json

{
   "id": "string",
   "reason": "string",
   "roomIdentifier": "string"
}
```

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

The request does not use any URI parameters.

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

The request accepts the following data in JSON format.

 ** [id](#API_DeleteMessage_RequestSyntax) **   <a name="ivs-DeleteMessage-request-id"></a>
ID of the message to be deleted. This is the `Id` field in the received message (see [ Message (Subscribe)](https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-message-subscribe.html) in the Chat Messaging API).  
Type: String  
Length Constraints: Fixed length of 12.  
Pattern: `[a-zA-Z0-9]+`   
Required: Yes

 ** [reason](#API_DeleteMessage_RequestSyntax) **   <a name="ivs-DeleteMessage-request-reason"></a>
Reason for deleting the message.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Required: No

 ** [roomIdentifier](#API_DeleteMessage_RequestSyntax) **   <a name="ivs-DeleteMessage-request-roomIdentifier"></a>
Identifier of the room where the message should be deleted. Currently this must be an ARN.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `arn:aws:ivschat:[a-z0-9-]+:[0-9]+:room/[a-zA-Z0-9-]+`   
Required: Yes

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

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

{
   "id": "string"
}
```

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

 ** [id](#API_DeleteMessage_ResponseSyntax) **   <a name="ivs-DeleteMessage-response-id"></a>
Operation identifier, generated by Amazon IVS Chat.  
Type: String  
Length Constraints: Fixed length of 12.  
Pattern: `[a-zA-Z0-9]+` 

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

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

 ** AccessDeniedException **   
  
HTTP Status Code: 403

 ** PendingVerification **   
  
HTTP Status Code: 403

 ** ResourceNotFoundException **   
  
HTTP Status Code: 404

 ** ThrottlingException **   
  
HTTP Status Code: 429

 ** ValidationException **   
  
HTTP Status Code: 400

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