Skip to content
Skip to main content
POST
/v3/rules

Create a ruleBeta

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.

NYLAS API KEY

Request body

name*string

A human-readable name for the rule.

Example: "Block spam domains"
descriptionstring
Example: "Rejects messages from known spam domains at the SMTP level."
priorityinteger
Default: 10
Example: 1
min: 0max: 1000
enabledboolean
Default: true
Example: true
triggerstring

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.

inboundoutbound
Default: "inbound"
Example: "inbound"
match*object
actions*array<object>
minItems: 1

Responses

request_idstring

ID of the request.

Example: "5fa64c92-e840-4357-86b9-2aa364d35b88"
dataobject
POSThttps://api.us.nylas.com/v3/rules

Find your API key in the Nylas Dashboard under API Keys in your application settings.

Loading editor...

Autocomplete and validation come from this endpoint's request schema.