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

# Desatribuir etiqueta

> Remove uma etiqueta (label) específica de um chat

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

## Descrição

Remove **uma** etiqueta de um chat. Se o chat não possuir aquela etiqueta, a operação é considerada sucesso (idempotente). A etiqueta em si **não é excluída**, para excluir use [Deletar etiqueta](/pt/api/chat/tags-delete).

## Exemplo

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

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

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

  requests.delete(
      f"https://ryzeapi.cloud/api/chat/assignTag/{os.environ['Instance_Name']}?number=5511999999999&tagId=2",
      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/assignTag/"+os.Getenv("Instance_Name")+"?number=5511999999999&tagId=2", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Resposta de sucesso

A resposta confirma a remoção ecoando o `tag_id`. O envelope reusa o mesmo shape de `tags-atribuir`, apenas com `message: "Tag removed successfully"`.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Tag removed successfully",
  "tag_id": "2"
}
```

## Parâmetros de rota

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

## Query params

<ParamField query="number" type="string" required>
  Telefone, JID privado (`...@s.whatsapp.net` ou `...@lid`), JID de grupo (`...@g.us`) ou newsletter.
</ParamField>

<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`             | ,             |
| 400  | `number query parameter is required`    | ,             |
| 400  | `tagId query parameter is required`     | ,             |
| 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="Atribuir etiqueta" href="/pt/api/chat/tags-assign">
    Reatribuir a etiqueta a outro chat.
  </Card>

  <Card title="Deletar etiqueta" href="/pt/api/chat/tags-delete">
    Excluir a etiqueta da instância inteira.
  </Card>
</CardGroup>
