---
title: "List Messages"
url: "https://docs.yoagent.dev/reference/rest-api/operations/listmessages"
---

# List Messages

GET

/v0/messages

```sh
curl -s "https://api.yoagent.dev/v0/messages" \
  -H "Authorization: Bearer $YOAGENT_KEY"
```

```js
const response = await fetch("https://api.yoagent.dev/v0/messages", {
  headers: {
    Authorization: `Bearer ${process.env.YOAGENT_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

```python
import os

import requests

response = requests.get(
    "https://api.yoagent.dev/v0/messages",
    headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"},
    timeout=60,
)
response.raise_for_status()
data = response.json()
```

- api.yoagent.dev/v0/messages

List messages of all inboxes, newest first, with filters; `project_id` narrows it to one project, `inbox_id` to one inbox.

## Authorizations

- **[ApiKey](https://docs.yoagent.dev/reference/rest-api#apikey)**

## Parameters

### Query Parameters

**from**

_From_

Any of:

**string**

string

\>= 1 characters <= 200 characters

**null**

null

A part of the sender’s address or name, in any case.

**subject**

_Subject_

Any of:

**string**

string

\>= 1 characters <= 200 characters

**null**

null

A part of the subject, in any case.

**limit**

_Limit_

integer

default: 20 >= 1 <= 100

How many items a page holds.

**page_token**

_Page Token_

Any of:

**string**

The next_page_token of the previous page

string

**null**

null

The previous page’s `next_page_token`, for the page after it; omitted: the first page.

**project_id**

_Project Id_

Any of:

**string**

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**null**

null

Only those of this project; omitted: of every project the caller sees.

**inbox_id**

_Inbox Id_

Any of:

**string**

Inbox id (inb\_…), address or \*@domain (the catch-all)

string

**null**

null

Only this inbox’s: its id, address or `*@domain` (the catch-all).

**to**

_To_

Any of:

**string**

string

**null**

null

Only mail that came to this address.

**labels**

_Labels_

Array\<string>

default: <= 20 items

Messages that carry all of these.

**exclude_labels**

_Exclude Labels_

Array\<string>

default: <= 20 items

Messages that carry none of these (`received` without `unread`: the Read folder).

**search**

_Search_

Any of:

**string**

Words to find in mail, all of them: in the subject, body, names, addresses and file names (`or` between words, `-word` to leave out; quotes do not make a phrase)

string

\>= 1 characters <= 200 characters

**null**

null

Only mail with these words.

**after**

_After_

Any of:

**string**

string format: date-time

**null**

null

Only mail received after this time.

**before**

_Before_

Any of:

**string**

string format: date-time

**null**

null

Only mail received before this time.

## Responses

### 200

Successful Response

application/json

_MessageList_

A page of messages.

object

**count**

required

_Count_

integer

**next_page_token**

required

_Next Page Token_

Any of:

**string**

string

**null**

null

**messages**

required

_Messages_

Array\<object>

_MessageItem_

A message in a list: no bodies.

object

**version**

required

_Version_

Goes up by one on every change: of two copies, the one with the higher version is the newer.

integer

**message_id**

required

_Message Id_

string

/^msg\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**project_id**

required

_Project Id_

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**inbox_id**

required

_Inbox Id_

string

/^inb\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**thread_id**

required

_Thread Id_

string

/^thr\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**envelope_to**

required

_Envelope To_

The address the message came to; null for a message the inbox sent (`sent`).

Any of:

**string**

string

**null**

null

**envelope_from**

required

_Envelope From_

string

**plus_tag**

required

_Plus Tag_

Any of:

**string**

string

**null**

null

**from**

required

_From_

Array\<object>

_Party_

A name and address from a header.

object

**name**

required

_Name_

string

**address**

required

_Address_

string

**to**

required

_To_

Array\<object>

_Party_

A name and address from a header.

object

**name**

required

_Name_

string

**address**

required

_Address_

string

**subject**

required

_Subject_

Any of:

**string**

string

**null**

null

**preview**

required

_Preview_

Any of:

**string**

string

**null**

null

**labels**

required

_Labels_

Array\<string>

**size**

required

_Size_

integer

**received_at**

required

_Received At_

string format: date-time

#### Example

```json
{
  "count": 1,
  "next_page_token": null,
  "messages": [
    {
      "version": 1,
      "message_id": "msg_01je56wqswfmn9pgbc1wq8tjgq",
      "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
      "inbox_id": "inb_01je56wqswfmn9pgbc1wq8tjgq",
      "thread_id": "thr_01je56wqswfmn9pgbc1wq8tjgq",
      "envelope_to": "test@k7m2xq4p.yoagent.email",
      "envelope_from": "bounce@example.com",
      "plus_tag": null,
      "from": [
        {
          "name": "Example App",
          "address": "noreply@example.com"
        }
      ],
      "to": [
        {
          "name": "",
          "address": "test@k7m2xq4p.yoagent.email"
        }
      ],
      "subject": "Your sign-in code",
      "preview": "Your sign-in code is 482913.",
      "labels": [
        "received",
        "unread"
      ],
      "size": 66000,
      "received_at": "2026-12-01T12:00:00Z"
    }
  ]
}
```

### default

An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: [Errors](https://docs.yoagent.dev/reference/conventions#errors).
