# Excluir chat

`POST /chat/delete`

Pasta: **Chats**

## Autenticação

```http
token: {{token}}
```

## Descrição

# Excluir chat

Remove o chat no WhatsApp (quando possível) e apaga o registro correspondente no banco da instância. Identifique o chat por `chatid`/`number` ou pelo `id` interno.

## Endpoint

`POST {{baseUrl}}/chat/delete`

## Autenticação

Header obrigatório: `token: {{token}}`.

## Corpo da requisição

| Campo | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- |
| chatid | string | Não* | JID do chat |
| number | string | Não* | Número/JID alternativo |
| id | string | Não* | ID interno do registro de chat |

* Informe `id` **ou** `chatid`/`number`. Se houver destinatário (`chatid`/`number`), a API também tenta `DeleteChat` no WhatsApp antes de apagar no DB.

## Exemplo de Requisição

```bash
curl -X POST "{{baseUrl}}/chat/delete" \
  -H "token: {{token}}" \
  -H "Content-Type: application/json" \
  -d '{
    "chatid": "5511999999999@s.whatsapp.net"
  }'
```

## Resposta de Sucesso

```json
{
  "success": true
}
```

## Erros comuns

- `401` — token ausente ou inválido
- `400` — JSON inválido
- `500` — falha ao excluir no banco

## Observações

- Campos como `deleteChatDB` / `deleteMessagesDB` **não existem** neste handler — use apenas os campos da tabela acima.

## Corpo (exemplo)

```json
{
  "chatid": "5511999999999@s.whatsapp.net"
}
```

## cURL

```bash
curl -X POST "{{baseUrl}}/chat/delete" \
  -H "token: {{token}}" \
  -H "Content-Type: application/json" \
  -d '{
  "chatid": "5511999999999@s.whatsapp.net"
}'
```

---

[Índice da pasta](./index.md) · [Índice geral](../index.md) · [UI](https://gozap.dev/docs?op=chats/excluir-chat)
