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

# Get rule

> Get a single automation rule for the scoped inbox account.



## OpenAPI

````yaml GET /rules/{id}
openapi: 3.1.0
info:
  title: Inbox Zero API
  version: 1.0.0
  description: >-
    Programmatic access to Inbox Zero inbox stats, automation rules, and sender
    unsubscribe. Docs: https://docs.getinboxzero.com/api-reference/introduction
    Machine-readable schema: /openapi.json Authenticate with an account-scoped
    API key via the API-Key header. Errors return JSON with error.code,
    error.message, and error.hint.
servers:
  - url: https://www.getinboxzero.com/api/v1
    description: Primary server
security:
  - ApiKeyAuth: []
paths:
  /rules/{id}:
    get:
      description: Get a single automation rule for the scoped inbox account.
      operationId: getRule
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  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:
                        type: object
                        properties:
                          conditionalOperator:
                            type:
                              - string
                              - 'null'
                            enum:
                              - AND
                              - OR
                              - null
                          aiInstructions:
                            type:
                              - string
                              - 'null'
                          static:
                            type: object
                            properties:
                              from:
                                type:
                                  - string
                                  - 'null'
                              to:
                                type:
                                  - string
                                  - 'null'
                              subject:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - from
                              - to
                              - subject
                        required:
                          - conditionalOperator
                          - aiInstructions
                          - static
                      actions:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              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
                                - DELETE
                                - INTEGRATION
                            messagingChannelId:
                              type:
                                - string
                                - 'null'
                              format: cuid
                            fields:
                              type: object
                              properties:
                                label:
                                  type:
                                    - string
                                    - 'null'
                                to:
                                  type:
                                    - string
                                    - 'null'
                                cc:
                                  type:
                                    - string
                                    - 'null'
                                bcc:
                                  type:
                                    - string
                                    - 'null'
                                subject:
                                  type:
                                    - string
                                    - 'null'
                                content:
                                  type:
                                    - string
                                    - 'null'
                                webhookUrl:
                                  type:
                                    - string
                                    - 'null'
                                folderName:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - label
                                - to
                                - cc
                                - bcc
                                - subject
                                - content
                                - webhookUrl
                                - folderName
                            delayInMinutes:
                              type:
                                - number
                                - 'null'
                            integrationName:
                              type:
                                - string
                                - 'null'
                            integrationToolName:
                              type:
                                - string
                                - 'null'
                            integrationArgs:
                              type:
                                - object
                                - 'null'
                              additionalProperties: {}
                          required:
                            - type
                            - fields
                            - delayInMinutes
                            - integrationName
                            - integrationToolName
                            - integrationArgs
                    required:
                      - id
                      - name
                      - enabled
                      - runOnThreads
                      - createdAt
                      - updatedAt
                      - condition
                      - actions
                required:
                  - rule
        '400':
          description: Invalid query, path, or request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '401':
          description: Missing, invalid, or expired API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '403':
          description: API key lacks a required scope or is not account-scoped
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '404':
          description: Resource or route not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '405':
          description: HTTP method is not supported for this route
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '429':
          description: Rate limited by the API or email provider
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      security:
        - ApiKeyAuth:
            - RULES_READ
components:
  schemas:
    PublicApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - BAD_REQUEST
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - METHOD_NOT_ALLOWED
                - RATE_LIMITED
                - INTERNAL_ERROR
            message:
              type: string
            hint:
              type: string
          required:
            - code
            - message
            - hint
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: API-Key
      description: >-
        Account-scoped API key created in Settings.

        Operations declare the scopes they require.

        Available scopes:

        - RULES_READ: List and inspect automation rules for this inbox.

        - RULES_WRITE: Create, update, and delete automation rules for this
        inbox.

        - STATS_READ: Read aggregated inbox statistics for this inbox.

        - SENDERS_UNSUBSCRIBE: Unsubscribe from senders for this inbox.
      x-scopes:
        RULES_READ: List and inspect automation rules for this inbox.
        RULES_WRITE: Create, update, and delete automation rules for this inbox.
        STATS_READ: Read aggregated inbox statistics for this inbox.
        SENDERS_UNSUBSCRIBE: Unsubscribe from senders for this inbox.

````

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