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

# List categorization rules

> Returns a list of categorization rules for the specified business. Rules can be filtered by archived status and external IDs. Results are paginated.



## OpenAPI

````yaml get /v1/businesses/{businessId}/categorization-rules
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/categorization-rules:
    get:
      tags:
        - Categorization Rules
      summary: List categorization rules
      description: >-
        Returns a list of categorization rules for the specified business. Rules
        can be filtered by archived status and external IDs. Results are
        paginated.
      operationId: business.categorization-rules.list
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json.
          schema:
            type: string
        - name: include_archived
          in: query
          description: 'Include archived rules in the response (default: false).'
          required: false
          schema:
            type: boolean
            default: false
        - name: external_ids
          in: query
          description: Comma-separated list of external IDs to filter by.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Maximum number of results per page.
          required: false
          schema:
            type: integer
        - name: sort_by
          in: query
          description: 'Field to sort by (default: created_at).'
          required: false
          schema:
            type: string
            default: created_at
        - name: sort_order
          in: query
          description: Sort order (ASC or DESC).
          required: false
          schema:
            type: string
            enum:
              - ASC
              - DESC
        - name: pagination_cursor
          in: query
          description: Pagination cursor for fetching next page.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: List of categorization rules.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CategorizationRule'
                  pagination:
                    $ref: '#/components/schemas/PaginationMetadata'
      deprecated: false
components:
  schemas:
    CategorizationRule:
      type: object
      description: >-
        A categorization rule that automatically categorizes transactions
        matching specified filters.
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the rule.
        business_id:
          type: string
          format: uuid
          description: The business this rule belongs to.
        name:
          type: string
          description: Name of the rule.
        created_at:
          type: string
          format: date-time
          description: When the rule was created.
        updated_at:
          type: string
          format: date-time
          description: When the rule was last updated.
        category:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_1:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_2:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_3:
          $ref: '#/components/schemas/BankTransactionClassification'
        merchant_type_filter:
          type: string
          description: Regex pattern matching merchant type.
        transaction_description_filter:
          type: string
          description: Regex pattern matching transaction description.
        counterparty_filter:
          $ref: '#/components/schemas/BankTransactionCounterparty'
        bank_transaction_type_filter:
          $ref: '#/components/schemas/BankTransactionType'
        bank_direction_filter:
          type: string
          enum:
            - MONEY_IN
            - MONEY_OUT
          description: Transaction direction that this rule matches.
        amount_min_filter:
          type: integer
          format: int64
          description: Minimum amount in cents.
        amount_max_filter:
          type: integer
          format: int64
          description: Maximum amount in cents.
      required:
        - id
        - business_id
        - created_at
        - updated_at
    PaginationMetadata:
      type: object
      description: >-
        Cursor-based pagination metadata returned alongside paginated list
        responses.
      properties:
        sort_by:
          type: string
          nullable: true
          description: Field the result set is sorted by.
        sort_order:
          type: string
          enum:
            - ASC
            - DESC
          description: Sort direction applied to the result set.
        cursor:
          type: string
          nullable: true
          description: >-
            Opaque cursor to pass as `pagination_cursor` to fetch the next page.
            Null when there are no further pages.
        has_more:
          type: boolean
          description: Whether additional pages are available after the current one.
        total_count:
          type: integer
          format: int64
          nullable: true
          description: Total number of records across all pages, when available.
      required:
        - sort_by
        - sort_order
        - cursor
        - has_more
    BankTransactionClassification:
      discriminator:
        propertyName: type
        mapping:
          AccountId:
            $ref: '#/components/schemas/AccountId'
          StableName:
            $ref: '#/components/schemas/AccountStableName'
          Exclusion:
            $ref: '#/components/schemas/Exclusion'
      oneOf:
        - $ref: '#/components/schemas/AccountId'
          title: Account ID
        - $ref: '#/components/schemas/AccountStableName'
          title: Account Stable Name
        - $ref: '#/components/schemas/Exclusion'
          title: Exclusion
    BankTransactionCounterparty:
      type: object
      description: Information about a transaction counterparty (merchant/vendor).
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the counterparty.
        name:
          type: string
          description: Name of the counterparty.
        logo_url:
          type: string
          description: URL to the counterparty's logo.
        website:
          type: string
          description: Counterparty website.
    BankTransactionType:
      type: string
      description: Type of bank transaction.
      enum:
        - REVENUE
        - LOAN_DISBURSEMENT
        - REFUND_RECEIVED
        - INCOMING_P2P_TRANSFER
        - INTRA_ACCOUNT_TRANSFER_IN
        - CHECK_WITHDRAWAL
        - ATM_DEPOSIT
        - BANK_DEPOSIT
        - BANK_VERIFICATION_TRIAL_CREDIT
        - REVERSAL_IN
        - CREDIT_CARD_REWARD
        - CREDIT_CARD_PAYMENT_IN
        - INTEREST_EARNED
        - GOVERNMENT_OR_OTHER_GRANT
        - TAX_REFUND
        - PURCHASE
        - REFUND_GIVEN
        - OUTGOING_P2P_TRANSFER
        - INTRA_ACCOUNT_TRANSFER_OUT
        - CHECK_DEPOSIT
        - CREDIT_CARD_PAYMENT_OUT
        - ATM_WITHDRAWAL
        - BANK_WITHDRAWAL
        - BANKING_FEE
        - PAYMENT_PROCESSING_FEE
        - BANK_VERIFICATION_TRIAL_DEBIT
        - REVERSAL_OUT
        - LOAN_PAYMENT
        - TAX_PAYMENT
        - NOT_ENOUGH_INFORMATION
    AccountId:
      type: object
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - AccountId
          description: Resource type. Value will be `AccountId`.
          example: AccountId
        id:
          type: string
          format: uuid
          description: ID of the account.
    AccountStableName:
      type: object
      required:
        - type
        - stable_name
      properties:
        type:
          type: string
          enum:
            - StableName
          description: Resource type. Value will be `StableName`.
          example: StableName
        stable_name:
          type: string
          example: CURRENT_ASSETS
          description: Stable name of the account.
    Exclusion:
      type: object
      properties:
        type:
          type: string
          enum:
            - Exclusion
          description: Resource type. Value will be `Exclusion`.
        exclusion_type:
          $ref: '#/components/schemas/ExclusionType'
      required:
        - type
        - exclusion_type
    ExclusionType:
      type: string
      description: Type of exclusion for a bank transaction.
      enum:
        - PERSONAL_EXPENSES
        - PERSONAL_INFLOWS
        - DUPLICATE_TRANSACTION
        - OTHER_EXCLUSION
      x-displayStrings:
        PERSONAL_EXPENSES: Personal transactions
        PERSONAL_INFLOWS: Personal income sources
        DUPLICATE_TRANSACTION: Duplicate transaction
        OTHER_EXCLUSION: Other exclusion
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````