Replace filter rules

PUT/api/v1/mailbox/rules
Requires amailbox token— it acts as one mailbox holder, not as the organization.

Replaces the whole list (up to 50 rules), in the order given. Send every rule you want to keep.

Errors

Status When
401 No token, or the session expired or was signed out. Sign in again with POST /mailbox-auth/login.
403 The account has a temporary password: until POST /security/password succeeds, every other call answers this with error_code: password_change_required.
422 More than 50 rules, or a rule with an unknown field, operator or action.

Request body

  • rulesarray<object>

    The whole list, in order. Each rule: name, match (all or any), enabled, conditions and actions, as in the response.

Request

PUT/api/v1/mailbox/rules
curl -X PUT 'https://courier.mailyte.com/api/v1/mailbox/rules' \
  -H 'Authorization: Bearer MAILBOX_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "rules": [
      {
        "name": "Invoices to Finance",
        "match": "any",
        "enabled": true,
        "conditions": [
          {
            "field": "subject",
            "operator": "contains",
            "value": "invoice"
          }
        ],
        "actions": [
          {
            "type": "move",
            "value": "Finance"
          }
        ]
      }
    ]
  }'

Response

Successful Response

  • dataobject
    • rulesarray<object>
      • idstring
      • namestring
      • matchstringall | any
      • enabledboolean
      • conditionsarray<object>
        • fieldstring

          from, to, cc, subject or body.

        • operatorstring

          contains (the default), is, or matches (with * and ? wildcards).

        • valuestring
      • actionsarray<object>
        • typestring

          move (value: a folder), label (value: a label), flag, mark_read, forward (value: an address) or discard.

        • valuestring
200application/json
{
  "type": "success",
  "msg": "Rules saved",
  "data": {
    "rules": [
      {
        "id": "r1",
        "name": "Invoices to Finance",
        "match": "any",
        "enabled": true,
        "conditions": [
          {
            "field": "subject",
            "operator": "contains",
            "value": "invoice"
          }
        ],
        "actions": [
          {
            "type": "move",
            "value": "Finance"
          }
        ]
      }
    ]
  }
}

Returned inside the standard envelope.

Errors

StatusWhen
401No token, or the session expired or was signed out. Sign in again with `POST /mailbox-auth/login`.
403The account has a temporary password: until `POST /security/password` succeeds, every other call answers this with `error_code: password_change_required`.
422More than 50 rules, or a rule with an unknown field, operator or action.

Every status, with what causes it and what to do, is on the error reference.