gmail.users.messages.list

GET {{baseUrl}}/gmail/v1/users/:userId/messages?includeSpamTrash=<boolean>&labelIds=<string>&labelIds=<string>&maxResults=<integer>&pageToken=<string>&q=<string>&$.xgafv=<string>&access_token=<string>&alt=<string>&callback=<string>&fields=<string>&key=<string>&oauth_token=<string>&prettyPrint=<boolean>&quotaUser=<string>&upload_protocol=<string>&uploadType=<string>

Lists the messages in the user's mailbox.

Request Params

KeyDatatypeRequiredDescription
includeSpamTrashstringInclude messages from SPAM and TRASH in the results.
labelIdsstringOnly return messages with labels that match all of the specified label IDs.
labelIdsstringOnly return messages with labels that match all of the specified label IDs.
maxResultsstringMaximum number of messages to return.
pageTokenstringPage token to retrieve a specific page of results in the list.
qstringOnly return messages matching the specified query. Supports the same query format as the Gmail search box. For example, &quot;from:someuser@example.com rfc822msgid: is:unread&quot;. Parameter cannot be used when accessing the api using the gmail.metadata scope.
$.xgafvstringV1 error format.
access_tokenstringOAuth access token.
altstringData format for response.
callbackstringJSONP
fieldsstringSelector specifying which fields to include in a partial response.
keystringAPI key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
oauth_tokenstringOAuth 2.0 token for the current user.
prettyPrintstringReturns response with indentations and line breaks.
quotaUserstringAvailable to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
upload_protocolstringUpload protocol for media (e.g. "raw", "multipart").
uploadTypestringLegacy upload protocol for media (e.g. "media", "multipart").

RESPONSES

status: OK

{&quot;messages&quot;:[{&quot;historyId&quot;:&quot;aliqua elit&quot;,&quot;id&quot;:&quot;in nisi&quot;,&quot;internalDate&quot;:&quot;aliquip laboris Duis consectetur&quot;,&quot;labelIds&quot;:[&quot;l&quot;,&quot;adi&quot;],&quot;payload&quot;:{&quot;body&quot;:{&quot;attachmentId&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},&quot;data&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},&quot;size&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;}},&quot;filename&quot;:&quot;sed incididunt fugiat mollit&quot;,&quot;headers&quot;:[{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;}],&quot;mimeType&quot;:&quot;Excepteur qui consectetur irure&quot;,&quot;partId&quot;:&quot;conseq&quot;,&quot;parts&quot;:[{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;},{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;}]},&quot;raw&quot;:&quot;dolore occaecat eu sed&quot;,&quot;sizeEstimate&quot;:-81125746,&quot;snippet&quot;:&quot;elit incididunt pariatur&quot;,&quot;threadId&quot;:&quot;ut proident ea velit id&quot;},{&quot;historyId&quot;:&quot;veniam dolore ea ut reprehenderit&quot;,&quot;id&quot;:&quot;reprehenderit Duis eu&quot;,&quot;internalDate&quot;:&quot;adipisicing ex est ut&quot;,&quot;labelIds&quot;:[&quot;incididunt veniam&quot;,&quot;cupidatat esse aute magna&quot;],&quot;payload&quot;:{&quot;body&quot;:{&quot;attachmentId&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},&quot;data&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},&quot;size&quot;:{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;}},&quot;filename&quot;:&quot;eli&quot;,&quot;headers&quot;:[{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;},{&quot;value&quot;:&quot;\u003cError: Too many levels of nesting to fake this schema\u003e&quot;}],&quot;mimeType&quot;:&quot;ut do aliquip tempor&quot;,&quot;partId&quot;:&quot;proident pariatur occaecat velit&quot;,&quot;parts&quot;:[{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;},{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;}]},&quot;raw&quot;:&quot;sunt exercitation in&quot;,&quot;sizeEstimate&quot;:-16598599,&quot;snippet&quot;:&quot;dolor dolore&quot;,&quot;threadId&quot;:&quot;sed sit enim&quot;}],&quot;nextPageToken&quot;:&quot;velit cupidatat eu ullamco Lorem&quot;,&quot;resultSizeEstimate&quot;:-51081423}