Skip to main content
DELETE
/
instances
/
{instanceId}
/
token
/
{token}
/
messages
Delete messages
curl --request DELETE \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/messages \
  --header 'Client-Token: <api-key>'

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.

Attributes

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

Query Parameters

messageId
string
required
Original message ID
phone
string
required
Recipient/sender phone number (or group ID for group messages) in DDI DDD NUMBER format. E.g.: 551199999999
owner
boolean
required
Set to true if you sent the message or false if it was a received message

Request Example

Example URL

DELETE https://api.z-api.io/instances/{instanceId}/token/{instanceToken}/messages?messageId=123&phone=5511999998888&owner=true

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, which in most cases is “application/json”.