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

# Create a mailbox filter

> Add a filter that runs last. Filters apply to mail as it reaches the mailbox (and to existing mail with the apply endpoint). `move_to` folders must exist and can't be scope folders. At most 100 filters per mailbox, 20 conditions and 20 actions per filter.



## OpenAPI

````yaml https://inbound.new/openapi.json post /api/e2/mailboxes/{id}/filters
openapi: 3.1.0
info:
  title: Inbound Email API
  description: >+

    # Inbound API


    The Inbound API allows you to manage email infrastructure programmatically -
    domains, email addresses, webhooks, and more.


    ## Authentication


    All API requests require a Bearer token in the Authorization header:


    ```bash

    curl -H "Authorization: Bearer YOUR_API_KEY" \
      https://inbound.new/api/e2/domains
    ```


    ## Base URL


    ```

    https://inbound.new/api/e2

    ```


    ## Quick Start


    1. **Create a domain** - Register your domain with Inbound

    2. **Configure DNS** - Add the provided DNS records to your domain

    3. **Create an email address** - Set up addresses to receive emails

    4. **Create an endpoint** - Configure where emails are delivered (webhook,
    forwarding, etc.)

  version: 2.0.0
servers:
  - url: https://inbound.new
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Webhooks
    description: Webhooks sent by Inbound to your configured endpoints when events occur.
  - name: Emails
    description: >-
      Send, list, and manage emails. Supports immediate sending, scheduling,
      replies, and retry functionality.
  - name: Mail
    description: >-
      Inbox and thread views for received emails. Filter by domain, address, or
      search.
  - name: Domains
    description: >-
      Manage domains for sending and receiving emails. Domains must be verified
      via DNS before use.
  - name: Endpoints
    description: >-
      Configure where incoming emails are delivered - webhooks, email
      forwarding, or custom handlers.
  - name: Email Addresses
    description: Create and manage email addresses on your verified domains.
  - name: Attachments
    description: Download email attachments using authenticated requests.
