Emails (raw MIME)
Use this endpoint when an agent or integration needs the full original MIME (headers and body exactly as received), for example archival, forwarding, or header analysis not present in parsed fields.
For the same bytes inside MCP hosts, use the get_email_raw tool (base64 JSON) instead of this streaming REST response.
Base path
Section titled “Base path”https://momail.io/v1/api/emails/{messageId}/rawAuthentication: Authorization: Bearer <api-key>. See Authentication.
Download raw MIME
Section titled “Download raw MIME”GET /v1/api/emails/{messageId}/raw| Parameter | Location | Description |
|---|---|---|
messageId | path | Email message_id in MoMail (same id used by MCP get_email / get_email_raw as email_id) |
Success response
Section titled “Success response”HTTP 200
| Header | Value |
|---|---|
Content-Type | message/rfc822 |
Content-Disposition | attachment; filename="{messageId}.eml" |
X-MoMail-R2-Key | Internal storage key (for support/debug) |
Body: raw .eml bytes (not JSON).
Errors
Section titled “Errors”HTTP 404 — email not found or not owned by the authenticated user:
{ "error": { "code": "NOT_FOUND", "message": "Email not found" }}HTTP 401 — missing or invalid API key / token (see Error codes).
Code examples
Section titled “Code examples”curl -L "https://momail.io/v1/api/emails/msg_abc123/raw" \ -H "Authorization: Bearer your_api_key" \ -o msg_abc123.emlconst res = await fetch( 'https://momail.io/v1/api/emails/msg_abc123/raw', { headers: { Authorization: `Bearer ${process.env.MOMAIL_API_KEY}` } });if (!res.ok) throw new Error(await res.text());const eml = await res.arrayBuffer();// eml is RFC 822 bytesimport requests
r = requests.get( 'https://momail.io/v1/api/emails/msg_abc123/raw', headers={'Authorization': 'Bearer your_api_key'},)r.raise_for_status()with open('msg_abc123.eml', 'wb') as f: f.write(r.content)See also
Section titled “See also”- MCP
get_email_raw— same content as base64 in a tool result - MCP
get_email— parsed body and metadata - Search (MCP) — find
message_idvalues viasearch_emails