---
title: "Get Message"
url: "https://docs.yoagent.dev/reference/rest-api/operations/getmessage"
---

# Get Message

GET

/v0/messages/{message_id}

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

```js
const response = await fetch("https://api.yoagent.dev/v0/messages/msg_01je56wqswfmn9pgbc1wq8tjgq", {
  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/msg_01je56wqswfmn9pgbc1wq8tjgq",
    headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"},
    timeout=60,
)
response.raise_for_status()
data = response.json()
```

- api.yoagent.dev/v0/messages/{message_id}

Get a message with bodies, links, codes and attachments.

## Authorizations

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

## Parameters

### Path Parameters

**message_id**

required

_Message Id_

string

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

## Responses

### 200

Successful Response

application/json

_MessageOut_

A full message: bodies, links, codes, attachments.

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

**cc**

required

_Cc_

Array\<object>

_Party_

A name and address from a header.

object

**name**

required

_Name_

string

**address**

required

_Address_

string

**bcc**

required

_Bcc_

Bcc of a message the inbox sent (only the sender’s copy knows them); empty for mail that came in

Array\<object>

_Party_

A name and address from a header.

object

**name**

required

_Name_

string

**address**

required

_Address_

string

**reply_to**

required

_Reply To_

Array\<object>

_Party_

A name and address from a header.

object

**name**

required

_Name_

string

**address**

required

_Address_

string

**message_id_header**

required

_Message Id Header_

Any of:

**string**

string

**null**

null

**in_reply_to**

required

_In Reply To_

Any of:

**string**

string

**null**

null

**references**

required

_References_

Array\<string>

**text**

required

_Text_

Any of:

**string**

string

**null**

null

**html**

required

_Html_

Any of:

**string**

string

**null**

null

**extracted_text**

required

_Extracted Text_

Any of:

**string**

string

**null**

null

**extracted_html**

required

_Extracted Html_

Any of:

**string**

string

**null**

null

**headers**

required

_Headers_

Array\<Array\<string>>

**links**

required

_Links_

Array\<object>

_Link_

A link found in a message when it arrived: its URL, its text and what it is for.

object

**url**

required

_Url_

string

**text**

required

_Text_

string

**kind**

required

_LinkKind_

What a link is for, guessed from its text and URL.

string

Allowed values: verify reset unsubscribe other

**codes**

required

_Codes_

Array\<object>

_Code_

A one-time code found in a message when it arrived, with the text around it.

object

**code**

required

_Code_

string

**context**

required

_Context_

string

**attachments**

required

_Attachments_

Array\<object>

_AttachmentOut_

An attachment; `download_url` gives its bytes (REST, same API key).

object

**attachment_id**

required

_Attachment Id_

string

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

**filename**

required

_Filename_

Any of:

**string**

string

**null**

null

**content_type**

required

_Content Type_

string

**size**

required

_Size_

integer

**inline**

required

_Inline_

boolean

**download_url**

required

_Download Url_

string

**truncated**

required

_Truncated_

The fields this answer cut for size (empty: nothing was cut). The REST API never cuts (always empty); the mail-MCP’s get_message cuts a body over its length limit (read it whole over REST). Fields an answer leaves out by choice (get_message’s html, extracted_html and headers without include_html) are not listed.

Array\<string>

Allowed values: text extracted_text html extracted_html links codes subject from to

#### Example

```json
{
  "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",
  "cc": [],
  "bcc": [],
  "reply_to": [],
  "message_id_header": "<4821.1764590400@example.com>",
  "in_reply_to": null,
  "references": [],
  "text": "Your sign-in code is 482913.",
  "html": "<p>Your sign-in code is <b>482913</b>. Or <a href=\"https://example.com/sign-in?code=482913\">Sign in</a>.</p>",
  "extracted_text": "Your sign-in code is 482913.",
  "extracted_html": "<p>Your sign-in code is <b>482913</b>. Or <a href=\"https://example.com/sign-in?code=482913\">Sign in</a>.</p>",
  "headers": [
    [
      "Subject",
      "Your sign-in code"
    ],
    [
      "From",
      "Example App <noreply@example.com>"
    ]
  ],
  "links": [
    {
      "url": "https://example.com/sign-in?code=482913",
      "text": "Sign in",
      "kind": "verify"
    }
  ],
  "codes": [
    {
      "code": "482913",
      "context": "Your sign-in code is 482913."
    }
  ],
  "attachments": [
    {
      "attachment_id": "att_01je56wqswfmn9pgbc1wq8tjgq",
      "filename": "invoice.pdf",
      "content_type": "application/pdf",
      "size": 48213,
      "inline": false,
      "download_url": "https://api.yoagent.dev/v0/messages/msg_01je56wqswfmn9pgbc1wq8tjgq/attachments/att_01je56wqswfmn9pgbc1wq8tjgq"
    }
  ],
  "truncated": []
}
```

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