Read email attachment
getEmailAttachmentRead ONE attachment of an email. A text attachment (plain text, CSV, JSON, XML, Markdown, calendar and similar) comes back as text; an HTML attachment comes back reduced to text; a PNG, JPEG, GIF or WebP image up to 1 MB comes back as an image; any other file comes back as base64 when it is 256 KB or smaller, and otherwise as its description with a statement that it is too large to return. PDF and office documents are not converted to text. Identify the attachment by part_index or filename from the attachments list getEmail returns; an email with a single attachment needs neither. Long text is returned max_chars at a time: when truncated is true, call again with offset set to next_offset.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the email the attachment belongs to. | |
| offset | No | For text: the character to start from. Use next_offset from the previous call to continue. | |
| source | No | Whether id is an inbound email (received, the default) or a sent email (sent). | received |
| api_key | No | Primitive API key (prim_...). Only needed when this connection has no signed-in account: pass the api_key returned by createEmailAddress, unchanged, on every call for the rest of the conversation. Omit it when the user is signed in. | |
| filename | No | The attachment's filename, when part_index is not to hand. Matched exactly, then ignoring case. | |
| max_chars | No | For text: the most characters to return in this call (default 20000, at most 100000). | |
| part_index | No | The attachment's part_index from the email's attachments list. Preferred over filename, which need not be unique. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| tool | Yes | ||
| status | Yes | ||
| statusText | No |