Skip to content
Software capabilities

Gmail capability

How to download Gmail attachments

For an attachment with an attachmentId, call users.messages.attachments.get and decode the returned data as base64url. For a one-off download, open the message in Gmail and use the attachment’s Download button.

Documentation reviewed

Ways to do it

API

users.messages.attachments.get

Get the message in FULL format, find the attachmentId on the relevant MIME part, then request that ID for the same message.

Requirements
A Gmail OAuth token with a read scope such as gmail.readonly, plus the message ID and attachment ID.
Limitations
Some MIME part bodies carry data inline. Those parts have no attachmentId to pass to this endpoint.

Example

GET https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID/attachments/ATTACHMENT_ID
Read source: Gmail attachment retrieval reference

Interface

Download a Gmail attachment

Open the email in Gmail and use Download on the attachment you want.

Requirements
Access to the mailbox and a downloadable attachment on the message.
Limitations
Gmail disables attachment downloads on confidential-mode messages.
Read source: Gmail attachment download guide