SDK / API ReferenceMessages
Send Email
POST /v0/messages/send
Scope: mail:send
Send an email from your agent's inbox. Creates a new thread automatically.
Request
import { Loomal } from "@loomal/sdk";
const loomal = new Loomal({ apiKey: process.env.LOOMAL_API_KEY! });
const result = await loomal.mail.send({
to: ["recipient@example.com"],
subject: "Hello from my agent",
text: "Plain text body",
});import os
from loomal import Loomal
loomal = Loomal(api_key=os.environ["LOOMAL_API_KEY"])
result = loomal.mail.send(
to=["recipient@example.com"],
subject="Hello from my agent",
text="Plain text body",
)loomal mail send \
--to recipient@example.com \
--subject "Hello from my agent" \
--text "Plain text body"Pass --html, --cc, or --bcc for richer sends. The CLI reads LOOMAL_API_KEY from your environment.
mail.send(to=[...], subject=..., text=..., html?, cc?, bcc?)Available through @loomal/mcp — see MCP setup.
curl -X POST https://api.loomal.ai/v0/messages/send \
-H "Authorization: Bearer loid-your-api-key" \
-H "Content-Type: application/json" \
-d '{"to":["hi@example.com"],"subject":"Hello","text":"From my agent"}'Body
{
"to": ["recipient@example.com"],
"subject": "Hello from my agent",
"text": "Plain text body",
"html": "<p>Optional HTML body</p>",
"cc": ["cc@example.com"],
"bcc": ["bcc@example.com"]
}| Field | Type | Required | Description |
|---|---|---|---|
to | string[] | Yes | Recipient addresses |
subject | string | Yes | Subject line |
text | string | Yes | Plain text body |
html | string | No | HTML body |
cc | string[] | No | CC recipients |
bcc | string[] | No | BCC recipients |
attachments | Attachment[] | No | See Attachments |
Response — 201 Created
{
"messageId": "<uuid@mailgent.dev>",
"threadId": "thd_a3f91b00c4e2d7e8",
"inboxId": "agent-x8k2m@mailgent.dev",
"from": ["agent-x8k2m@mailgent.dev"],
"to": ["recipient@example.com"],
"cc": [],
"subject": "Hello from my agent",
"text": "Plain text body",
"extractedText": "Plain text body",
"labels": ["sent"],
"createdAt": "2026-03-28T10:00:00.000Z"
}Errors
| Status | Code | Description |
|---|---|---|
404 | not_found | Inbox not found |
429 | quota_exceeded | Daily send limit reached (50/day) |