Skip to content

Parse raw emails into clean JSON

Send an RFC 5322 message as text or Base64. Get decoded headers and addresses, the text and HTML bodies, attachments, and the Message-ID chain for threading.

$0.03/call · 10 free calls a day, no signup · REST and MCP

curl https://api.kanagu.dev/v1/email/parse \
  -H "Content-Type: application/json" \
  -d '{"text":"From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."}'
const res = await fetch("https://api.kanagu.dev/v1/email/parse", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "text": "From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "email.parse",
    "arguments": {
      "text": "From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."
    }
  }
}

Why

What it solves

Real email is MIME trees, encoded words, legacy charsets and nested attachments. Getting the sender, the body and the thread right takes a library and a lot of edge cases. Kanagu returns one predictable JSON shape for every message.

Built for

  • Support, CRM and ticketing tools that ingest inbound email
  • Expense and AP tools that pull receipts and invoices out of forwarded mail
  • AI agents that read emails users forward to them
Decoded headers and addresses
From, To, Cc, Bcc, Reply-To, Sender and groups as structured names and addresses, with dates normalized to ISO 8601.
Bodies and attachments
Text and HTML bodies, attachments with filename, type, size and SHA-256, and inline images mapped by Content-ID. Set includeContent to get the bytes as Base64.
Threading
Message-ID, In-Reply-To and References as arrays, ready to group messages into conversations.

Example

What goes in, what comes out

In: A raw email (.eml) as UTF-8 text or Base64 bytes. Out: Headers, addresses, subject, date, text and HTML bodies, attachments, thread IDs.

Request · POST /v1/email/parse
{
  "text": "From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\n…\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."
}
Response · 200
{
  "addresses": {
    "from": [
      {
        "name": "Maya Chen",
        "address": "maya@example.com"
      }
    ],
    "to": [
      {
        "name": "Dev Team",
        "address": "dev@example.net"
      }
    ]
  },
  "subject": "Re: Import window for December",
  "date": "2026-11-23T14:30:00.000Z",
  "text": "The next import will start at 10:00 a.m. Eastern on December 1.\n",
  "attachments": [],
  "thread": {
    "messageId": "<import-window-2@example.com>",
    "inReplyTo": [
      "<import-window-1@example.net>"
    ],
    "references": [
      "<import-window-1@example.net>"
    ]
  }
}

Shortened: the full response also lists every header in order.

Try it

Run it on the live API

The sample request is ready to run. No key needed for 10 calls a day.

email.parse

$0.03/call

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Reference

Operations

OperationPrice
email.parse

Parse an RFC 5322 email into headers, addresses, MIME bodies, attachments, and thread IDs.

$0.03/call
curl https://api.kanagu.dev/v1/email/parse \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."}'
const res = await fetch("https://api.kanagu.dev/v1/email/parse", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "text": "From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
claude mcp add --transport http kanagu https://api.kanagu.dev/mcp \
  --header "Authorization: Bearer $KANAGU_KEY"
{
  "mcpServers": {
    "kanagu": {
      "url": "https://api.kanagu.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${env:KANAGU_KEY}"
      }
    }
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "email.parse",
    "arguments": {
      "text": "From: Maya Chen <maya@example.com>\r\nTo: Dev Team <dev@example.net>\r\nSubject: Re: Import window for December\r\nDate: Mon, 23 Nov 2026 09:30:00 -0500\r\nMessage-ID: <import-window-2@example.com>\r\nIn-Reply-To: <import-window-1@example.net>\r\nReferences: <import-window-1@example.net>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThe next import will start at 10:00 a.m. Eastern on December 1."
    }
  }
}

Every field, error and schema is in the email.parse reference.

Coverage

Limits and coverage

Size
Up to 1 MiB per message
Input
UTF-8 text, or Base64 bytes for messages in legacy charsets such as ISO-8859-1
Attached emails
An attached .eml is returned as an attachment; parse it again to read it
HTML
Returned as decoded; treat it as untrusted content
Data
Inputs are processed in memory. For keyed calls the JSON result is kept for 30 days so a retry with the same Idempotency-Key returns it, then deleted. Trial calls store only a daily counter.

Compare

Compared with the usual approaches

Ways teams usually read inbound email:

ApproachWhat you take on
A MIME library in your servicePick and update a parser for your language and handle charsets, encoded words and malformed messages yourself.
Your inbound email provider's parsed webhookWorks for mail that provider receives; files and forwarded .eml from elsewhere need another path.
KanaguAny raw message, from any source, returns the same JSON shape in one call.

Pricing

$0.03/call, billed only on success

$1 of usage free every month after sign-in. Then pay as you go with no monthly fee, or the $9/month Bundle with $9 of usage included, shared across every Kanagu product. Compare plans

Sign in, create a key and use $1 of calls free each month, no card needed. Subscribe from your dashboard when you need more. Polar is the merchant of record and handles payment, tax and invoices.

10 free calls a day
Start without a key
Try every call above for free. When it works, sign in for a key with $1 of usage free every month.

FAQ

Email parsing questions

Can I send messages in other charsets?
Yes. Send the raw bytes as base64 and the parser decodes each part's declared charset.
Do I get attachment contents?
Set includeContent to true to receive each attachment as Base64. Otherwise you get the metadata only.
Is the HTML sanitized?
No. It is the original decoded HTML. Sanitize it before you render it.
What does a message cost?
$0.03 per message up to 1 MiB.

More APIs with the same key