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

# Update a rule



## OpenAPI

````yaml /openapi.json patch /api/automations/rules/{id}
openapi: 3.1.0
info:
  title: Equated API
  version: 1.0.0
  description: >-
    Agent-facing accounting API. Authenticate with a bearer token issued from
    Settings → API Tokens, or via the in-app session cookie when called from the
    web client.
servers:
  - url: https://app.equated.co
    description: API server
security: []
paths:
  /api/automations/rules/{id}:
    patch:
      tags:
        - Automations
      summary: Update a rule
      parameters:
        - schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                description:
                  type: string
                  nullable: true
                  maxLength: 500
                subjectType:
                  type: string
                  enum:
                    - RECEIPT
                    - TRANSACTION
                triggerEvent:
                  type: string
                  enum:
                    - RECEIPT_PARSED
                    - TRANSACTION_INGESTED
                    - TRANSACTION_UPDATED
                    - MANUAL_PREVIEW
                    - MANUAL_APPLY
                priority:
                  type: integer
                stopProcessing:
                  type: boolean
                conditions:
                  $ref: '#/components/schemas/AutomationConditionGroup'
                effects:
                  type: array
                  items:
                    oneOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - SET_CURRENCY
                          currency:
                            type: string
                            minLength: 3
                            maxLength: 10
                          sortOrder:
                            type: integer
                            minimum: 0
                        required:
                          - kind
                          - currency
                          - sortOrder
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - SET_ACCOUNT
                          accountId:
                            type: integer
                            minimum: 0
                            exclusiveMinimum: true
                          sortOrder:
                            type: integer
                            minimum: 0
                        required:
                          - kind
                          - accountId
                          - sortOrder
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - SET_MERCHANT
                          orgMerchantId:
                            type: integer
                            minimum: 0
                            exclusiveMinimum: true
                          sortOrder:
                            type: integer
                            minimum: 0
                        required:
                          - kind
                          - orgMerchantId
                          - sortOrder
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - AUTO_POST
                          sortOrder:
                            type: integer
                            minimum: 0
                        required:
                          - kind
                          - sortOrder
                  minItems: 1
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule:
                    $ref: '#/components/schemas/AutomationRule'
        '400':
          description: Invalid update
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - bearerAuth: []
components:
  schemas:
    AutomationConditionGroup:
      type: object
      properties:
        combinator:
          type: string
          enum:
            - AND
            - OR
        conditions:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  field:
                    anyOf:
                      - type: string
                        enum:
                          - receipt.fileName
                          - receipt.sourceEmail
                          - receipt.sourceSubject
                      - type: string
                        enum:
                          - transaction.name
                          - transaction.merchantName
                  operator:
                    type: string
                    enum:
                      - EQ
                      - CONTAINS
                      - REGEX
                      - IN
                  value:
                    anyOf:
                      - type: string
                      - type: array
                        items:
                          type: string
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.search
                  operator:
                    type: string
                    enum:
                      - CONTAINS
                  value:
                    type: string
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.amount
                  operator:
                    type: string
                    enum:
                      - EQ
                      - GT
                      - GTE
                      - LT
                      - LTE
                      - BETWEEN
                  value:
                    anyOf:
                      - type: number
                      - type: array
                        items:
                          type: number
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.orgMerchantId
                  operator:
                    type: string
                    enum:
                      - EQ
                  value:
                    type: integer
                    minimum: 0
                    exclusiveMinimum: true
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.orgMerchantId
                  operator:
                    type: string
                    enum:
                      - IN
                  value:
                    type: array
                    items:
                      type: integer
                      minimum: 0
                      exclusiveMinimum: true
                    minItems: 1
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.accountId
                  operator:
                    type: string
                    enum:
                      - EQ
                      - IN
                  value:
                    anyOf:
                      - type: integer
                      - type: array
                        items:
                          type: integer
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.direction
                  operator:
                    type: string
                    enum:
                      - EQ
                      - IN
                  value:
                    anyOf:
                      - type: string
                        enum:
                          - IN
                          - OUT
                      - type: array
                        items:
                          type: string
                          enum:
                            - IN
                            - OUT
                required:
                  - field
                  - operator
                  - value
              - type: object
                properties:
                  field:
                    type: string
                    enum:
                      - transaction.isoCurrencyCode
                  operator:
                    type: string
                    enum:
                      - EQ
                      - IN
                  value:
                    anyOf:
                      - type: string
                      - type: array
                        items:
                          type: string
                required:
                  - field
                  - operator
                  - value
      required:
        - combinator
        - conditions
    AutomationRule:
      nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token issued from the Equated app under Settings → API Tokens.

````