> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useanima.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Get email rules



## OpenAPI

````yaml /openapi.json get /email-rules
openapi: 3.1.1
info:
  title: Anima API
  version: 0.1.0
  description: >-
    The Anima API provides programmatic access to unified infrastructure for AI
    agents: create and manage agents; send and receive email; place phone calls
    and send/receive SMS and voice; store and retrieve vault credentials; manage
    agent identity; and configure webhooks for real-time events. Authenticate
    using a Bearer token or an API key passed via the X-API-Key header.
  contact:
    name: Anima Labs
    url: https://useanima.sh
    email: support@useanima.sh
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.useanima.sh/v1
    description: Production
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /email-rules:
    get:
      operationId: emailRule.list
      parameters:
        - name: direction
          in: query
          schema:
            enum:
              - SEND
              - RECEIVE
            type: string
            description: Filter to one direction
          allowEmptyValue: true
          allowReserved: true
        - name: action
          in: query
          schema:
            enum:
              - ALLOW
              - BLOCK
            type: string
            description: Filter to one action
          allowEmptyValue: true
          allowReserved: true
        - name: agentId
          in: query
          schema:
            type: string
            pattern: ^[cC][^\s-]{8,}$
            description: >-
              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.
          allowEmptyValue: true
          allowReserved: true
        - name: scope
          in: query
          schema:
            enum:
              - org
              - agent
              - all
            type: string
            description: >-
              org = org-wide rules only; agent = agent-scoped rules only; all
              (default) = both. Combine with agentId to answer 'what binds this
              agent?'
          allowEmptyValue: true
          allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  rules:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          pattern: ^[cC][^\s-]{8,}$
                          description: Unique identifier of the rule
                        direction:
                          enum:
                            - SEND
                            - RECEIVE
                          type: string
                          description: >-
                            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:
                          enum:
                            - ALLOW
                            - BLOCK
                          type: string
                          description: >-
                            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:
                          enum:
                            - ADDRESS
                            - DOMAIN
                          type: string
                          description: >-
                            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:
                          type: string
                          description: >-
                            The normalized (lowercase) address or domain this
                            rule matches
                        agentId:
                          anyOf:
                            - type: string
                              pattern: ^[cC][^\s-]{8,}$
                            - type: 'null'
                          description: >-
                            The agent this rule is scoped to, or null for an
                            org-wide rule
                        note:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: Operator note, or null if not set
                        createdAt:
                          type: string
                          format: date-time
                          description: Timestamp when the rule was created
                        updatedAt:
                          type: string
                          format: date-time
                          description: Timestamp when the rule was last modified
                      required:
                        - id
                        - direction
                        - action
                        - patternType
                        - pattern
                        - agentId
                        - note
                        - createdAt
                        - updatedAt
                      description: An email allow/block rule
                    description: Matching rules, newest first
                  total:
                    type: integer
                    description: Number of rules returned
                required:
                  - rules
                  - total
                description: A list of email allow/block rules
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Bearer token obtained from authentication. Pass as: Authorization:
        Bearer <token>
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'API key for programmatic access. Pass as: X-API-Key: <your-key>'

````