Nylas Attachments API

The Nylas Attachments API allows you to retrieve metadata and download attachments.

You can use the attachments schema in a Send v3 request to send attachments regardless of the email provider. To include attachments in a Send v3 request, all attachments must be base64 encoded and the encoded data must be placed in the content field in the request body.

If you are using draft support, the draft including the attachment is stored on the provider. If you are not using draft support, Nylas stores the attachment.

Attachment size is currently limited by each provider. 3MB for Gmail messages 10MB for Microsoft messages

You can also send attachments inline in an email message, for example for images that should be displayed in the email body content.

Hierarchy

  • Resource
    • Attachments

Constructors

Properties

apiClient: default

Methods

  • Type Parameters

    • T

    Parameters

    • __namedParameters: DestroyParams

    Returns Promise<T>

  • Parameters

    • __namedParameters: FindParams<void>

    Returns Promise<Buffer>

  • Parameters

    • __namedParameters: FindParams<void>

    Returns Promise<ReadableStream>

  • Download the attachment data

    This method returns a NodeJS.ReadableStream which can be used to stream the attachment data. This is particularly useful for handling large attachments efficiently, as it avoids loading the entire file into memory. The stream can be piped to a file stream or used in any other way that Node.js streams are typically used.

    Parameters

    • __namedParameters: DownloadAttachmentParams & Overrides

    Returns Promise<ReadableStream>

    The ReadableStream containing the file data.

  • Download the attachment as a byte array

    Parameters

    • __namedParameters: DownloadAttachmentParams & Overrides

    Returns Promise<Buffer>

    The raw file data

Generated using TypeDoc