Method: media.download

Downloads uploaded media, but not Google Drive files. Download is supported on the URI /v1/media/{+name}?alt=media. To export bytes from a Google Drive file, see the files.export method in Google Drive.

HTTP request

GET https://chat.googleapis.com/v1/media/{resourceName=**}

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
resourceName

string

Name of the media that you are downloading. For more information, see spaces.messages.attachments.attachmentDataRef.

Request body

The request body must be empty.

Response body

If successful, this method returns the file content as bytes.

To download only part of a file, use the Range header with a byte range. For example: Range: bytes=500-999.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/chat.bot
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.messages.readonly

For more information, see the Authorization guide.