---
title: "GET /email-rules"
method: GET
path: "/email-rules"
---

# GET /email-rules

`GET /email-rules`

## Request

- Base URL: `https://api.useanima.sh/v1`
- URL: `https://api.useanima.sh/v1/email-rules`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Query parameters

- `direction` 'SEND' | 'RECEIVE': Filter to one direction
- `action` 'ALLOW' | 'BLOCK': Filter to one action
- `agentId` string: Filter to the rules that BIND this agent — its own rules plus org-wide ones, i.e. exactly the set evaluated when it sends or receives. To list only org-wide rules, use scope=org instead.
- `scope` 'org' | 'agent' | 'all': org = org-wide rules only; agent = agent-scoped rules only; all (default) = both. Combine with agentId to answer 'what binds this agent?'

## Response `200`

OK

- object: A list of email allow/block rules
  - `rules` object[], required: Matching rules, newest first
    - `id` string, required: Unique identifier of the rule
    - `direction` 'SEND' | 'RECEIVE', required: SEND governs who this org's agents may email (enforced when a send is attempted); RECEIVE governs whose mail is accepted for them (enforced at ingest, before the message is stored or any webhook fires). Reply-scope is not implemented.
    - `action` 'ALLOW' | 'BLOCK', required: BLOCK refuses the matching address. ALLOW does two things: it carves an exception out of a broader BLOCK, AND it switches that scope+direction into allow-list mode — once any ALLOW rule exists, addresses it does not cover are refused. Adding one ALLOW rule therefore restricts far more than it permits.
    - `patternType` 'ADDRESS' | 'DOMAIN', required: ADDRESS matches one exact address. DOMAIN matches the domain and its subdomains ('example.com' covers 'a@mail.example.com' but never 'a@notexample.com'). ADDRESS beats DOMAIN when both match.
    - `pattern` string, required: The normalized (lowercase) address or domain this rule matches
    - `agentId` string, nullable, required: The agent this rule is scoped to, or null for an org-wide rule
    - `note` string, nullable, required: Operator note, or null if not set
    - `createdAt` string, date-time, required: Timestamp when the rule was created
    - `updatedAt` string, date-time, required: Timestamp when the rule was last modified
  - `total` integer, required: Number of rules returned

---

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