> ## 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 entire chat

> Removes a chat locally, optionally deleting media as well

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

Removes a chat (conversation) from your WhatsApp list. Optionally also deletes the locally stored media files.

<Warning>
  **Local operation only.** Other participants (in groups) or the recipient (in DMs) keep seeing the history on their side. To leave a group, use [`DELETE /api/group/leave`](/en/api/groups/leave).
</Warning>

## Examples

### Keep media local

Removes the chat from the WhatsApp list but preserves the media files stored locally (S3/disk). Useful when you still want to keep attachments for auditing or reprocessing.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://ryzeapi.cloud/api/chat/deleteChat/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{"number": "5511999999999"}'
  ```

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

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

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

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

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

  func main() {
      body := strings.NewReader(`{"number": "5511999999999"}`)
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/chat/deleteChat/"+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>

### Delete media too

With `deleteMedia: true`, in addition to removing the chat the server also deletes the media files stored locally for that conversation. Irreversible on the RyzeAPI side.

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

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

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

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

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

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

  func main() {
      body := strings.NewReader(`{
          "number": "5511999999999",
          "deleteMedia": true
      }`)
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/chat/deleteChat/"+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

```json 200 OK theme={null}
{
  "success": true,
  "message": "Chat deleted successfully (including media)",
  "chat_jid": "5511999999999@s.whatsapp.net",
  "delete_media": true
}
```

The `message` changes depending on `deleteMedia`:

* `false` → `"Chat deleted successfully"`
* `true` → `"Chat deleted successfully (including media)"`

## 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="number" type="string" required>
  Number (`5511999999999`) or JID (`5511999999999@s.whatsapp.net`, `...@lid`, `120363...@g.us`) of the chat.
</ParamField>

<ParamField body="deleteMedia" type="boolean" default="false">
  If `true`, also removes the media files stored locally for this chat.
</ParamField>

## Notes

<Note>
  * The chat disappears from your list on every linked device (synced via AppState).
  * In groups, deleting the chat does **not** leave the group, the group link remains.
  * The phone's WhatsApp has independent storage; `deleteMedia` here only affects the media saved by RyzeAPI on S3/disk.
</Note>

## Error responses

| HTTP | `error.message`                         | When               |
| ---- | --------------------------------------- | ------------------ |
| 400  | `Invalid request body`                  | Malformed JSON.    |
| 400  | `Number is required`                    | Missing field.     |
| 401  | `Invalid token`                         | ,                  |
| 404  | `Instance not found`                    | ,                  |
| 503  | `Instance is not connected to WhatsApp` | No active session. |
