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

# Silenciar chat

> Silencia las notificaciones de un chat por un periodo definido o indefinido

**Auth:** `TokenAccount` o `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** sí

## Descripción

Silencia (`mute: true`) o reactiva (`mute: false`) un chat. El parámetro `duration` acepta varios formatos legibles para definir la ventana.

## Ejemplos

### Silenciar por 8h

Silencia el chat por una ventana de 8 horas con `duration: "8h"`. Al final del periodo las notificaciones vuelven automáticamente, no se necesita otra llamada.

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

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

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

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

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

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

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

### Silenciar permanentemente

Con `duration: "always"` (también acepta `"forever"` y `"permanent"`), el chat queda silenciado por tiempo indefinido hasta que envíes otra llamada con `mute: false`.

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

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

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

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

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

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

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

### Reactivar (unmute)

Con `mute: false`, quita cualquier silencio activo del chat y las notificaciones se reanudan normalmente. El campo `duration` es ignorado en esta variante.

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

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

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

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

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

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

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

## Respuesta exitosa

`muted` indica el estado final y `duration` viene en segundos (`28800` = 8h, `604800` = 1 semana, `0` = permanente o sin silencio). El `message` cambia por operación: `"Chat muted permanently"`, `"Chat muted for 8 hours"`, `"Chat muted for 1 week"` o `"Chat notifications unmuted successfully"`.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Chat muted for 8 hours",
  "chat_jid": "5511999999999@s.whatsapp.net",
  "muted": true,
  "duration": 28800
}
```

## Parámetros de ruta

<ParamField path="instance" type="string" required>
  Nombre de la instancia.
</ParamField>

## Cabeceras

| Nombre         | Requerido              | Ejemplo            | Descripción                   |
| -------------- | ---------------------- | ------------------ | ----------------------------- |
| `Content-Type` | sí                     | `application/json` | ,                             |
| `token`        | sí (o `Authorization`) | `a1b2c3d4-...`     | TokenAccount o TokenInstance. |

## Cuerpo de la solicitud

<ParamField body="number" type="string" required>
  Número de teléfono, JID privado (`...@s.whatsapp.net` o `...@lid`), JID de grupo (`...@g.us`) o newsletter.
</ParamField>

<ParamField body="mute" type="boolean" required>
  `true` silencia, `false` reactiva.
</ParamField>

<ParamField body="duration" type="string">
  Duración del silencio. Acepta los formatos de la tabla siguiente. Ignorado cuando `mute=false`.
</ParamField>

### Valores aceptados para `duration`

| Valor                                  | Significado    |
| -------------------------------------- | -------------- |
| `"8h"` o `"8 hours"`                   | 8 horas        |
| `"1w"`, `"7d"` o `"1 week"`            | 1 semana       |
| `"always"`, `"forever"`, `"permanent"` | Sin expiración |
| (vacío)                                | Sin expiración |

## Respuestas de error

| HTTP | `error.message`                         | Cuándo ocurre          |
| ---- | --------------------------------------- | ---------------------- |
| 400  | `Instance name is required`             | ,                      |
| 400  | `Invalid request body: <...>`           | JSON malformado.       |
| 400  | `Number is required`                    | ,                      |
| 400  | `Invalid duration: <...>`               | Formato no reconocido. |
| 401  | `Invalid token`                         | ,                      |
| 404  | `Instance not found`                    | ,                      |
| 503  | `Instance is not connected to WhatsApp` | ,                      |

```json Error 400 theme={null}
{
  "success": false,
  "error": { "message": "Invalid duration: 5y" }
}
```

## Relacionados

<CardGroup cols={2}>
  <Card title="Archivar chat" href="/es/api/chat/archive">
    `POST /api/chat/archive/:instance`
  </Card>

  <Card title="Bloquear contacto" href="/es/api/chat/block">
    `POST /api/chat/block/:instance`
  </Card>
</CardGroup>
