---
title: "Create an allow/block rule"
method: POST
path: "/email-rules"
tags: ["Email Rules"]
---

# Create an allow/block rule

`POST /email-rules`

## Request

- Base URL: `https://sending.dev/api/v1`
- URL: `https://sending.dev/api/v1/email-rules`
- Auth: HTTP bearer

Precedence allow > block. Required scope: `inbox:write`. (`inbox:*` scope cannot be assigned from the UI: it requires a full-access `*` key).

## Request body

- CreateEmailRuleInput
  - `action` 'allow' | 'block', required
  - `matchType` 'email' | 'domain', required
  - `value` string, required
  - `note` string

## Response `201`

Rule created.

- EmailRuleEnvelope
  - `rule` EmailRule, required
    - `id` string, uuid, required
    - `action` string, required
    - `matchType` string, required
    - `value` string, required
    - `note` string, nullable
    - `createdAt` string, date-time

## Other responses

- `401`: Missing or invalid token.
- `403`: Insufficient scope.
- `409`: State conflict (e.g. duplicate).
- `422`: Invalid input.

---

[API](https://skmtc.dev/sending/apis/sending-dev-api.md) · [All operations](https://skmtc.dev/sending/apis/sending-dev-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sending/apis/sending-dev-api/revisions/9fe78d2918a1?raw)
