POST/users/{userId}/mail/filters
Adds a filter that marks specified messages as "Read" or "Important," moves them to a specified folder or forwards them to another user automatically.
isReplyFromMe and isCalendarMail cannot be specified at the same time.isMoveFolder requires folderId.useForwardEmail requires forwardEmail.ishighlightColor requires highlightColor.isDelete ignores all other actions.OAuth 2.0 authentication.
For more information, see Authentication and Authorization.
| Parameter | Type | Description |
|---|---|---|
| userId | string | Member ID (must be URL-encoded)
required example : me |
| Header | type | Description |
|---|---|---|
| Authorization | string | Bearer {token} required |
| Content-Type | string | application/json required example : application/json |
| Property | Type | Description |
|---|---|---|
| from | string | Sender's email address (filter by) minLength : 1 |
| toCc | string | To- or cc-recipient's email address (filter by) minLength : 1 |
| to | string | To-recipient's email address (filter by) minLength : 1 |
| cc | string | Cc-recipient's email address (filter by) minLength : 1 |
| subject | string | Subject (filter by) minLength : 2 maxLength : 180 |
| body | string | Body (filter by) minLength : 2 |
| hasAttach | boolean | Indicates whether the message has an attachment (filter by). default : false |
| isReplyFromMe | boolean | Indicates whether the message is a reply to my message (filter by). default : false |
| isCalendarMail | boolean | Indicates whether the message is an appointment from Calendar (filter by). default : false |
| folderId | integer | Folder ID (action) minimum : 0 format : int32 |
| highlightColor | string | Highlight color in RGB (action) minLength : 1 |
| useForwardEmail | boolean | Indicates whether to forward filtered messages (action). default : false |
| forwardEmail | string | Forward to (action) format : email |
| isMoveFolder | boolean | Indicates whether to move filtered messages to a specified folder (action). default : false |
| isRead | boolean | Indicates whether to mark filtered messages as Read (action). default : false |
| isColor | boolean | Indicates whether to highlight filtered messages with color (action). default : false |
| isImportant | boolean | Indicates whether to mark filtered messages as Important (action). default : false |
| isDelete | boolean | Indicates whether to trash filtered messages (action). default : false |
| isApplyExistingMails | boolean | Indicates whether to filter the existing messages as well (action). default : false |
example
1{2 "from": "sender@example.com",3 "toCc": "tocc@example.com",4 "to": "to@example.com",5 "cc": "cc@example.com",6 "subject": "subjectstring",7 "body": "bodystring",8 "hasAttach": false,9 "isReplyFromMe": false,10 "isCalendarMail": false,11 "folderId": 0,12 "useForwardEmail": true,13 "forwardEmail": "forward@example.com",14 "isMoveFolder": false,15 "isread": false,16 "isColor": true,17 "highlightColor": "#e8f8fd",18 "isImportant": false,19 "isDelete": false,20 "isApplyExistingMails": false21}Created
Bad Request
Internal Server Error