> ## 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.

# Update guard rule

> Update an existing guard rule.



## OpenAPI

````yaml https://inbound.new/openapi.json put /api/e2/guard/{id}
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/guard/{id}:
    put:
      tags:
        - Guard
      summary: Update guard rule
      description: Update an existing guard rule.
      operationId: putApiE2GuardById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  description: Rule name
                  type: string
                description:
                  description: Rule description
                  type: string
                config:
                  description: Rule configuration (JSON)
                isActive:
                  description: Whether the rule is active
                  type: boolean
                priority:
                  description: Rule priority
                  type: number
                action:
                  description: >-
                    Action to take when the rule matches: allow (also marks the
                    email as not junk), block, junk, or route to an owned
                    endpoint. Defaults to allow when omitted.
                  oneOf:
                    - title: Allow
                      description: Deliver the email and mark it as not junk.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: allow
                    - title: Block
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: block
                    - title: Junk
                      description: >-
                        Mark the email as junk. It is still delivered to
                        endpoints, and shown in the Junk folder of mailboxes.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: junk
                    - title: Route
                      type: object
                      required:
                        - action
                        - endpointId
                      properties:
                        action:
                          const: route
                        endpointId:
                          type: string
                          description: ID of an active endpoint owned by the account.
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  description: Rule name
                  type: string
                description:
                  description: Rule description
                  type: string
                config:
                  description: Rule configuration (JSON)
                isActive:
                  description: Whether the rule is active
                  type: boolean
                priority:
                  description: Rule priority
                  type: number
                action:
                  description: >-
                    Action to take when the rule matches: allow (also marks the
                    email as not junk), block, junk, or route to an owned
                    endpoint. Defaults to allow when omitted.
                  oneOf:
                    - title: Allow
                      description: Deliver the email and mark it as not junk.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: allow
                    - title: Block
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: block
                    - title: Junk
                      description: >-
                        Mark the email as junk. It is still delivered to
                        endpoints, and shown in the Junk folder of mailboxes.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: junk
                    - title: Route
                      type: object
                      required:
                        - action
                        - endpointId
                      properties:
                        action:
                          const: route
                        endpointId:
                          type: string
                          description: ID of an active endpoint owned by the account.
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  description: Rule name
                  type: string
                description:
                  description: Rule description
                  type: string
                config:
                  description: Rule configuration (JSON)
                isActive:
                  description: Whether the rule is active
                  type: boolean
                priority:
                  description: Rule priority
                  type: number
                action:
                  description: >-
                    Action to take when the rule matches: allow (also marks the
                    email as not junk), block, junk, or route to an owned
                    endpoint. Defaults to allow when omitted.
                  oneOf:
                    - title: Allow
                      description: Deliver the email and mark it as not junk.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: allow
                    - title: Block
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: block
                    - title: Junk
                      description: >-
                        Mark the email as junk. It is still delivered to
                        endpoints, and shown in the Junk folder of mailboxes.
                      type: object
                      required:
                        - action
                      properties:
                        action:
                          const: junk
                    - title: Route
                      type: object
                      required:
                        - action
                        - endpointId
                      properties:
                        action:
                          const: route
                        endpointId:
                          type: string
                          description: ID of an active endpoint owned by the account.
      responses:
        '200':
          description: Response for status 200
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  userId:
                    type: string
                  name:
                    type: string
                  description:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  type:
                    type: string
                  config:
                    type: string
                  isActive:
                    nullable: true
                    anyOf:
                      - type: boolean
                      - type: 'null'
                  priority:
                    nullable: true
                    anyOf:
                      - type: number
                      - type: 'null'
                  lastTriggeredAt:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  triggerCount:
                    nullable: true
                    anyOf:
                      - type: number
                      - type: 'null'
                  actions:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  createdAt:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  updatedAt:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                required:
                  - id
                  - userId
                  - name
                  - description
                  - type
                  - config
                  - isActive
                  - priority
                  - lastTriggeredAt
                  - triggerCount
                  - actions
                  - 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
        '404':
          description: Response for status 404
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      x-codeSamples:
        - lang: typescript
          label: TypeScript
          source: |-
            import Inbound from "inboundemail";

            const inbound = new Inbound();
            const result = await inbound.guard.update("<ruleId>", {
              name: "Support",
              isActive: true
            });
        - lang: curl
          label: cURL
          source: |-
            curl -X PUT 'https://inbound.new/api/e2/guard/<ruleId>' \
              -H "Authorization: Bearer $INBOUND_API_KEY" \
              -H 'Content-Type: application/json' \
              -d '{
              "name": "Support",
              "isActive": true
            }'
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.