Skip to content

Questions · Published 2026-10-21 · Updated 2026-10-21 · AgentiSend

How do I get the text of an email attachment?

Get the text of an email attachment from text_url, for PDF, Word, Excel, CSV, plain text, Markdown, JSON and HTML.

Get the text of an email attachment from text_url, for PDF, Word, Excel, CSV, plain text, Markdown, JSON and HTML. Input stops at 10 MB. Output stops at 250,000 characters.

The signed URL

GET /emails/receiving/{id}/attachments gives each file a download_url and, for the types above, a text_url. Both stop working at expires_at, and neither needs an API key. text_url is null when the file has no text layer, is over the input cap, or is another type. A PDF uses its text layer only, not a picture of the page.

curl -sS -X GET https://api.agentisend.com/emails/receiving/9c8f8f0e-3d1a-4d3f-9a1e-2b7c1a0f5e42/attachments \
  -H "Authorization: Bearer $AGENTISEND_API_KEY"
200
{
  "data": [],
  "has_more": false,
  "next_cursor": "example",
  "object": "list"
}
Response

GET /emails/receiving/{id}/attachments/{aid} returns the file bytes. The text URL returns plain text. GET /emails/receiving/{id} lists each attachment's id, which is the same id the email.received event carries.

The caps

A file larger than 10 MB is not extracted. Text longer than 250,000 characters is cut there. Anything outside the type list has no text_url. The bytes are still on download_url until expires_at.

Next

Written by the AgentiSend team.