Rules

Create a rule

Creates a rule for your application. A rule defines a trigger (inbound or outbound), conditions against sender or recipient fields, and actions to apply when the conditions match. Inbound rules run on incoming messages; outbound rules run on sends before they're submitted to the email provider. Inbound and outbound rules are isolated — inbound rules never run during sends, and outbound rules never run on message receipt.

Inbound rules can match from.address, from.domain, or from.tld. Outbound rules can match from.address, from.domain, from.tld, recipient.address, recipient.domain, recipient.tld, or outbound.type (compose or reply). Link inbound rules to a policy to apply them to specific Agent Accounts. Outbound rules are currently evaluated from the sending application's enabled outbound rules.

The application_id and organization_id are derived from your API key and are read-only.

post/v3/rules

Request body

namestring required

A human-readable name for the rule.

descriptionstring
priorityinteger
enabledboolean
trigger'inbound' | 'outbound'

When the rule is evaluated. inbound runs the rule on incoming messages; outbound runs the rule on sends before they're submitted to the email provider. Inbound rules accept only from.* conditions. Outbound rules accept from.*, recipient.*, and outbound.type.

Example request

{
  "name": "Block spam domains",
  "description": "Rejects messages from known spam domains at the SMTP level.",
  "priority": 1,
  "enabled": true,
  "trigger": "inbound",
  "match": {
    "operator": "any",
    "conditions": [
      {
        "field": "from.domain",
        "operator": "is"
      }
    ]
  },
  "actions": [
    {
      "type": "block",
      "value": "Receipts"
    }
  ]
}

Response

Created

request_idstring

ID of the request.

Example response

{
  "request_id": "5fa64c92-e840-4357-86b9-2aa364d35b88",
  "data": {
    "id": "c1d2e3f4-5678-4abc-9def-0123456789ab",
    "name": "Block spam domains",
    "description": "Rejects messages from known spam domains at the SMTP level.",
    "priority": 1,
    "enabled": true,
    "trigger": "inbound",
    "match": {
      "operator": "any",
      "conditions": [
        {
          "field": "from.domain",
          "operator": "is"
        }
      ]
    },
    "actions": [
      {
        "type": "block",
        "value": "Receipts"
      }
    ],
    "application_id": "ad410018-d306-43f9-8361-fa5d7b2172e0",
    "organization_id": "org-abc123",
    "created_at": 1742932766,
    "updated_at": 1742932766
  }
}

Changes