Skip to main content
DELETE
Delete messages

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


Attributes

string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.

Query Parameters

string
required
Original message ID
string
required
Recipient/sender phone number (or group ID for group messages) in DDI DDD NUMBER format. E.g.: 551199999999
boolean
required
Set to true if you sent the message or false if it was a received message
boolean
Set to true to delete the message only for you (“Delete for me”), keeping it visible to the recipient. If not informed or set to false, the message will be deleted for everyone.

Request Example

Example URL

Deleting only for me

To delete the message only “for me,” simply add the deleteForMe parameter to the delete message endpoint request.

Response

204

No content

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 for the object you’re sending, most commonly “application/json”.