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

# Update rule

> Replace an automation rule for the scoped inbox account.



## OpenAPI

````yaml PUT /rules/{id}
openapi: 3.1.0
info:
  title: Inbox Zero API
  version: 1.0.0
servers:
  - url: https://www.getinboxzero.com/api/v1
    description: Production server
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /rules/{id}:
    put:
      description: Replace an automation rule for the scoped inbox account.
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RuleRequestBody'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule:
                    $ref: '#/components/schemas/Rule'
                required:
                  - rule
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RuleRequestBody:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        runOnThreads:
          type: boolean
          default: true
        condition:
          $ref: '#/components/schemas/RuleCondition'
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RuleAction'
          minItems: 1
      required:
        - name
        - condition
        - actions
    Rule:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabled:
          type: boolean
        runOnThreads:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        condition:
          $ref: '#/components/schemas/RuleCondition'
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RuleAction'
      required:
        - id
        - name
        - enabled
        - runOnThreads
        - createdAt
        - updatedAt
        - condition
        - actions
    RuleCondition:
      type: object
      properties:
        conditionalOperator:
          type: string
          enum:
            - AND
            - OR
          nullable: true
        aiInstructions:
          type: string
          nullable: true
        static:
          type: object
          nullable: true
          properties:
            from:
              type: string
              nullable: true
            to:
              type: string
              nullable: true
            subject:
              type: string
              nullable: true
    RuleAction:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ActionType'
        messagingChannelId:
          type: string
          nullable: true
        fields:
          $ref: '#/components/schemas/RuleActionFields'
        delayInMinutes:
          type: number
          nullable: true
      required:
        - type
    ActionType:
      type: string
      enum:
        - LABEL
        - ARCHIVE
        - MARK_READ
        - STAR
        - DRAFT_EMAIL
        - DRAFT_MESSAGING_CHANNEL
        - REPLY
        - FORWARD
        - SEND_EMAIL
        - MARK_SPAM
        - DIGEST
        - CALL_WEBHOOK
        - MOVE_FOLDER
        - NOTIFY_MESSAGING_CHANNEL
        - NOTIFY_SENDER
    RuleActionFields:
      type: object
      properties:
        label:
          type: string
          nullable: true
        to:
          type: string
          nullable: true
        cc:
          type: string
          nullable: true
        bcc:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        content:
          type: string
          nullable: true
        webhookUrl:
          type: string
          nullable: true
        folderName:
          type: string
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: API-Key

````