> ## Documentation Index
> Fetch the complete documentation index at: https://developer.z-api.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete messages

> Delete a sent or received message from a chat

## Overview

Method used to delete a message from a chat. You can delete both a message you sent and a message sent by a contact. To use this feature you only need the messageId of the message you want to delete.

#### Example on WhatsApp

<div style={{ display: "flex", justifyContent: "center" }}>
  <img src="https://mintcdn.com/z-api-8aa3bb40/c1Sn38QJwMBwsVRm/images/delete-message-eng.jpeg?fit=max&auto=format&n=c1Sn38QJwMBwsVRm&q=85&s=59d7b12f57f75266fb17daaf984d3b23" width="400" data-path="images/delete-message-eng.jpeg" />
</div>

***

## Attributes

### Header

<ParamField path="instanceId" type="string" required>
  Your instance ID. Available in the Z-API panel under **Instances**.
</ParamField>

<ParamField path="token" type="string" required>
  Your Z-API instance token.
</ParamField>

### Query Parameters

<ParamField query="messageId" type="string" required>
  Original message ID
</ParamField>

<ParamField query="phone" type="string" required>
  Recipient/sender phone number (or group ID for group messages) in DDI DDD NUMBER format. E.g.: 551199999999
</ParamField>

<ParamField query="owner" type="boolean" required>
  Set to `true` if you sent the message or `false` if it was a received message
</ParamField>

## Request Example

### Example URL

```bash theme={"theme":{"light":"github-light","dark":"poimandres"}}
DELETE https://api.z-api.io/instances/{instanceId}/token/{instanceToken}/messages?messageId=123&phone=5511999998888&owner=true
```

***

## Response

### 204

No content

```json theme={"theme":{"light":"github-light","dark":"poimandres"}}
{}
```

### 405

Make sure you are correctly sending the method specification, that is, verify that you sent DELETE as specified at the beginning of this topic.

### 415

If you receive a 415 error, make sure to add the "Content-Type" header to your request, which in most cases is "application/json".
