# The lean format

Pombus can serve mail in a short format made for language models. It keeps who wrote, when, the new text and the attachments. It leaves out what a model pays for and does not need: quoted history, raw HTML, long tracking URLs, empty fields.

The MCP tools always use this format. On the HTTP API you ask for it with a query parameter.

## How to ask for it

Add `projection=ai` to a read of messages or threads:

```sh
curl "https://mail-api.pombus.com/v0/inboxes/inb_your_id/messages/msg_Tq3...?projection=ai" \
  -H "Authorization: Bearer pmb_your_key"
```

| Parameter | Effect |
| --- | --- |
| `projection=ai` | The lean format described on this page. |
| `projection=full` | The long format, with the original `text` and `html`. |
| `links=full` | With `projection=ai`: every URL in `md` stays whole. |

`view=ai` is an older name for `projection=ai`. It still works. Use `projection`.

## One message

```json
{
  "frm": "Ana Souza <ana@example.com>",
  "ts": "2026-11-21T08:42Z",
  "env": "you@pombus.com|bounce@mail.example.com",
  "auth": "spf=pass dkim=pass dmarc=pass",
  "first": true,
  "md": "Hi,\n\nThe invoice for November is attached. Pay it here: [payment page](L1 pay.example.com)\n\nAna",
  "att": [
    {
      "id": "9f2c41d07ab3",
      "file": "invoice-november.pdf",
      "ct": "application/pdf",
      "sz": 48211,
      "md": "INVOICE 2026-118\nTotal due: 1,240.00"
    }
  ],
  "tid": "thr_9bK...",
  "to": ["you@pombus.com"]
}
```

| Field | Meaning | Present when |
| --- | --- | --- |
| `frm` | The From header: name and address. | Always, unless the From could not be read. |
| `fdom` | The sender's domain. | Only when it differs from the domain in `frm`. |
| `ts` | Time of the message in UTC, to the minute. | Always. |
| `dir` | `out` for a message sent from this inbox. | Only for sent messages. |
| `env` | SMTP envelope as `recipient|mail_from`. | Received messages. |
| `auth` | SPF, DKIM and DMARC results in one string. | When there is a verdict. |
| `risk` | `{"level": "medium" or "high", "reason": "..."}`. | Only when the level is not `none`. |
| `first` | `true`: first mail from this sender's domain to this inbox. | Only when true. |
| `look` | The domain of a known contact that the sender's domain resembles. | Only when set. |
| `look_mut` | `true`: both domains are already known to this inbox. | Only when true. |
| `md` | The body without quoted history. | When the message has text. |
| `body_omitted` | The body was left out of a thread read. Read the single message. | Only when true. |
| `att` | The attachments. See [Attachments](attachments.md). | When there are any. |
| `att_om` | Number of attachments left out of the answer. | Only when not zero. |
| `att_trunc` | `true`: the attachment list was cut. | Only when true. |
| `tid` | The thread id. | Single message reads and list items. |
| `to`, `cc` | Recipients. | Single message reads. In a thread, only what differs. |

[Sender signals](sender.md) explains `auth`, `env`, `risk`, `first` and `look`.

A field that is empty or false is not sent. Absent means empty. For `risk`, absent means `none`, which is not the same as "safe".

## One thread

A thread states once what all its messages share. Each message then carries only what changes.

```json
{
  "tid": "thr_9bK...",
  "inb": "inb_your_id",
  "subj": "Invoice for November",
  "to": ["you@pombus.com"],
  "sha": "5d41c2...",
  "pv": "pombus-mime/6",
  "budget": { "unit": "chars", "body_cap": 100000, "att_cap_each": 20000, "body_omitted": false, "att_truncated": false },
  "msgs": [
    { "frm": "Ana Souza <ana@example.com>", "ts": "2026-11-21T08:42Z", "auth": "spf=pass dkim=pass dmarc=pass", "md": "Hi, the invoice is attached." },
    { "frm": "you@pombus.com", "ts": "2026-11-21T09:10Z", "dir": "out", "to": ["ana@example.com"], "md": "Thanks, paid today." }
  ]
}
```

