Update Messages
curl -s -X POST "https://api.yoagent.dev/v0/messages/update" \ -H "Authorization: Bearer $YOAGENT_KEY" \ -H "Content-Type: application/json" \ -d '{"add_labels":["unread"],"message_ids":["msg_01je56wqswfmn9pgbc1wq8tjgq"]}'const response = await fetch("https://api.yoagent.dev/v0/messages/update", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOAGENT_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "add_labels": [ "unread" ], "message_ids": [ "msg_01je56wqswfmn9pgbc1wq8tjgq" ] }),});if (!response.ok) throw new Error(await response.text());const data = await response.json();import os
import requests
response = requests.post( "https://api.yoagent.dev/v0/messages/update", headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"}, json={ "add_labels": [ "unread", ], "message_ids": [ "msg_01je56wqswfmn9pgbc1wq8tjgq", ], }, timeout=60,)response.raise_for_status()data = response.json()Add or remove labels of messages (up to 200; read is removing unread): all of them or none — one the caller
does not see is 404, one it may not change 403. The changed messages as list rows.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Add or remove labels of messages (read is removing unread): all of them or none.
object
Labels to add: unread or the project’s own.
Labels to remove: unread (marks it read) or the project’s own.
The messages to change.
Responses
Section titled “Responses”Successful Response
The messages a batch changed, as list rows (their labels and version after it).
object
A message in a list: no bodies.
object
Goes up by one on every change: of two copies, the one with the higher version is the newer.
A name and address from a header.
object
A name and address from a header.
object
Example
{ "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
Section titled “default”An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: Errors.