paths:
  /api/e2/mailboxes/{id}/filters:
    post:
      tags:
        - Mailboxes
      summary: Create a mailbox filter
      description: >-
        Add a filter that runs last. Filters apply to mail as it reaches the
        mailbox (and to existing mail with the apply endpoint). `move_to`
        folders must exist and can't be scope folders. At most 100 filters per
        mailbox, 20 conditions and 20 actions per filter.
      operationId: postApiE2MailboxesByIdFilters
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  maxLength: 255
                  type: string
                enabled:
                  description: Default true
                  type: boolean
                match:
                  type: string
                  enum:
                    - all
                    - any
                conditions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      field:
                        type: string
                        enum:
                          - from
                          - to
                          - cc
                          - recipient
                          - subject
                          - header
                          - body
                          - has_attachment
                          - size
                          - junk
                          - jev
                      operator:
                        type: string
                        enum:
                          - contains
                          - not_contains
                          - equals
                          - not_equals
                          - starts_with
                          - ends_with
                          - domain_is
                          - exists
                          - greater_than
                          - less_than
                          - gte
                      value:
                        anyOf:
                          - maxLength: 1024
                            type: string
                          - type: number
                          - type: boolean
                      header:
                        maxLength: 255
                        description: Header name, required when field is `header`
                        type: string
                      label:
                        maxLength: 64
                        description: >-
                          Jev dimension, required when field is `jev`: spam,
                          phishing, fraud, impersonation or malware
                        type: string
                    required:
                      - field
                      - operator
                actions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - move_to
                          - mark_read
                          - flag
                          - add_keyword
                          - mark_junk
                          - mark_not_junk
                          - move_to_trash
                          - stop
                      value:
                        maxLength: 1024
                        description: >-
                          Folder path for `move_to`, keyword for `add_keyword`;
                          omitted otherwise
                        type: string
                    required:
                      - type
                stopProcessing:
                  description: Skip later filters when this one matches. Default false.
                  type: boolean
              required:
                - name
                - conditions
                - actions
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  maxLength: 255
                  type: string
                enabled:
                  description: Default true
                  type: boolean
                match:
                  type: string
                  enum:
                    - all
                    - any
                conditions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      field:
                        type: string
                        enum:
                          - from
                          - to
                          - cc
                          - recipient
                          - subject
                          - header
                          - body
                          - has_attachment
                          - size
                          - junk
                          - jev
                      operator:
                        type: string
                        enum:
                          - contains
                          - not_contains
                          - equals
                          - not_equals
                          - starts_with
                          - ends_with
                          - domain_is
                          - exists
                          - greater_than
                          - less_than
                          - gte
                      value:
                        anyOf:
                          - maxLength: 1024
                            type: string
                          - type: number
                          - type: boolean
                      header:
                        maxLength: 255
                        description: Header name, required when field is `header`
                        type: string
                      label:
                        maxLength: 64
                        description: >-
                          Jev dimension, required when field is `jev`: spam,
                          phishing, fraud, impersonation or malware
                        type: string
                    required:
                      - field
                      - operator
                actions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - move_to
                          - mark_read
                          - flag
                          - add_keyword
                          - mark_junk
                          - mark_not_junk
                          - move_to_trash
                          - stop
                      value:
                        maxLength: 1024
                        description: >-
                          Folder path for `move_to`, keyword for `add_keyword`;
                          omitted otherwise
                        type: string
                    required:
                      - type
                stopProcessing:
                  description: Skip later filters when this one matches. Default false.
                  type: boolean
              required:
                - name
                - conditions
                - actions
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  maxLength: 255
                  type: string
                enabled:
                  description: Default true
                  type: boolean
                match:
                  type: string
                  enum:
                    - all
                    - any
                conditions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      field:
                        type: string
                        enum:
                          - from
                          - to
                          - cc
                          - recipient
                          - subject
                          - header
                          - body
                          - has_attachment
                          - size
                          - junk
                          - jev
                      operator:
                        type: string
                        enum:
                          - contains
                          - not_contains
                          - equals
                          - not_equals
                          - starts_with
                          - ends_with
                          - domain_is
                          - exists
                          - greater_than
                          - less_than
                          - gte
                      value:
                        anyOf:
                          - maxLength: 1024
                            type: string
                          - type: number
                          - type: boolean
                      header:
                        maxLength: 255
                        description: Header name, required when field is `header`
                        type: string
                      label:
                        maxLength: 64
                        description: >-
                          Jev dimension, required when field is `jev`: spam,
                          phishing, fraud, impersonation or malware
                        type: string
                    required:
                      - field
                      - operator
                actions:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - move_to
                          - mark_read
                          - flag
                          - add_keyword
                          - mark_junk
                          - mark_not_junk
                          - move_to_trash
                          - stop
                      value:
                        maxLength: 1024
                        description: >-
                          Folder path for `move_to`, keyword for `add_keyword`;
                          omitted otherwise
                        type: string
                    required:
                      - type
                stopProcessing:
                  description: Skip later filters when this one matches. Default false.
                  type: boolean
              required:
                - name
                - conditions
                - actions
      responses:
        '201':
          description: Response for status 201
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  position:
                    type: number
                  enabled:
                    type: boolean
                  match:
                    type: string
                    enum:
                      - all
                      - any
                  conditions:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          enum:
                            - from
                            - to
                            - cc
                            - recipient
                            - subject
                            - header
                            - body
                            - has_attachment
                            - size
                            - junk
                            - jev
                        operator:
                          type: string
                          enum:
                            - contains
                            - not_contains
                            - equals
                            - not_equals
                            - starts_with
                            - ends_with
                            - domain_is
                            - exists
                            - greater_than
                            - less_than
                            - gte
                        value:
                          anyOf:
                            - maxLength: 1024
                              type: string
                            - type: number
                            - type: boolean
                        header:
                          maxLength: 255
                          description: Header name, required when field is `header`
                          type: string
                        label:
                          maxLength: 64
                          description: >-
                            Jev dimension, required when field is `jev`: spam,
                            phishing, fraud, impersonation or malware
                          type: string
                      required:
                        - field
                        - operator
                  actions:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - move_to
                            - mark_read
                            - flag
                            - add_keyword
                            - mark_junk
                            - mark_not_junk
                            - move_to_trash
                            - stop
                        value:
                          maxLength: 1024
                          description: >-
                            Folder path for `move_to`, keyword for
                            `add_keyword`; omitted otherwise
                          type: string
                      required:
                        - type
                  stopProcessing:
                    type: boolean
                  createdAt:
                    format: date-time
                    type: string
                  updatedAt:
                    format: date-time
                    type: string
                required:
                  - id
                  - name
                  - position
                  - enabled
                  - match
                  - conditions
                  - actions
                  - stopProcessing
                  - createdAt
                  - updatedAt
        '400':
          description: Response for status 400
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Response for status 404
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '409':
          description: Response for status 409
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Inbound API key. Include it in the Authorization header as: Bearer
        <your-api-key>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.