WoyraDocs
Get an API key

Add a rule, or block a sender

POST/v1/mail/rules

Mailboxes · Requires an API key

A rule files mail as it arrives: when every non-empty match is found, it moves the message, marks it read or stars it. Mail already in Spam stays there unless the rule blocks. With blocks, mail from the sender goes to Spam; blocking a sender already blocked returns the existing block. At most 200 rules and blocked senders.

Parameters

NameInDescription
mailboxqueryThe token's own mailbox. Any other address is refused with 403.

Body

FieldTypeDescription
idstring
fromContainsstringMatched in the sender's address or name
subjectContainsstring
toContainsstringMatched in any To or Cc address.
moveTostring
One of INBOX, ARCHIVE, TRASH, SPAM.
markReadboolean
starboolean
blocksbooleanA blocked sender
createdAttimestamp

Example

curl -X POST https://api.woyra.io/v1/mail/rules \
  -H "Authorization: Bearer $WOYRA_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "<id>",
    "fromContains": "<fromContains>",
    "subjectContains": "<subjectContains>"
  }'

Response

201 The rule as saved.

FieldTypeDescription
idrequiredstring
fromContainsrequiredstringMatched in the sender's address or name
subjectContainsrequiredstring
toContainsrequiredstringMatched in any To or Cc address.
moveTostring
One of INBOX, ARCHIVE, TRASH, SPAM.
markReadrequiredboolean
starrequiredboolean
blocksrequiredbooleanA blocked sender
createdAtrequiredtimestamp

Errors

StatusCodes
400invalid_request, unsupported_version
401authentication_required, invalid_api_key

Also in Mailboxes