# Contact Messages

> List every message and call to or from one contact, on any channel, with delivery status

URL: https://docs.lemuai.com/api-reference/contacts/messages

Returns every message sent to or received from a contact, newest first, on every channel: WhatsApp, email, SMS and voice calls. Each entry shows where the message is in its life (sent, delivered, read, failed) and what sent it.

**Endpoint:** `GET /api/v1/contacts/{contact_id}/messages`

## Headers

| Name | Required | Description |
|---|---|---|
| `X-API-Key` | Yes | An API key from your organization. See [Authentication](https://docs.lemuai.com/api-reference/authentication). |

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `contact_id` | integer | Yes | The contact's `id`, from [List contacts](https://docs.lemuai.com/api-reference/contacts/list) or an upsert response. |

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | No | How many messages to return, 1 to 200. Default `50`. |
| `before_id` | integer | No | Only return messages older than the message with this `id`. To get the next page, pass the `next_before_id` value from the previous response. |

**Example request:**

**cURL**

```bash
curl "https://app.lemuai.com/api/v1/contacts/901/messages?limit=20" \
  -H "X-API-Key: lemu_your_api_key"
```

**JavaScript**

```js
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901/messages?limit=20", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);
```

**Python**

```python
import os

import requests

response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/901/messages?limit=20",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

## Response

**`200`**
```json
{
  "messages": [
    {
      "id": 77120,
      "channel": "whatsapp",
      "direction": "outbound",
      "status": "read",
      "provider": "meta",
      "provider_status": "read",
      "template_name": "cart_reminder",
      "text": "Hi Priya, you left something in your cart. Complete your order here: https://le2.in/abc123",
      "source_type": "automation",
      "source_id": 3318,
      "workflow_run_id": null,
      "error": null,
      "meta": {},
      "created_at": "2026-10-27T10:14:05Z",
      "sent_at": "2026-10-27T10:14:06Z",
      "delivered_at": "2026-10-27T10:14:09Z",
      "read_at": "2026-10-27T10:20:31Z",
      "failed_at": null
    },
    {
      "id": 77064,
      "channel": "voice",
      "direction": "outbound",
      "status": "delivered",
      "provider": "plivo",
      "provider_status": "completed",
      "template_name": null,
      "source_type": "campaign",
      "source_id": 214,
      "workflow_run_id": 51290,
      "error": null,
      "meta": { "duration": 94 },
      "created_at": "2026-10-26T15:02:11Z",
      "sent_at": "2026-10-26T15:02:12Z",
      "delivered_at": "2026-10-26T15:02:20Z",
      "read_at": null,
      "failed_at": null
    }
  ],
  "next_before_id": null
}
```

| Field | Type | Description |
|---|---|---|
| `messages` | array | The messages on this page, newest first. |
| `messages[].id` | integer | The message's id. |
| `messages[].channel` | string | `whatsapp`, `email`, `sms` or `voice`. A call is one message on the `voice` channel. |
| `messages[].direction` | string | `outbound` (sent to the contact) or `inbound` (received from the contact). |
| `messages[].status` | string | Where the message is now. See [Message status](#message-status). |
| `messages[].provider` | string or null | The service that carried the message, for example the WhatsApp, email or telephony provider. |
| `messages[].provider_status` | string or null | The provider's own last status word, before LemuAI mapped it to `status`. |
| `messages[].template_name` | string or null | The WhatsApp or email template used, if any. |
| `messages[].text` | string or null | The message's text, up to 1,000 characters: what was written, or a template's filled-in text. `null` for calls and messages with no text. |
| `messages[].source_type` | string or null | What sent it: `automation` (a journey), `campaign`, `voice_agent` (an agent during a call), `transactional` (the [transactional email API](https://docs.lemuai.com/api-reference/email/send)), `inbox` (a team member replying in the Inbox), `manual` (a call placed by hand or through the API), `inbound_call`, `customer` (a message the contact sent you) or `test`. |
| `messages[].source_id` | integer or null | The id of what sent it, such as the journey run, the campaign or the call. |
| `messages[].workflow_run_id` | integer or null | The call this message is (voice), or the call it was sent during (for example a WhatsApp message sent by an agent tool). |
| `messages[].error` | string or null | Why the message failed, when `status` is `failed`. |
| `messages[].meta` | object | Extra details about the message, for example a call's `duration` in seconds. |
| `messages[].created_at` | string | When the message was created, in ISO 8601 (UTC). |
| `messages[].sent_at`, `delivered_at`, `read_at`, `failed_at` | string or null | When the message reached each status. `null` if it hasn't. |
| `next_before_id` | integer or null | Pass this as `before_id` to get the next page. `null` on the last page. |

## Message status

Outbound messages move forward through these statuses, or end as `failed`:

| Status | Meaning |
|---|---|
| `queued` | Waiting to be sent. |
| `sent` | Handed to the provider. |
| `delivered` | Reached the person. For a call, the call was answered. |
| `read` | The person opened it. For email, the email was opened. |
| `clicked` | For email, the person clicked a tracked link. |
| `failed` | It couldn't be sent or delivered. See `error`. |
| `received` | An inbound message from the contact. |

## Errors

| Status | When |
|---|---|
| `401` | The API key is missing or not valid. |
| `404` | No contact with this id in your organization. |
| `422` | `limit` is outside 1 to 200, or `before_id` isn't a number. |

See [Errors](https://docs.lemuai.com/api-reference/errors) for the error format.
