> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ryzeapi.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete message

> Revokes a message for everyone or deletes it only on your side

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** partially

Deletes a specific message in two modes:

* **For everyone** (`deleteForEveryone: true`), revokes on WhatsApp; "This message was deleted" appears for everyone. `delete_type: "revoke"`.
* **Only for me** (`deleteForEveryone: false`, default), deletes only locally on your devices. Recipients keep seeing it. `delete_type: "delete_for_me"`.

<Warning>
  The revoke window ("for everyone") has a WhatsApp limit: about **2 days and 12 hours** after sending. The API always accepts the request (it sends the REVOKE) and returns success, but the recipient's client ignores revocations of messages older than that window — so API success does not guarantee removal on the recipient's screen.
</Warning>

## Examples

### For everyone (revoke)

Revokes the message on WhatsApp with `deleteForEveryone: true`. Replaces the content with "This message was deleted" for every participant in the conversation, subject to the roughly 2-day-and-12-hour window after sending.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://ryzeapi.cloud/api/chat/delete/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "messageId": "3EB08FCF27E532F1B0F5",
      "deleteForEveryone": true
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/delete/${process.env.Instance_Name}`, {
    method: "DELETE",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      messageId:         "3EB08FCF27E532F1B0F5",
      deleteForEveryone: true
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.delete(
      f"https://ryzeapi.cloud/api/chat/delete/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "messageId":         "3EB08FCF27E532F1B0F5",
          "deleteForEveryone": True
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "messageId": "3EB08FCF27E532F1B0F5",
          "deleteForEveryone": true
      }`)
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/chat/delete/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Only for me

With `deleteForEveryone: false`, the message disappears only from your linked devices (synced via AppState). The recipient keeps seeing the original content normally.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://ryzeapi.cloud/api/chat/delete/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "messageId": "3EB08FCF27E532F1B0F5",
      "deleteForEveryone": false
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/delete/${process.env.Instance_Name}`, {
    method: "DELETE",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      messageId:         "3EB08FCF27E532F1B0F5",
      deleteForEveryone: false
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.delete(
      f"https://ryzeapi.cloud/api/chat/delete/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "messageId":         "3EB08FCF27E532F1B0F5",
          "deleteForEveryone": False
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "messageId": "3EB08FCF27E532F1B0F5",
          "deleteForEveryone": false
      }`)
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/chat/delete/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

<Tabs>
  <Tab title="Revoke">
    ```json 200 OK theme={null}
    {
      "success": true,
      "message": "Message deleted for everyone successfully",
      "message_id": "3EB08FCF27E532F1B0F5",
      "chat_jid": "5511999999999@s.whatsapp.net",
      "delete_type": "revoke",
      "deleted_for_everyone": true
    }
    ```
  </Tab>

  <Tab title="Delete for me">
    ```json 200 OK theme={null}
    {
      "success": true,
      "message": "Message deleted for me successfully",
      "message_id": "3EB08FCF27E532F1B0F5",
      "chat_jid": "5511999999999@s.whatsapp.net",
      "delete_type": "delete_for_me",
      "deleted_for_everyone": false
    }
    ```
  </Tab>
</Tabs>

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  TokenAccount or TokenInstance.
</ParamField>

## Request body

<ParamField body="messageId" type="string" required>
  ID of the message to delete.
</ParamField>

<ParamField body="deleteForEveryone" type="boolean" default="false">
  `true` revokes for everyone (`delete_type: "revoke"`); `false` deletes only locally (`delete_type: "delete_for_me"`).
</ParamField>

## Notes

<Note>
  * **Revoke** triggers a `message.exchange` event with `type: "message_revoke"` on the webhook/WebSocket.
  * **Delete for me** syncs via AppState with your other linked devices, but does not notify the recipient.
  * If the operation is repeated on an already revoked message, WhatsApp returns an error.
</Note>

## Error responses

| HTTP | `error.message`                         | When                                |
| ---- | --------------------------------------- | ----------------------------------- |
| 400  | `Invalid request body`                  | Malformed JSON.                     |
| 400  | `MessageID is required`                 | Missing field.                      |
| 401  | `Invalid token`                         | Missing/invalid token.              |
| 404  | `Instance not found`                    | Instance does not exist.            |
| 404  | `message not found`                     | `messageId` is not in the database. |
| 503  | `Instance is not connected to WhatsApp` | No active session.                  |
