Users.messages: import

Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message. Try it now.

This method supports an /upload URI and accepts uploaded media with the following characteristics:

  • Maximum file size: 50MB
  • Accepted Media MIME types: message/rfc822


HTTP request

This method provides media upload functionality through two separate URIs. For more details, see the document on media upload.

  • Upload URI, for media upload requests:
  • Metadata URI, for metadata-only requests:


Parameter name Value Description
Path parameters
userId string The user's email address. The special value me can be used to indicate the authenticated user.
Required query parameters
uploadType string The type of upload request to the /upload URI. Acceptable values are:
  • media - Simple upload. Upload the media only, without any metadata.
  • multipart - Multipart upload. Upload both the media and its metadata, in a single request.
  • resumable - Resumable upload. Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata.
Optional query parameters
deleted boolean Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts. (Default: false)
internalDateSource string Source for Gmail's internal date of the message.

Acceptable values are:
  • "dateHeader": The internal message time is based on the Date header in the email, when valid. (default)
  • "receivedTime": The internal message date is set to the time the message is received by Gmail.
neverMarkSpam boolean Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox. (Default: false)
processForCalendar boolean Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user. (Default: false)


This request requires authorization with at least one of the following scopes:


For more information, see the authentication and authorization page.

Request body

In the request body, supply a Users.messages resource as the metadata. For more information, see the document on media upload.


If successful, this method returns a Users.messages resource in the response body.

Try it!

Note: APIs Explorer currently supports metadata requests only.

Use the APIs Explorer below to call this method on live data and see the response.