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

# Buscar mensaje por ID

> Recupera el snapshot de un mensaje almacenado por la ingestión

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

## Descripción

Devuelve el snapshot persistido de un mensaje (texto, media, leyenda, mimetype, tamaño, etc.) que ya fue procesado por la ingestión. Útil para rehidratar un mensaje a partir del `messageId` recibido en un webhook o en otro endpoint de la API.

## Ejemplos

### Por id

Recupera el snapshot del mensaje usando la query `?messageId=<message-id>`. Devuelve el registro completo (texto, media, leyenda, mimetype, tamaño) persistido por la ingestión.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://ryzeapi.cloud/api/chat/getMessage/$Instance_Name?messageId=3EB08FCF27E532F1B0F5" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/chat/getMessage/${process.env.Instance_Name}?messageId=3EB08FCF27E532F1B0F5`, {
    method: "GET",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

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

  requests.get(
      f"https://ryzeapi.cloud/api/chat/getMessage/{os.environ['Instance_Name']}?messageId=3EB08FCF27E532F1B0F5",
      headers={"token": os.environ["Token_Instance"]}
  )
  ```

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

  import (
      "net/http"
      "os"
  )

  func main() {
      req, _ := http.NewRequest("GET", "https://ryzeapi.cloud/api/chat/getMessage/"+os.Getenv("Instance_Name")+"?messageId=3EB08FCF27E532F1B0F5", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Respuesta exitosa

El snapshot viene en `data` con `type`, `from`, `to`, `chat`, `timestamp`, `isGroup` y el `status` de envío. Para mensajes de texto, `content` lleva el cuerpo; para media, aparece el objeto `media` con `type`, `mimeType`, `size` y `duration` (audio/video). Usa `messageId` del envoltorio para referenciar este mensaje en llamadas posteriores (favorito, reenviar, editar).

```json 200 OK theme={null}
{
  "success": true,
  "message": "Message found",
  "messageId": "3EB08FCF27E532F1B0F5",
  "data": {
    "content": "Hi!",
    "type": "text",
    "from": "5511999999999@s.whatsapp.net",
    "to": "5511888888888@s.whatsapp.net",
    "chat": "5511999999999@s.whatsapp.net",
    "timestamp": "2026-04-28T14:30:00Z",
    "isGroup": false,
    "status": "delivered"
  },
  "status": "found"
}
```

## Parámetros de ruta

<ParamField path="instance" type="string" required>
  Nombre de la instancia.
</ParamField>

## Parámetros de consulta

<ParamField query="messageId" type="string" required>
  ID del mensaje (requerido).
</ParamField>

## Cabeceras

| Nombre  | Requerido              | Ejemplo        | Descripción                   |
| ------- | ---------------------- | -------------- | ----------------------------- |
| `token` | sí (o `Authorization`) | `a1b2c3d4-...` | TokenAccount o TokenInstance. |

## Respuestas de error

| HTTP | `error.message`                                        | Cuándo ocurre                        |
| ---- | ------------------------------------------------------ | ------------------------------------ |
| 400  | `Message ID is required (use ?messageId=<message-id>)` | Falta `messageId`.                   |
| 404  | `Instance not found`                                   | ,                                    |
| 404  | `Message not found`                                    | El ID no existe en la base de datos. |
| 503  | `Instance is not connected to WhatsApp`                | ,                                    |

```json Error 400 theme={null}
{
  "success": false,
  "error": { "message": "Message ID is required (use ?messageId=<message-id>)" }
}
```

## Relacionados

<CardGroup cols={2}>
  <Card title="Media en base64" href="/es/api/chat/media-base64">
    Recupera el media bruto a partir del `messageId`.
  </Card>

  <Card title="Estado de entrega" href="/es/api/chat/contact-status">
    Verifica si fue entregado/leído.
  </Card>
</CardGroup>
