Magidoc

getEmails
Query

Get emails from the user's mailbox with support for pagination. If there are more emails available beyond the current page, the response will include a "nextPageToken". To retrieve the next batch of results, call "getEmails" again using the same filters and pass the returned "nextPageToken".

Arguments

#

rawQuery

Non-null

A raw query string used to apply advanced filters to the email dataset. Supports multiple criteria combined with spaces, enabling complex queries.

Examples: 'label:' find emails under one of your labels - label:friends label:important 'subject:' find emails by a word or phrase in the subject line - subject:dinner subject:anniversary party 'from:' find emails sent from a specific person - from:me from: john@example.com 'to:' find emails sent to a specific person - to:me to: john@example.com 'cc:' find emails sent to a specific person in the CC field - cc: john@example.com 'bcc:' find emails sent to a specific person in the BCC field - bcc: john@example.com 'has:' find emails with attachmentsm inline images, youtube videos, drive files, google docs, google sheets, google slides - has:attachment has:youtube has:drive has:document has:spreadsheet has:presentation 'after:' search for emails received during a certain time period - after:2025/04/16 'before:' search for emails received during a certain time period - before:2025/04/16 'OR' or '{}' find emails that match one or more of your search criteria - from:amy OR from:david {from:amy from:david} 'AND' find emails that match all of your search criteria - from:amy AND to:david '" "' search for emails with an exact word or phrase - "dinner and movie tonight" '( )' group multiple search terms together - subject:(dinner movie) 'rfc822msgid:' find emails with a specific message-id header - rfc822msgid: 200503292@example.com

When constructing or modifying queries, you must use only the operators listed above.

maxResults = 50

The maximum number of emails to return. The default is 50. The maximum is 100.

nextPageToken

Pagination token returned in the previous "getEmails" response. Pass this token to retrieve the next page of results. If omitted, the first page will be returned.

Response

#

Returns GetEmailsResponse !.

Example

#

    
  

3

    
  

3

    
  

3