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

# Search accounting code rules

> Search a business entity's accounting code rules. The body is a filter set at the root, plus an optional `any_of` list of filter sets. The root set narrows every result; the `any_of` sets are combined with OR and then applied together with the root, so a rule matches when it satisfies the root set and at least one `any_of` entry. An empty body returns every rule for the business entity.

A filter set has the same shape at the root and in each `any_of` entry:

- A field group — `tag_groups`, `tags`, `types`, `subtypes`, `business_presets`, `expense_accounting_codes`, `liability_accounting_codes` — carries an `include` and/or `exclude` list of values. `include` matches rules whose field is one of the listed values; `exclude` matches rules whose field is none of them, keeping rules where the field is unset. - A `has_<field>` boolean — `has_tag_group`, `has_tag`, `has_type`, `has_subtype`, `has_business_preset`, `has_expense_accounting_code`, `has_liability_accounting_code` — matches rules where the field is set (`true`) or unset (`false`).

Field groups and presence booleans within a set combine with AND.



## OpenAPI

````yaml /spec/openapi.json post /accounting_code_rules/search
openapi: 3.0.0
info:
  title: Nmbr API
  description: API to interact with Nmbr Payroll
  version: 1.0.0
servers:
  - url: https://sandbox.nmbr.co/services/payroll
security:
  - CompanyToken: []
tags:
  - name: Accounting Codes
  - name: Accounting Code Rules
  - name: Adjustments
  - name: Allowances
  - name: Allowance Line Items
  - name: Allowance Types
  - name: Async Tasks
  - name: Bank Accounts
  - name: Business Entities
  - name: Business Entity Verifications
  - name: Business Entity ROE Authorizations
  - name: Business Presets
  - name: Calculations
  - name: Companies
  - name: Contractors
  - name: Deductions
  - name: Deduction Line Items
  - name: Deduction Types
  - name: Earnings
  - name: Earning Line Items
  - name: Earning Types
  - name: Effective Tax Properties
  - name: Employees
  - name: Employee Benefits
  - name: Employee Benefit Line Items
  - name: Employee Benefit Types
  - name: Employer Benefits
  - name: Employer Benefit Line Items
  - name: Employer Benefit Types
  - name: Employer Statutory Withholding Line Items
  - name: Employer Statutory Withholding Types
  - name: Forms
  - name: Form Batches
  - name: Form Types
  - name: Holidays
  - name: Integrations
  - name: Journal Entries
  - name: Overtime Rates
  - name: Partners
  - name: Pay Rates
  - name: Pay Schedules
  - name: Pay Splits
  - name: Pay Stubs
  - name: Payments
  - name: Payrolls
  - name: Reimbursements
  - name: Reimbursement Line Items
  - name: Reimbursement Types
  - name: Remittance Accounts
  - name: Remittance Account Enrollments
  - name: Reports
  - name: Statutory Withholding Line Items
  - name: Statutory Withholding Types
  - name: Tags
  - name: Tag Groups
  - name: Tax Properties
  - name: Tax Property Templates
  - name: Tokens
  - name: Usage Records
  - name: Usage Summaries
  - name: Vacation Pay
  - name: Vacation Pay Settings
  - name: Webhooks
  - name: Work Assignments
