Nylas Attachments API

You can use the `attachments` schema in a [Send Message request](/docs/reference/api/messages/send-message/) to send attachments, regardless of the email provider. You use the [Drafts](/docs/reference/api/drafts/) endpoints to add and modify files attached to drafts. The Attachments endpoints let you download or get the metadata for existing attachments. For more information, see [Working with email attachments](/docs/v3/email/attachments/). If you're using draft support, the draft (including the attachment) is stored on the provider. If you're not using draft support, Nylas stores the attachment. You can make a [Get Attachment Metadata request](/docs/reference/api/attachments/get-attachments-id/) to retrieve a single attachment's metadata using its ID. ## What counts as an attachment? In Nylas, an attachment is any file included either inline as part of a message, or attached to a message as a file. Some major email providers, such as Google and Microsoft, have their own cloud storage ("drive") services. These files usually appear as links in the message body instead of attachments on the Message object. Google Drive lets users attach files either as a link, or a file. Microsoft One Drive attachments always appear as links in the message body. ## Attachment size discrepancies When Nylas returns information about an attachment, its listed size might be different from the actual size of the file. This is because of provider encryption methods, message headers, and rounding on the provider side. For example, if you receive a 3480-byte attachment in an email, Nylas might list it as 3680 bytes. ## Attachments scopes The table below lists the Attachments endpoints and which scopes they require. The table shortens the full scope URI for space reasons, so add the prefix for the provider when requesting scopes. The ☑️ in each column indicates the most restrictive scope you can request for each provider and still use that API. More permissive scopes appear under the minimum option. If you're already using one of the permissive scopes, you don't need to add the more restrictive scope. | Endpoint | Google Scopes`https://www.googleapis.com/auth/...` | Microsoft Scopes`https://graph.microsoft.com/...` | | :----------------------------------------------------------------------------------------- | :------------------------------------------------------ | :------------------------------------------------------------------------------------- | | **GET** `/attachments/`**GET** `/attachments//download` | `/gmail.readonly` ☑️`/gmail.modify` | `Mail.Read` ☑️`Mail.ReadWrite``Mail.ReadWrite.Shared``Mail.Read.Shared` | For more information about scopes, see [Using scopes to request user data](/docs/dev-guide/scopes/). ## Query IMAP server directly Set the `query_imap` query parameter to `true` in your [Get Attachment Metadata](/docs/reference/api/attachments/get-attachments-id/) or [Download Attachment](/docs/reference/api/attachments/get-attachments-id-download/) requests to query the IMAP server directly instead of the Nylas database. This lets you get the most up-to-date information from the IMAP server, or data older than the default three-month retention time. Keep in mind that most IMAP servers are slow and have low [rate limits](/docs/dev-guide/platform/rate-limits/). Nylas might take more time to return responses compared to requests that don't use the `query_imap` query parameter. If an account has many folders, or you're querying for a large attachment, your request can take even longer. ## Microsoft attachment size discrepancies If you're working with Microsoft grants, you might notice a small difference between the attachment size in Nylas' response and the actual size of the downloaded file. This is because Nylas' attachment size calculation includes any MIME encoding headers. Nylas returns this value to be consistent with the provider, and so that it doesn't have to pre-process all attachment content. When working with attachments on Microsoft grants, we recommend you... - Treat the metadata `size` field as an estimate for UI display purposes. - Always use the actual downloaded file for storage calculations and file operations. - Implement flexible buffer handling when the exact byte count of a file matters to your project. - Test your Nylas integration with a number of different attachment types and sizes.

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /v3/grants/{grant_id}/attachments/{attachment_id} Get an attachment's metadata · Return Attachment metadata #
Ask an LLM
“What's the filename, size and type of an email attachment?”
“Can I check attachment details without downloading the file?”
Tell an agent
Show metadata for attachment {attachment} on message {message} for grant {grant}.
Get the file type and size of attachment {attachment} in message {message} via {grant}.
GET /v3/grants/{grant_id}/attachments/{attachment_id}/download Download an attachment file · Download an Attachment #
Ask an LLM
“How do I download the actual file attached to an email?”
“Can I pull an attachment directly from the IMAP server?”
Tell an agent
Download attachment {attachment} from message {message} for grant {grant}.
Save the file {attachment} attached to message {message} on {grant}.
POST /v3/grants/{grant_id}/attachment-uploads Start an upload session for a large attachment · Create an attachment upload session #
Ask an LLM
“How do I attach a file larger than the normal size limit to an email?”
“How long does an attachment upload URL stay valid?”
Tell an agent
Start an upload session for {filename} of type {content_type} on grant {grant}.
Get a pre-signed upload URL for {filename} ({content_type}, {size} bytes) for {grant}.
POST /v3/grants/{grant_id}/attachment-uploads/{attachment_id}/complete Finish a large attachment upload · Complete an attachment upload session #
Ask an LLM
“What do I do after uploading file bytes to the pre-signed URL?”
“Does Nylas verify the uploaded size matches what I declared?”
Tell an agent
Complete upload session {attachment} for grant {grant}.
Finalize the uploaded attachment {attachment} on {grant}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/nylas:nylas-attachments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

nylas-attachments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Nylas Attachments API
  version: v3
  summary: The complete Nylas v3 API — Email, Calendar, Contacts, Notetaker, Scheduling, Administration, and Migration.
  description: The Nylas API is designed using the REST ideology to provide simple and predictable URIs to access and modify objects. Requests support standard HTTP methods like `GET`, `PUT`, `POST`, and `DELETE`, and standard status codes. Response bodies are always UTF-8 encoded JSON objects, unless explicitly documented otherwise. You can use the Nylas Postman collection to quickly start using the Nylas APIs. For more information, check out the Nylas Postman collection documentation.
  contact:
    url: https://www.nylas.com/
servers:
- url: https://api.us.nylas.com
  description: U.S.
- url: https://api.eu.nylas.com
  description: E.U.
security:
- ACCESS_TOKEN: []
- NYLAS_API_KEY: []
tags:


# --- truncated at 32 KB (44 KB total) ---
# Full source: https://artifacts.apis.io/nylas/openapi/nylas-attachments-api-openapi.yml