> ## 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 mensaje como leído

> Marca un mensaje específico como leído (envía el ACK de lectura al remitente)

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

## Descripción

Envía el ACK de lectura para un mensaje **específico**, el efecto visible para el remitente es el "doble check azul". Para marcar el chat completo de una vez, usa [`markChatRead`](/es/api/chat/mark-chat-read).

<Warning>
  En **grupos**, el campo `sender` (JID del autor del mensaje) es **obligatorio**. En conversaciones 1 a 1 es opcional y puede omitirse.
</Warning>

## Ejemplos

### DM

En una conversación 1 a 1, basta con `messageId` y el `number` del contacto. `sender` puede omitirse, el servidor infiere el autor a partir del JID del chat.

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

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

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

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

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

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

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

### Grupo (con sender)

En un grupo (`@g.us`), el campo `sender` con el JID del autor del mensaje es obligatorio, sin él WhatsApp no puede enrutar correctamente el ACK de lectura.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/chat/markRead/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "messageId": "3EB08FCF27E532F1B0F5",
      "number":    "120363123456789@g.us",
      "sender":    "5511999999999@s.whatsapp.net"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/markRead/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      messageId: "3EB08FCF27E532F1B0F5",
      number:    "120363123456789@g.us",
      sender:    "5511999999999@s.whatsapp.net"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/chat/markRead/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "messageId": "3EB08FCF27E532F1B0F5",
          "number":    "120363123456789@g.us",
          "sender":    "5511999999999@s.whatsapp.net"
      }
  )
  ```

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

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

  func main() {
      body := strings.NewReader(`{
          "messageId": "3EB08FCF27E532F1B0F5",
          "number":    "120363123456789@g.us",
          "sender":    "5511999999999@s.whatsapp.net"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/chat/markRead/"+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 refleja el `message_id` que fue marcado y el `chat_jid` resuelto. Útil para auditar qué mensajes se marcaron como leídos, especialmente en flujos automáticos que confirman recepción tras procesar el mensaje.

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

## 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="messageId" type="string" required>
  ID del mensaje a marcar como leído.
</ParamField>

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

<ParamField body="sender" type="string">
  JID del autor del mensaje (`...@s.whatsapp.net` o `...@lid`). **Obligatorio en grupos.** Opcional en DMs.
</ParamField>

## Respuestas de error

| HTTP | `error.message`                         | Cuándo ocurre               |
| ---- | --------------------------------------- | --------------------------- |
| 400  | `Instance name is required`             | ,                           |
| 400  | `Invalid request body: <...>`           | JSON malformado.            |
| 400  | `messageId is required`                 | ,                           |
| 400  | `Number is required`                    | ,                           |
| 400  | `sender is required for group messages` | Falta `sender` en un grupo. |
| 401  | `Invalid token`                         | ,                           |
| 404  | `Instance not found`                    | ,                           |
| 503  | `Instance is not connected to WhatsApp` | ,                           |

```json Error 400 theme={null}
{
  "success": false,
  "error": { "message": "sender is required for group messages" }
}
```

## Relacionados

<CardGroup cols={2}>
  <Card title="Marcar chat como leído" href="/es/api/chat/mark-chat-read">
    Marca el chat completo de una vez.
  </Card>

  <Card title="Estado de entrega" href="/es/api/chat/contact-status">
    Verifica el estado actual del mensaje.
  </Card>
</CardGroup>
