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

# Marcar chat como leído

> Marca el chat completo como leído o no leído

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

## Descripción

Marca **todos** los mensajes no leídos de un chat como leídos (`read: true`) o deshace la marca (`read: false`). Es equivalente a abrir el chat en el teléfono: el contador de mensajes nuevos se resetea.

<Tip>
  Para marcar un único mensaje (sin resetear el contador), usa [`markRead`](/es/api/chat/mark-read).
</Tip>

## Ejemplos

### Marcar como leído

Con `read: true`, marca todos los mensajes no leídos del chat como leídos y resetea el contador, equivalente a abrir la conversación en el teléfono.

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

### Marcar como no leído

Con `read: false`, restaura el estado "no leído" en el chat para que aparezca destacado en la lista nuevamente, útil para revisar una conversación más tarde.

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

## Respuesta exitosa

La respuesta confirma la operación con `chat_jid` (JID resuelto desde `number`) y `read` reflejando el estado final. El `message` cambia según el valor de `read`: `"Chat marked as read successfully"` o `"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
}
```

## 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="read" type="boolean" required>
  `true` marca como leído, `false` marca como no leído.
</ParamField>

## Respuestas de error

| HTTP | `error.message`                         | Cuándo ocurre    |
| ---- | --------------------------------------- | ---------------- |
| 400  | `Instance name is required`             | ,                |
| 400  | `Invalid request body: <...>`           | JSON malformado. |
| 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" }
}
```

## Relacionados

<CardGroup cols={2}>
  <Card title="Marcar mensaje como leído" href="/es/api/chat/mark-read">
    Marca un solo mensaje.
  </Card>

  <Card title="Archivar chat" href="/es/api/chat/archive">
    Después de resetear el contador, archiva.
  </Card>
</CardGroup>
