<Intro>

<EndpointHeader />

<Description>

Adds an allow or block rule to the mailbox. Rules match the message's envelope sender; domain entries also match subdomains. Block rules always win — over allow rules and over the reply admission on allowlist mailboxes. An entry can be allow or block, never both: to flip it, delete the rule and re-create it. A mailbox holds up to 200 rules.

</Description>

</Intro>

<Payload kind="request">

<Field name="action" type="string" required>

<Description>

What the rule does when it matches. Block rules always win. To flip an entry's action, delete the existing rule and re-create it.

</Description>

<Description>

Possible values: `allow`, `block`

</Description>

</Field>

<Field name="entry" type="string" required>

<Description>

The sender address (`alice@example.com`) or domain (`example.com`) to match. Domains also match their subdomains. Stored lowercase.

</Description>

</Field>

<Field name="note" type="string">

<Description>

Your own note about why the rule exists.

</Description>

</Field>

</Payload>

<Payload kind="response">

<Field name="id" type="string" required>

<Description>

Receive rule ID.

</Description>

</Field>

<Field name="mailbox_id" type="string" required>

<Description>

The mailbox the rule applies to.

</Description>

</Field>

<Field name="action" type="string" required>

<Description>

What the rule does when it matches. Block rules always win — over allow rules and over the reply admission on allowlist mailboxes.

</Description>

<Description>

Possible values: `allow`, `block`

</Description>

</Field>

<Field name="entry" type="string" required>

<Description>

The sender address or domain the rule matches. Domains also match their subdomains.

</Description>

</Field>

<Field name="entry_type" type="string" required>

<Description>

Whether the entry is a full address or a domain.

</Description>

<Description>

Possible values: `address`, `domain`

</Description>

</Field>

<Field name="note" type="nullable string" required>

<Description>

Your own note about why the rule exists. Null when unset.

</Description>

</Field>

<Field name="created_at" type="string" required>

<Description>

When the rule was created.

</Description>

</Field>

</Payload>