> ## 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.

# Deletar etiqueta

> Remove uma etiqueta (label) e limpa todas as suas atribuições

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** sim

## Descrição

Remove a etiqueta identificada por `tagId` e também desatribui automaticamente de todos os chats que a possuíam. A propagação até o WhatsApp via app state pode levar **1 a 2 segundos**.

## Exemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://ryzeapi.cloud/api/chat/tag/$Instance_Name?tagId=3" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/tag/${process.env.Instance_Name}?tagId=3`, {
    method: "DELETE",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

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

  requests.delete(
      f"https://ryzeapi.cloud/api/chat/tag/{os.environ['Instance_Name']}?tagId=3",
      headers={"token": os.environ["Token_Instance"]}
  )
  ```

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

  import (
      "net/http"
      "os"
  )

  func main() {
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/chat/tag/"+os.Getenv("Instance_Name")+"?tagId=3", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Resposta de sucesso

O envelope vem com `tag` contendo apenas o `id` removido e `deleted: true`, os demais campos (`name`, `color`, `type`) ficam vazios pois a etiqueta já não existe mais. Use `success` para auditar a operação.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Tag deleted successfully",
  "tag": {
    "id": "3",
    "name": "",
    "color": 0,
    "type": "",
    "deleted": true
  }
}
```

## Parâmetros de rota

<ParamField path="instance" type="string" required>
  Nome da instância.
</ParamField>

## Query params

<ParamField query="tagId" type="string" required>
  ID da etiqueta a remover.
</ParamField>

## Headers

| Nome    | Obrigatório              | Exemplo        | Descrição                      |
| ------- | ------------------------ | -------------- | ------------------------------ |
| `token` | sim (ou `Authorization`) | `a1b2c3d4-...` | TokenAccount ou TokenInstance. |

## Respostas de erro

| HTTP | `error.message`                         | Quando ocorre      |
| ---- | --------------------------------------- | ------------------ |
| 400  | `Instance name is required`             | `:instance` vazio. |
| 400  | `tagId query parameter is required`     | `tagId` ausente.   |
| 401  | `Invalid token`                         | ,                  |
| 404  | `Instance not found`                    | ,                  |
| 404  | `Tag not found`                         | ,                  |
| 503  | `Instance is not connected to WhatsApp` | ,                  |

```json Erro 400 theme={null}
{
  "success": false,
  "error": { "message": "tagId query parameter is required" }
}
```

## Relacionados

<CardGroup cols={2}>
  <Card title="Listar etiquetas" href="/pt/api/chat/tags-list">
    Conferir os IDs disponíveis.
  </Card>

  <Card title="Desatribuir etiqueta" href="/pt/api/chat/tags-unassign">
    Remover a etiqueta de um chat específico em vez de excluir.
  </Card>
</CardGroup>
