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

# Update a Tenant Classification Rule

> Update a tenant rule. Omitted fields keep their current values.

**Scopes:** `tenant:update`



## OpenAPI

````yaml /api-reference/openapi.json patch /v0/tenant/rules/classifications/{rule_id}
openapi: 3.1.0
info:
  title: Asset API
  version: '0.1'
servers:
  - url: https://api.sandbox.getasset.com
    description: Sandbox
  - url: https://api.getasset.com
    description: Production
security: []
paths:
  /v0/tenant/rules/classifications/{rule_id}:
    patch:
      tags:
        - Classification Rules
      summary: Update a Tenant Classification Rule
      description: |-
        Update a tenant rule. Omitted fields keep their current values.

        **Scopes:** `tenant:update`
      operationId: >-
        update_tenant_classification_rule_v0_tenant_rules_classifications__rule_id__patch
      parameters:
        - name: rule_id
          in: path
          required: true
          schema:
            description: The id of the classification rule
            examples:
              - clr_GA6EG2qFxA97NZHtxeLPUy
            type: string
            format: clr_string
            title: Rule Id
          description: The id of the classification rule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTenantTxnClassificationRuleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantTxnClassificationRulePublic'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
      security:
        - OAuth2PasswordBearer:
            - tenant:update
components:
  schemas:
    UpdateTenantTxnClassificationRuleRequest:
      properties:
        merchant:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Merchant
        description_match_type:
          anyOf:
            - $ref: '#/components/schemas/DescriptionMatchType'
            - type: 'null'
        description_value:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description Value
        classifications:
          anyOf:
            - items:
                $ref: '#/components/schemas/CreateTenantTxnClassificationRequest'
              type: array
              minItems: 1
            - type: 'null'
          title: Classifications
          description: >-
            Replaces the rule's full list of classifications; omit to keep the
            current ones.
        auto_confirm:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Auto Confirm
        is_active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Active
          description: Whether the rule takes part in categorization and tagging.
      type: object
      title: UpdateTenantTxnClassificationRuleRequest
    TenantTxnClassificationRulePublic:
      properties:
        merchant:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Merchant
          description: >-
            Case-insensitive exact merchant name to match. Mutually exclusive
            with the description criterion; exactly one of the two is required.
          examples:
            - Starbucks
        description_match_type:
          anyOf:
            - $ref: '#/components/schemas/DescriptionMatchType'
            - type: 'null'
          description: How to match the transaction description.
        description_value:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Description Value
          description: Description text to match, case-insensitive.
          examples:
            - MONTHLY SOFTWARE SUBSCRIPTION
        id:
          type: string
          format: clr_string
          title: Id
          description: The id of the classification rule
          examples:
            - clr_GA6EG2qFxA97NZHtxeLPUy
        classifications:
          items:
            $ref: '#/components/schemas/TenantTxnClassificationPublic'
          type: array
          title: Classifications
          description: >-
            Classifications evaluated in order. Categorization applies the first
            one whose conditions match and whose ledger name the business has;
            tagging applies the tags of every one whose conditions match.
        auto_confirm:
          type: boolean
          title: Auto Confirm
        is_active:
          type: boolean
          title: Is Active
          description: Whether the rule takes part in categorization and tagging.
        match_count:
          type: integer
          title: Match Count
          description: Number of transactions the rule has matched.
        last_matched_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Matched At
          description: When the rule last matched a transaction.
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - classifications
        - auto_confirm
        - is_active
        - match_count
        - created_at
      title: TenantTxnClassificationRulePublic
    ErrorResponse:
      properties:
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: A description of the error
        data:
          title: Data
          description: Data associated with the error
      type: object
      required:
        - error
        - data
      title: ErrorResponse
    DescriptionMatchType:
      type: string
      enum:
        - contains
        - not_contains
        - equals
      title: DescriptionMatchType
    CreateTenantTxnClassificationRequest:
      properties:
        conditions:
          $ref: '#/components/schemas/TxnClassificationConditionsSchema-Input'
          description: >-
            Conditions the transaction must satisfy for this classification to
            apply; omit to match every transaction.
        target_ledger_name:
          type: string
          maxLength: 255
          minLength: 1
          title: Target Ledger Name
          description: >-
            The ledger name to categorize the transaction into, resolved against
            each business's chart of accounts. A classification whose ledger
            name does not exist for a business is skipped there.
          examples:
            - Software Expenses
        tags:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  type: string
                type: array
          type: object
          title: Tags
          description: >-
            Tag field name to the value or values to apply. The field must be a
            tenant tag field; the value is created on the matching business's
            field when applied. Every rule matching a transaction applies its
            tags.
          examples:
            - Job:
                - Maple Street Remodel
              Location: NYC
      type: object
      required:
        - target_ledger_name
      title: CreateTenantTxnClassificationRequest
    TenantTxnClassificationPublic:
      properties:
        conditions:
          $ref: '#/components/schemas/TxnClassificationConditionsSchema-Output'
          description: >-
            Conditions the transaction must satisfy for this classification to
            apply.
        target_ledger_name:
          type: string
          title: Target Ledger Name
          description: >-
            The ledger name to categorize the transaction into, resolved against
            each business's chart of accounts.
        tags:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
          title: Tags
          description: Tag field name to the values applied.
      type: object
      required:
        - conditions
        - target_ledger_name
        - tags
      title: TenantTxnClassificationPublic
    TxnClassificationConditionsSchema-Input:
      properties:
        amount:
          anyOf:
            - $ref: '#/components/schemas/AmountPredicate-Input'
            - type: 'null'
          description: Amount constraint; omit to match any amount.
        direction:
          anyOf:
            - $ref: '#/components/schemas/TransactionDirection'
            - type: 'null'
          description: >-
            Match money in (positive amounts) or money out (negative amounts).
            Zero-amount transactions match neither. Omit to match either.
        date:
          anyOf:
            - $ref: '#/components/schemas/DatePredicate'
            - type: 'null'
          description: Date constraint; omit to match any date.
      type: object
      title: TxnClassificationConditionsSchema
    TxnClassificationConditionsSchema-Output:
      properties:
        amount:
          anyOf:
            - $ref: '#/components/schemas/AmountPredicate-Output'
            - type: 'null'
          description: Amount constraint; omit to match any amount.
        direction:
          anyOf:
            - $ref: '#/components/schemas/TransactionDirection'
            - type: 'null'
          description: >-
            Match money in (positive amounts) or money out (negative amounts).
            Zero-amount transactions match neither. Omit to match either.
        date:
          anyOf:
            - $ref: '#/components/schemas/DatePredicate'
            - type: 'null'
          description: Date constraint; omit to match any date.
      type: object
      title: TxnClassificationConditionsSchema
    AmountPredicate-Input:
      properties:
        operator:
          $ref: '#/components/schemas/AmountMatchType'
          description: How to compare the transaction amount.
        value:
          anyOf:
            - type: number
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Value
          description: >-
            Absolute home-currency amount to compare against; the inclusive
            lower bound when operator is between.
          examples:
            - 100
        max_value:
          anyOf:
            - type: number
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Max Value
          description: Inclusive upper bound, set only when operator is between.
          examples:
            - 250
      type: object
      required:
        - operator
        - value
      title: AmountPredicate
    TransactionDirection:
      type: string
      enum:
        - money_in
        - money_out
      title: TransactionDirection
    DatePredicate:
      properties:
        operator:
          $ref: '#/components/schemas/DateMatchType'
          description: How to compare the transaction date (UTC calendar date).
        value:
          type: string
          format: date
          title: Value
          description: >-
            Date to compare against; the inclusive lower bound when operator is
            between.
        max_value:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Max Value
          description: Inclusive upper bound, set only when operator is between.
      type: object
      required:
        - operator
        - value
      title: DatePredicate
    AmountPredicate-Output:
      properties:
        operator:
          $ref: '#/components/schemas/AmountMatchType'
          description: How to compare the transaction amount.
        value:
          type: number
          title: Value
          description: >-
            Absolute home-currency amount to compare against; the inclusive
            lower bound when operator is between.
          examples:
            - 100
        max_value:
          anyOf:
            - type: number
            - type: 'null'
          title: Max Value
          description: Inclusive upper bound, set only when operator is between.
          examples:
            - 250
      type: object
      required:
        - operator
        - value
      title: AmountPredicate
    AmountMatchType:
      type: string
      enum:
        - equals
        - greater_than
        - less_than
        - between
      title: AmountMatchType
    DateMatchType:
      type: string
      enum:
        - equals
        - before
        - after
        - between
      title: DateMatchType
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /v0/auth/token

````