Messages
Delete a message
Deletes the message for everyone in the chat, like “Delete for everyone” in WhatsApp, and returns it with deleted_at set and its text and media cleared. The message stays in the conversation’s history. Live listeners receive message.updated and conversation.updated events.
- Bearer API key
- Scope:
writeor admin - or app session
- Workspace:
X-Tenant-ID(optional with a key)
Path parameters
iduuidrequiredConversation id.
messageIduuidrequiredMessage id in whatsappx.si: the
idof a Message, not itswhatsapp_message_id.
Headers
AuthorizationstringrequiredYour API key as
Bearer <key>. The wordBearerand the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.X-Tenant-IDuuidoptionalWorkspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass
?tenant=<id>instead.
Response
200 OKapplication/json
iduuidMessage id in whatsappx.si.
whatsapp_message_idstringMessage id assigned by WhatsApp.
conversation_iduuidConversation the message belongs to.
sender_jidstringWhatsApp id (JID) of the sender. For your own messages, the connected number.
sender_namestringSender display name, when WhatsApp provides one (may be empty).
AI Assistantfor messages the AI assistant sent.contentstringMessage text. Images and documents carry their caption here. Types without downloadable media (for example location) use a placeholder such as
[location message].message_typestringtext,imageordocument. Stickers arrive asimage; video and audio (including voice notes) asdocument. Other Cloud API types (for examplelocation) keep the name Meta sends and have no downloadable media.media_urlstringmay be absentPath of the stored media file, for example
/api/media/<workspace>/<file>. Prefix it withhttps://whatsappx.siand send your API key to download it (see Download a message’s file). Present for QR-linked and Cloud API inbound files (up to 25 MiB) and for files you send.mime_typestringmay be absentMIME type of the media file.
file_namestringmay be absentOriginal file name of a document.
file_sizeintegermay be absentMedia size in bytes.
timestamptimestampWhen the message was sent on WhatsApp (RFC 3339).
from_mebooleantruefor messages sent from the connected number (by your team, the API or an automation).statusenumreceivedfor incoming messages. Outgoing ones start assent, then becomedelivered(two grey ticks: the contact’s phone got it) andread(blue ticks: they opened it; for a voice note, played it). Status only moves forward. Contacts who turned off read receipts never reachread; in a group the first member’s receipt counts.delivered_attimestampnullableWhen an outgoing message was first delivered to the contact’s phone (RFC 3339).
nullfor incoming messages and until delivered.read_attimestampnullableWhen an outgoing message was first read (blue ticks).
nullfor incoming messages, until read, and when the contact has read receipts turned off.edited_attimestampnullableWhen the text was last edited: through the API or the app, or by its sender on WhatsApp.
nullif never edited.deleted_attimestampnullableWhen the message was deleted for everyone. Its
contentand media fields are then empty.nullif not deleted.created_attimestampWhen whatsappx.si stored the message (RFC 3339).
sent_by_user_iduuidmay be absentUser id of the teammate who sent the message from the app (or whose scheduled message it was). Left out for incoming messages, messages sent from the phone or by an automation, and older messages.
sent_by_namestringmay be absentName of that teammate. Left out with
sent_by_user_id.sent_via_api_key_iduuidmay be absentId of the API key the message was sent with. Left out for messages not sent through the API.
sent_via_api_key_namestringmay be absentName of that API key. Left out with
sent_via_api_key_id.
Status codes
- 200OK. The message was deleted for everyone.
- 400Bad request. The message cannot be deleted for everyone:
Messages can only be deleted for everyone within 48 hours of being sent,Only messages sent from this workspace's number can be deleted for everyone, a Cloud API number (see below), orconversation belongs to an inactive channel. Alsoinvalid conversation id,invalid message id. - 401Unauthorized. The API key is unknown, revoked or expired (
invalid or expired API key), the key was blocked because it may have been leaked (code: "api_key_blocked"), or there is no key and no signed-in session (unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. The API key has the
readscope, which only allows GET requests (API key is read-only). A key in another workspace getsAPI key belongs to a different workspace; a key used from an IP address outside itsallowed_ipsgetsthis API key is not allowed from your IP address(code: "ip_not_allowed"). - 404Not found. The conversation does not exist in this workspace, belongs to the inactive connection, or (for agents signed in to the app) is not assigned to you (
conversation not found); or the message is not in this conversation (message not found). - 409Conflict. The message was already deleted (
This message was already deleted), or the WhatsApp connection is not ready (whatsapp is not connected). - 502Bad gateway. WhatsApp did not accept the delete. The message is unchanged; try again in a moment.
Which messages can be changed?
| Edit | Delete for everyone | |
|---|---|---|
| Who sent it | Your number (from_me: true): your team, the API, an automation, or the phone itself | Same |
| Message type | text only | Any (text, image, document) |
| Time limit | 15 minutes after timestamp | 48 hours after timestamp |
The limits follow WhatsApp’s apps: they offer Edit for 15 minutes, and “Delete for everyone” for about two and a half days, of which the API allows 48 hours. Outside them, and for messages a contact sent, the API answers 400 and nothing is sent to WhatsApp.
What do contacts see?
An edited message shows the new text, marked as edited. A deleted message shows “This message was deleted” on every device in the chat.
What happens to the stored message?
- Edit:
contentis the new text andedited_atthe time of the edit. - Delete:
deleted_atis set;contentand the media fields (media_url,mime_type,file_name,file_size) are cleared and the stored file is removed. The message stays in the list, in its place.
Edits and deletes made on WhatsApp itself (by the contact, or from your phone) update the stored message the same way. Each change, from the API or from WhatsApp, sends a message.updated event.