> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Gmail Messages

Lists the messages in the user's mailbox. Please note that the action can only retrieve the data of the user specified in the connection.

<Note>
  External Documentation

  To learn more, visit the [Gmail documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter          | Description                                                                                                                                                                                                                                                   |
  | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Include Spam Trash | Select to include spam and trash mails.                                                                                                                                                                                                                       |
  | Query              | Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`. Parameter cannot be used when accessing the api using the gmail.metadata scope. |
  | Return All Pages   | Automatically fetch all resources, page by page.                                                                                                                                                                                                              |
  | User ID            | The user's email address. The special value `me` can be used to indicate the authenticated user.                                                                                                                                                              |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter               | Description                                                                                                                                                                                                                                                                                                                  |
  | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Delegated User Override | Perform the action on behalf of another user, overriding the delegated user defined in the connection.<br /><br />If not specified, the delegated user is the one provided in the connection.<br /><br />Has no effect when using an OAuth connection.<br /><br />NOTE: the connection details are not edited by this input. |
  | Page Size               | Maximum number of messages to return. The maximum allowed value for this field is 500.                                                                                                                                                                                                                                       |
  | Page Token              | The page token allows you to get a specific page of results in a list. If additional pages are available, the response will include a `nextPageToken` that you can use to fetch the next page of results.                                                                                                                    |
</div>

## Example Output

```json theme={"dark"}
{
	"messages": [
		{
			"id": "18476a3a2a1f3e2d",
			"threadId": "18476a3a2a1f3e2d"
		},
		{
			"id": "18476a392793ce57",
			"threadId": "18476a392793ce57"
		},
		{
			"id": "1847693063d1262e",
			"threadId": "1847693063d1262e"
		},
		{
			"id": "1847692f6c487fad",
			"threadId": "1847692f6c487fad"
		}
	],
	"nextPageToken": "13224725121085952498",
	"resultSizeEstimate": 201
}
```

## Workflow Library Example

[Search Gmail Ioc Across Emails](https://library.blinkops.com/workflows/search-gmail-ioc-across-emails)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/search-gmail-ioc-across-emails/canvas" />
</div>
