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

# Mark chat as read

> Marks the entire chat as read or unread

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

## Description

Marks **all** unread messages of a chat as read (`read: true`) or undoes the marking (`read: false`). It is equivalent to opening the chat on the phone: the new-messages badge resets.

<Tip>
  To mark a single message (without resetting the badge), use [`markRead`](/en/api/chat/mark-read).
</Tip>

## Examples

### Mark as read

With `read: true`, marks all unread messages of the chat as read and resets the badge, equivalent to opening the conversation on the phone.

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

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

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

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

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

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

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

### Mark as unread

With `read: false`, restores the "unread" state on the chat so it appears highlighted in the list again, useful to revisit a conversation later.

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

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

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

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

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

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

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

The response confirms the operation with `chat_jid` (JID resolved from `number`) and `read` reflecting the final state. The `message` changes depending on the value of `read`: `"Chat marked as read successfully"` or `"Chat marked as unread successfully"`.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Chat marked as read successfully",
  "chat_jid": "5511999999999@s.whatsapp.net",
  "read": true
}
```

## 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="read" type="boolean" required>
  `true` marks as read, `false` marks as unread.
</ParamField>

## Error responses

| HTTP | `error.message`                         | When it happens |
| ---- | --------------------------------------- | --------------- |
| 400  | `Instance name is required`             | ,               |
| 400  | `Invalid request body: <...>`           | Malformed JSON. |
| 400  | `Number is required`                    | ,               |
| 401  | `Invalid token`                         | ,               |
| 404  | `Instance not found`                    | ,               |
| 503  | `Instance is not connected to WhatsApp` | ,               |

```json Error 400 theme={null}
{
  "success": false,
  "error": { "message": "Number is required" }
}
```

## Related

<CardGroup cols={2}>
  <Card title="Mark message as read" href="/en/api/chat/mark-read">
    Mark a single message.
  </Card>

  <Card title="Archive chat" href="/en/api/chat/archive">
    After resetting the badge, archive.
  </Card>
</CardGroup>