paths:
  /accounting_code_rules/search:
    post:
      tags:
        - Accounting Code Rules
      summary: Search accounting code rules
      description: >-
        Search a business entity's accounting code rules. The body is a filter
        set at the root, plus an optional `any_of` list of filter sets. The root
        set narrows every result; the `any_of` sets are combined with OR and
        then applied together with the root, so a rule matches when it satisfies
        the root set and at least one `any_of` entry. An empty body returns
        every rule for the business entity.


        A filter set has the same shape at the root and in each `any_of` entry:


        - A field group — `tag_groups`, `tags`, `types`, `subtypes`,
        `business_presets`, `expense_accounting_codes`,
        `liability_accounting_codes` — carries an `include` and/or `exclude`
        list of values. `include` matches rules whose field is one of the listed
        values; `exclude` matches rules whose field is none of them, keeping
        rules where the field is unset. - A `has_<field>` boolean —
        `has_tag_group`, `has_tag`, `has_type`, `has_subtype`,
        `has_business_preset`, `has_expense_accounting_code`,
        `has_liability_accounting_code` — matches rules where the field is set
        (`true`) or unset (`false`).


        Field groups and presence booleans within a set combine with AND.
      operationId: accounting-code-rules-search
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  properties:
                    business_entity_id:
                      type: string
                      description: >-
                        The business entity whose accounting code rules to
                        search.
                    any_of:
                      type: array
                      description: >-
                        A list of filter sets combined with OR; a rule matches
                        when it satisfies at least one entry. Each entry has the
                        same shape as the root filter set. An omitted or empty
                        list applies no OR condition.
                      items:
                        type: object
                        properties:
                          tag_groups:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_tag_group:
                            type: boolean
                          tags:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_tag:
                            type: boolean
                          types:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - allowance
                                    - deduction
                                    - earning
                                    - employee_benefit
                                    - employer_benefit
                                    - employer_statutory_withholding
                                    - reimbursement
                                    - statutory_withholding
                              exclude:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - allowance
                                    - deduction
                                    - earning
                                    - employee_benefit
                                    - employer_benefit
                                    - employer_statutory_withholding
                                    - reimbursement
                                    - statutory_withholding
                          has_type:
                            type: boolean
                          subtypes:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_subtype:
                            type: boolean
                          business_presets:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_business_preset:
                            type: boolean
                          expense_accounting_codes:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_expense_accounting_code:
                            type: boolean
                          liability_accounting_codes:
                            type: object
                            properties:
                              include:
                                type: array
                                items:
                                  type: string
                              exclude:
                                type: array
                                items:
                                  type: string
                          has_liability_accounting_code:
                            type: boolean
                    tag_groups:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_tag_group:
                      type: boolean
                    tags:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_tag:
                      type: boolean
                    types:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                            enum:
                              - allowance
                              - deduction
                              - earning
                              - employee_benefit
                              - employer_benefit
                              - employer_statutory_withholding
                              - reimbursement
                              - statutory_withholding
                        exclude:
                          type: array
                          items:
                            type: string
                            enum:
                              - allowance
                              - deduction
                              - earning
                              - employee_benefit
                              - employer_benefit
                              - employer_statutory_withholding
                              - reimbursement
                              - statutory_withholding
                    has_type:
                      type: boolean
                    subtypes:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_subtype:
                      type: boolean
                    business_presets:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_business_preset:
                      type: boolean
                    expense_accounting_codes:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_expense_accounting_code:
                      type: boolean
                    liability_accounting_codes:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    has_liability_accounting_code:
                      type: boolean
                - type: object
                  required:
                    - business_entity_id
            example:
              business_entity_id: <id>
              expense_accounting_codes:
                include:
                  - <id>
              any_of:
                - tag_groups:
                    include:
                      - <id>
                  has_tag: true
                - types:
                    include:
                      - earning
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    description: The type of the object in Nmbr (`"list"`).
                    readOnly: true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The unique identifier of the object in Nmbr.
                          readOnly: true
                        object:
                          type: string
                          description: >-
                            The type of the object in Nmbr
                            (`"accounting_code_rule"`).
                          readOnly: true
                        data:
                          $ref: '#/components/schemas/AccountingCodeRule'
              example:
                object: list
                data:
                  - id: <id>
                    object: accounting_code_rule
                    data:
                      business_entity:
                        id: <id>
                        object: business_entity
                        links:
                          self: /business_entities/<id>
                      tag_group:
                        id: <id>
                        object: tag_group
                        links:
                          self: /tag_groups/<id>
                      tag:
                        id: <id>
                        object: tag
                        links:
                          self: /tags/<id>
                      type: null
                      subtype: null
                      business_preset: null
                      expense_accounting_code:
                        id: <id>
                        object: accounting_code
                        links:
                          self: /accounting_codes/<id>
                      liability_accounting_code: null
                      created_at: '2026-01-01T00:00:00.000000Z'
                      updated_at: '2026-01-01T00:00:00.000000Z'
                    links:
                      self: /accounting_code_rules/<id>
                links:
                  first: http://localhost/accounting_code_rules/search?page=1
                  last: http://localhost/accounting_code_rules/search?page=1
                  prev: null
                  next: null
                meta:
                  current_page: 1
                  last_page: 1
                  per_page: 15
                  total: 1
                  has_more: false
components:
  schemas:
    AccountingCodeRule:
      type: object
      title: Accounting Code Rule
      properties:
        business_entity:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier of the object in Nmbr.
              readOnly: true
            object:
              type: string
              description: The type of the object in Nmbr (`"business_entity"`).
              readOnly: true
        tag_group:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier of the object in Nmbr.
              readOnly: true
            object:
              type: string
              description: The type of the object in Nmbr (`"tag_group"`).
              readOnly: true
        tag:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier of the object in Nmbr.
              readOnly: true
            object:
              type: string
              description: The type of the object in Nmbr (`"tag"`).
              readOnly: true
        type:
          type: string
          description: >-
            The line item type this rule applies to (e.g. `earning`,
            `deduction`). When combined with `subtype`, narrows the rule to a
            specific line item category. Mutually exclusive with
            `business_preset`.
          nullable: true
          maxLength: 255
        subtype:
          type: string
          description: >-
            The line item subtype this rule applies to (e.g. `wage`, `salary`).
            Must be accompanied by a `type`.
          nullable: true
          maxLength: 255
        business_preset:
          description: >-
            A business preset this rule applies to. Provides the highest
            specificity match. Mutually exclusive with `type` and `subtype`.
        expense_accounting_code:
          type: object
          description: The expense accounting code assigned when this rule matches.
          properties:
            id:
              type: string
              description: The unique identifier of the object in Nmbr.
              readOnly: true
            object:
              type: string
              description: The type of the object in Nmbr (`"accounting_code"`).
              readOnly: true
        liability_accounting_code:
          description: The liability accounting code assigned when this rule matches.
        created_at:
          type: string
          description: The date and time the object was created in Nmbr.
          readOnly: true
          format: dateTime
        updated_at:
          type: string
          description: The date and time the object was last updated in Nmbr.
          readOnly: true
          format: dateTime
  securitySchemes:
    CompanyToken:
      type: http
      scheme: bearer

````