> ## 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:
        - OAuth2ClientCredentialsBearer:
            - 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, per tag field, the first one whose conditions match
            and that sets the field.
        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
        splits:
          items:
            $ref: '#/components/schemas/TenantTxnClassificationSplitRequest'
          type: array
          title: Splits
          description: >-
            Percentages of the transaction amount posted to other ledgers ahead
            of the target ledger, in order; they total at most 100 and whatever
            remains goes to the target ledger.
          examples:
            - - ledger_name: Sales Tax Payable
                percentage: 8.875
              - ledger_name: Bank Fees
                percentage: 10
        tags:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  anyOf:
                    - type: string
                    - $ref: '#/components/schemas/TagShareRequest'
                type: array
          type: object
          title: Tags
          description: >-
            Tag field name to the value or values to apply, each a string or
            `{value, percentage}` to allocate a share of the transaction amount
            to the value. For each tag field, the first matching classification
            that sets it applies its values, business rules before tenant rules.
            The field must be a tenant tag field; the value is created on the
            matching business's field when applied.
          examples:
            - Job:
                - percentage: 60
                  value: Maple Street Remodel
                - percentage: 40
                  value: Oak Avenue Deck
              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.
        splits:
          items:
            $ref: '#/components/schemas/TenantTxnClassificationSplitPublic'
          type: array
          title: Splits
          description: >-
            Percentages of the transaction amount posted to other ledgers ahead
            of the target ledger, in order; they total at most 100 and whatever
            remains goes to the target ledger.
        tags:
          additionalProperties:
            items:
              $ref: '#/components/schemas/TagSharePublic'
            type: array
          type: object
          title: Tags
          description: Tag field name to the values applied, with their shares.
      type: object
      required:
        - conditions
        - target_ledger_name
        - splits
        - 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
    TenantTxnClassificationSplitRequest:
      properties:
        percentage:
          anyOf:
            - type: number
              maximum: 100
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Percentage
          description: >-
            Share of the transaction amount to post to the ledger, over 0 and up
            to 100.
          examples:
            - 50
        ledger_name:
          type: string
          maxLength: 255
          minLength: 1
          title: Ledger Name
          description: >-
            The ledger name the split posts to, resolved against each business's
            chart of accounts like target_ledger_name; each split uses a
            different name. It may be target_ledger_name, which then also takes
            the remainder. A business lacking the ledger skips the
            classification.
          examples:
            - Sales Tax Payable
      type: object
      required:
        - percentage
        - ledger_name
      title: TenantTxnClassificationSplitRequest
    TagShareRequest:
      properties:
        value:
          type: string
          title: Value
          description: The tag value to apply.
          examples:
            - Maple Street Remodel
        percentage:
          anyOf:
            - type: number
              maximum: 100
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Percentage
          description: >-
            Share of the transaction amount to allocate to this value, over 0
            and up to 100. Within a field either every value or none has a
            percentage, and they total at most 100. Omit to allocate the amount
            evenly across the field's values.
          examples:
            - 60
      type: object
      required:
        - value
      title: TagShareRequest
    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
    TenantTxnClassificationSplitPublic:
      properties:
        ledger_name:
          type: string
          title: Ledger Name
          description: The ledger name the split posts to.
        percentage:
          type: number
          title: Percentage
          description: Share of the transaction amount posted to the ledger.
      type: object
      required:
        - ledger_name
        - percentage
      title: TenantTxnClassificationSplitPublic
    TagSharePublic:
      properties:
        value:
          type: string
          title: Value
          description: The tag value applied.
        percentage:
          anyOf:
            - type: number
            - type: 'null'
          title: Percentage
          description: >-
            Share of the transaction amount allocated to the value; null
            allocates evenly across the field's values.
      type: object
      required:
        - value
      title: TagSharePublic
    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:
    OAuth2ClientCredentialsBearer:
      type: oauth2
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /v0/auth/token

````

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