Skip to content

Update Message

PATCH
/v0/messages/{message_id}
curl -s -X PATCH "https://api.yoagent.dev/v0/messages/msg_01je56wqswfmn9pgbc1wq8tjgq" \
-H "Authorization: Bearer $YOAGENT_KEY" \
-H "Content-Type: application/json" \
-d '{"add_labels":["unread"]}'

Add or remove labels of a message.

message_id
required
Message Id
string
/^msg_[0-7][0-9a-hjkmnp-tv-z]{25}$/
Media typeapplication/json
MessageUpdate

Add or remove labels of a message.

object
add_labels
Add Labels

Labels to add: unread or the project’s own.

Array<string>
default: <= 20 items
remove_labels
Remove Labels

Labels to remove: unread (marks it read) or the project’s own.

Array<string>
default: <= 20 items

Successful Response

Media typeapplication/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
envelope_from
required
Envelope From
string
plus_tag
required
Plus Tag
Any of:
string
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
preview
required
Preview
Any of:
string
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
in_reply_to
required
In Reply To
Any of:
string
references
required
References
Array<string>
text
required
Text
Any of:
string
html
required
Html
Any of:
string
extracted_text
required
Extracted Text
Any of:
string
extracted_html
required
Extracted Html
Any of:
string
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
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

{
"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": []
}

An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: Errors.