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
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.
{
"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."
}{
"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.
Reference
Operations
| Operation | Price |
|---|---|
| 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:
| Approach | What you take on |
|---|---|
| A MIME library in your service | Pick and update a parser for your language and handle charsets, encoded words and malformed messages yourself. |
| Your inbound email provider's parsed webhook | Works for mail that provider receives; files and forwarded .eml from elsewhere need another path. |
| Kanagu | Any raw message, from any source, returns the same JSON shape in one call. |
Pricing
$0.03/call, billed only on success
- email.parse$0.03 / call
$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.
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
- E-invoicingGenerate, validate and parse XRechnung and ZUGFeRD invoices.
- France e-reportingDGFiP Flux 10 e-reporting XML for B2C sales, cross-border B2B and service receipts, checked against v3.2.
- Bank statementsTurn Chase, Wells Fargo and Barclays PDF statements into reconciled transactions.
- OTA payoutsMatch Airbnb, Booking.com and Vrbo payouts to the deposits on your bank statement.
- Rent rollsReconcile a multifamily rent roll against its T12: occupancy, loss to lease, vacancy and rent collected.
- Pay applicationsCheck AIA G702 and G703 pay applications line by line, against the last certified one and approved change orders.
- VAT validationCheck EU and UK VAT numbers against VIES and HMRC, with audit evidence.
- Packaging EPRPackaging weights by US state EPR category and Germany LUCID reports, traced to each SKU.
- CPSC eFilingCheck CPC and GCC certificates against each CBP entry line and get the PGA fields to file.
- PFAS reportingDecide Minnesota and Maine PFAS-in-products reporting and get the PRISM rows, MDA statements and deadlines.
- Demurrage auditAudit FMC demurrage and detention invoices against 46 CFR 541, recalculate each day and draft the dispute.
- UK CARFHMRC cryptoasset reports as OECD CARF XML, checked against HMRC's file rules and TIN check digits.
- EU PPWREU packaging regulation checks for heavy metals, PFAS, recycled content and empty space, with a draft declaration.
- SEC fundamentalsPoint-in-time SEC XBRL financials with every restatement, for backtests without look-ahead.
- Business daysBusiness-day math and SLA deadlines with public holidays in 207 countries.
- CSV validationCheck uploaded CSV files against a column schema before you import them.
- Screenshot diffCapture two web pages and get the changed pixels and regions.