> ## 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 mensagem como lida

> Marca uma mensagem específica como lida (envia ACK de leitura ao remetente)

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** sim

## Descrição

Envia o ACK de leitura para uma mensagem **específica**, o efeito visível para o remetente é o "check azul". Para marcar o chat inteiro de uma vez, use [`markChatRead`](/pt/api/chat/mark-chat-read).

<Warning>
  Em **grupos**, o campo `sender` (JID do autor da mensagem) é **obrigatório**. Em conversas 1-a-1, é opcional, pode ser omitido.
</Warning>

## Exemplos

### DM

Em conversa 1-a-1, basta `messageId` e `number` do contato. O `sender` é dispensado, o servidor infere o autor a partir do JID do 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 (com sender)

Em grupo (`@g.us`), o campo `sender` com o JID do autor da mensagem é obrigatório, sem ele o WhatsApp não consegue rotear o ACK de leitura corretamente.

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

## Resposta de sucesso

A resposta ecoa o `message_id` marcado e o `chat_jid` resolvido. Útil para auditar quais mensagens foram marcadas como lidas, especialmente em fluxos automáticos que confirmam recibo após processar a mensagem.

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

<ParamField path="instance" type="string" required>
  Nome da instância.
</ParamField>

## Headers

| Nome           | Obrigatório              | Exemplo            | Descrição                      |
| -------------- | ------------------------ | ------------------ | ------------------------------ |
| `Content-Type` | sim                      | `application/json` | ,                              |
| `token`        | sim (ou `Authorization`) | `a1b2c3d4-...`     | TokenAccount ou TokenInstance. |

## Request body

<ParamField body="messageId" type="string" required>
  ID da mensagem que será marcada como lida.
</ParamField>

<ParamField body="number" type="string" required>
  JID do chat: telefone, JID privado (`...@s.whatsapp.net` ou `...@lid`), grupo (`...@g.us`) ou newsletter.
</ParamField>

<ParamField body="sender" type="string">
  JID do autor da mensagem (`...@s.whatsapp.net` ou `...@lid`). **Obrigatório em grupos.** Em DM, opcional.
</ParamField>

## Respostas de erro

| HTTP | `error.message`                         | Quando ocorre             |
| ---- | --------------------------------------- | ------------------------- |
| 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` | Faltou `sender` em grupo. |
| 401  | `Invalid token`                         | ,                         |
| 404  | `Instance not found`                    | ,                         |
| 503  | `Instance is not connected to WhatsApp` | ,                         |

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

## Relacionados

<CardGroup cols={2}>
  <Card title="Marcar chat como lido" href="/pt/api/chat/mark-chat-read">
    Marca o chat inteiro de uma vez.
  </Card>

  <Card title="Status de entrega" href="/pt/api/chat/contact-status">
    Conferir o status atual da mensagem.
  </Card>
</CardGroup>