| Field | Meaning |
| --- | --- |
| `tid`, `inb`, `subj` | Thread id, inbox id, subject. |
| `to` | The recipients of the first message. Each message lists only recipients that are not in this list. |
| `sha`, `pv` | SHA-256 of the original bytes of the newest message served, and the parser version. For audit. |
| `cur` | Cursor for older messages. Pass it as `before_id`. Absent when there are none. |
| `budget` | What was cut, for a program to read. `body_omitted: true` means at least one body was left out. `att_truncated: true` means at least one attachment list was cut. |
| `msgs` | The messages. |

A thread read returns up to 100 messages. The bodies of one thread read share a budget of about 4 MB. A message over that budget comes with `body_omitted: true` and no `md`. Read that message alone to get its body.

## Lists and search

Lists and searches return one triage line per item, with no body.

A message line has `id`, `tid`, `subj`, `snip` (a preview), `labels`, `att` (file names only), the sender fields of the table above, and `to` when the message was sent from this inbox. In a list, `env` drops the recipient when it is the address of the inbox: `|bounce@mail.example.com`.

A thread line has `tid`, `subj`, `snip`, `ts` (last activity), `n` (number of messages; `n_cap` means there are more than counted), `frm` (the senders), `labels`, and the thread's signals: `risk` is the highest of its messages, `first` is true if any message has it, `look` and `look_mut` come from the newest message. Lists that cover several inboxes add `inb`.

A list line does not say whether an attachment's text is complete. Read the message for that.

## What is removed

| Removed | Rule |
| --- | --- |
| Quoted lines | Every line that starts with `>`. |
| Reply history | Everything from a reply banner down: "On ... wrote:" in English, and the same line in Portuguese, Spanish, French and German. |
| "Original Message" divider | Everything from the divider down, in English, Portuguese or Spanish. Also from a line of five or more underscores. |
| Quoted header block | Everything from a block of at least two header lines of one language (From, Sent, To, Subject, Cc), the way Outlook quotes. |
| Delimited signature | Everything from the standard signature delimiter down: a line with two hyphens. |
| Raw `text` and `html` | Not sent. `md` replaces them. |
| Long URLs | A URL of more than 40 characters becomes a reference such as `(L1 pay.example.com)`. The host is where the link really points. |
| Empty and default fields | Not sent. |
| Seconds and time zone | `ts` is UTC to the minute. |

## What is kept whole

- New text written by the sender.
- A signature with no delimiter. Cutting it risks removing content, so it stays.
- A forwarded message. When the subject starts with `Fwd:`, `Fw:` or `Enc:`, or the body has a forwarded-message marker, the quoted part is the content, so nothing is stripped.
- A reply that has no banner, divider, header block or delimiter. Its quoted tail stays.
- Links, as markdown. Short URLs stay whole.
- URLs inside attachment text.

If stripping would leave nothing, Pombus serves the whole text instead.

### References and escaped text

`(L3 host)` is link 3 of that message. To get the URLs, read the message again with `links=full`.

A sender can write text that looks like a reference. Pombus puts a backslash in front of it: `\(L1`. A backslash before `(`, a letter and a digit always marks text the sender wrote. The same escape applies to attachment text. With `links=full`, nothing is escaped.

## When to ask for the original

| You need | Ask for |
| --- | --- |
| The URLs behind the references | The same read with `links=full`. |
| The quoted history, or the HTML | The same read with `projection=full`. |
| The exact bytes that arrived | `GET /v0/inboxes/{inbox_id}/messages/{message_id}/raw`. |
| The file of an attachment | `get_attachment`. See [Attachments](attachments.md). |

## Token cost

We used 42 emails from a test inbox we wrote (41 reads: two identical newsletters share one thread). Reading them one by one through Pombus used 76% fewer tokens than reading the same emails through the Gmail connector in Claude. We measured this on 22 November 2026 with Anthropic's token counter.

The figure is for reading. Listing the inbox is not part of it. The count covers what the tools return and does not include the tool descriptions. Your result depends on your mail.
