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.

  • Filter by
    • At least one of the following parameters must be specified and multiple parameters can be specified.
    • Note that both isReplyFromMe and isCalendarMail cannot be specified at the same time.
  • Actions
    • At least one of the following six parameters must be specified: isMoveFolder, isTreatForwardEmail, isHighlightColor, isRead, isImportant, and isDelete.
    • isMoveFolder requires folderId.
    • useForwardEmail requires forwardEmail.
    • ishighlightColor requires highlightColor.
    • isDelete ignores all other actions.

Authorization

oauth2

OAuth 2.0 authentication.
For more information, see Authentication and Authorization.

Scope

mail

HTTP Request

POSThttps://www.worksapis.com/v1.0/users/{userId}/mail/filters

Path Parameters

ParameterTypeDescription
userId string 

Member ID (must be URL-encoded)

  • User ID
  • Login ID (email)
  • Me

required
example : me 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 
Content-Type string 

application/json


required
example : application/json 

Request Body

PropertyTypeDescription
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 

Request Example

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}

Response

HTTP 201

Created

HTTP 400

Bad Request

HTTP 500

Internal Server Error