Skip to content

Send, reply and forward

Every inbox sends from its own address, under its display_name. A send goes to YoAgent inboxes and to any address outside alike.

Terminal window
curl -s https://api.yoagent.dev/v0/inboxes/support@k7m2xq4p.yoagent.email/messages/send \
-H "Authorization: Bearer $YOAGENT_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: welcome-4821" \
-d '{"to": ["ada@example.com"], "subject": "Welcome", "text": "Your account is ready."}'
Field What it does
to, cc, bcc Lists of addresses. At least one recipient, at most 50 together, and no more than your plan’s recipients a minute (10 on Free).
subject One line
text, html The body as plain text, HTML or both
reply_to Where replies should go, when not to this inbox
attachments Files, below
labels Your own labels for the sent copy

The answer, {"message_id", "thread_id"}, comes as soon as the message is accepted: delivery happens after it (below). The sent copy is in the inbox with the label sent.

Operation MCP What it does
POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply reply_to_message Answers the message’s Reply-To, or its sender (of a message the inbox sent: its recipients), in the same thread, with the subject Re: …
POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply-all reply_to_message(inbox_id=…, message_id=…, reply_all=true) The same, to its other To and Cc recipients too (never the inbox itself)
POST /v0/inboxes/{inbox_id}/messages/{message_id}/forward forward_message Sends it to new recipients, attached whole, with the subject Fwd: … unless you give one; a new thread

A reply takes only text, html, attachments and labels: its recipients and subject come from the message. People do the same in the dashboard: New message on an inbox’s page, and Reply, Reply all and Forward under a thread.

A thread in the dashboard: a received message, the reply sent from the inbox, and the reply box

{
"to": ["ada@example.com"],
"subject": "Your notes",
"text": "Attached.",
"attachments": [
{
"filename": "notes.txt",
"content_type": "text/plain",
"content": "SGVsbG8K"
}
]
}

content is the file in base64. Up to 50 files; a send request may be up to 15 MB, and the message as sent — body and files encoded — at most 10 MB (over it: 413 too_large). For an image in the HTML, give the file a content_id, "content_disposition": "inline", and use cid:<content_id> as its address.

A send that timed out may have gone. Send it again with the same Idempotency-Key header (MCP: idempotency_key): when the first one was accepted, the answer is its message_id, and nothing is sent again. The key is yours — an order number, a job id — up to 255 characters. The same key with a different request is 409 conflict.

After the answer, YoAgent delivers the message to each recipient. The sent copy gets a label for every outcome that happens to at least one recipient:

Label What happened
delivered A recipient’s mail server accepted it
bounced A recipient’s server refused it for good: the address or its domain does not exist
complained A recipient marked it as spam
rejected It was not sent to a recipient (a suppressed address, a paused organization) or the provider refused it

Mail to inboxes on yoagent.email goes straight to them, without leaving YoAgent. For each recipient’s own outcome, subscribe a webhook to message.delivered, message.bounced, message.complained, message.rejected and message.unsubscribed: each event names the recipient and the time (Set up and verify webhooks).

Answer Why
400 invalid The inbox is a catch-all: catch-all inboxes don’t send. Create an inbox for the address and send from it.
403 message_rejected A recipient does not take your organization’s mail: it bounced, complained or unsubscribed. Nothing was sent; the message names the addresses.
403 account_suspended Sending outside YoAgent is paused for your organization (below). Mail to inboxes on yoagent.email still goes.
403 limit_reached More recipients than your plan takes in a minute or a day, or more new recipients than a day of the ramp: split the message.
429 rate_limited Your plan’s sent messages a month, recipients a minute or a day, or new recipients for now; Retry-After says when. On Free, new outside recipients ramp up over the first day (Plans and limits).

Every message sent outside YoAgent carries a one-click unsubscribe link (List-Unsubscribe) for its recipient. A recipient who uses it no longer takes your organization’s mail. An address that bounced hard is suppressed for every YoAgent organization for 90 days; one that marked mail as spam, until we lift it. A send to any of them is refused whole, so you can remove the address and send again.

Too many bounces or spam complaints pause your organization’s sending outside YoAgent, to protect every customer’s delivery. The dashboard shows Sending is paused, and sends to outside addresses answer 403 account_suspended; receiving and mail between inboxes on yoagent.email go on. Sending resumes after we review it.

An inbox on a domain of your own sends once sending is turned on for the domain and its DKIM records are in place (Custom domains). Until then a send from it is 400 invalid, naming what is missing.