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

# Mute chat

> Mutes notifications for a chat for a defined or indefinite period

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

## Description

Mutes (`mute: true`) or unmutes (`mute: false`) a chat. The `duration` parameter accepts several human-readable formats to set the window.

## Examples

### Mute for 8h

Mutes the chat for an 8-hour window with `duration: "8h"`. At the end of the period notifications come back automatically, no other call is needed.

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

### Mute permanently

With `duration: "always"` (also accepts `"forever"` and `"permanent"`), the chat stays muted indefinitely until you send another call with `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>

### Unmute

With `mute: false`, removes any active mute on the chat and notifications resume normally. The `duration` field is ignored in this variant.

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

## Success response

`muted` indicates the final state and `duration` comes in seconds (`28800` = 8h, `604800` = 1 week, `0` = permanent or unmuted). The `message` changes per operation: `"Chat muted permanently"`, `"Chat muted for 8 hours"`, `"Chat muted for 1 week"`, or `"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
}
```

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name.
</ParamField>

## Headers

| Name           | Required                 | Example            | Description                    |
| -------------- | ------------------------ | ------------------ | ------------------------------ |
| `Content-Type` | yes                      | `application/json` | ,                              |
| `token`        | yes (or `Authorization`) | `a1b2c3d4-...`     | TokenAccount or TokenInstance. |

## Request body

<ParamField body="number" type="string" required>
  Phone number, private JID (`...@s.whatsapp.net` or `...@lid`), group JID (`...@g.us`), or newsletter.
</ParamField>

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

<ParamField body="duration" type="string">
  Mute duration. Accepts the formats in the table below. Ignored when `mute=false`.
</ParamField>

### Accepted values for `duration`

| Value                                  | Meaning       |
| -------------------------------------- | ------------- |
| `"8h"` or `"8 hours"`                  | 8 hours       |
| `"1w"`, `"7d"`, or `"1 week"`          | 1 week        |
| `"always"`, `"forever"`, `"permanent"` | No expiration |
| (empty)                                | No expiration |

## Error responses

| HTTP | `error.message`                         | When it happens      |
| ---- | --------------------------------------- | -------------------- |
| 400  | `Instance name is required`             | ,                    |
| 400  | `Invalid request body: <...>`           | Malformed JSON.      |
| 400  | `Number is required`                    | ,                    |
| 400  | `Invalid duration: <...>`               | Unrecognized format. |
| 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" }
}
```

## Related

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

  <Card title="Block contact" href="/en/api/chat/block">
    `POST /api/chat/block/:instance`
  </Card>
</CardGroup>
