---
title: "Search accounting code rules"
method: POST
path: "/accounting_code_rules/search"
tags: ["Accounting Code Rules"]
---

# Search accounting code rules

`POST /accounting_code_rules/search`

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.

## Request body

- object
  - `business_entity_id` string, required — The business entity whose accounting code rules to search.
  - `any_of` object[] — 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.
    - `tag_groups` object
      - `include` string[]
      - `exclude` string[]
    - `has_tag_group` boolean
    - `tags` object
      - `include` string[]
      - `exclude` string[]
    - `has_tag` boolean
    - `types` object
      - `include` string[]
      - `exclude` string[]
    - `has_type` boolean
    - `subtypes` object
      - `include` string[]
      - `exclude` string[]
    - `has_subtype` boolean
    - `business_presets` object
      - `include` string[]
      - `exclude` string[]
    - `has_business_preset` boolean
    - `expense_accounting_codes` object
      - `include` string[]
      - `exclude` string[]
    - `has_expense_accounting_code` boolean
    - `liability_accounting_codes` object
      - `include` string[]
      - `exclude` string[]
    - `has_liability_accounting_code` boolean
  - `tag_groups` object
    - `include` string[]
    - `exclude` string[]
  - `has_tag_group` boolean
  - `tags` object
    - `include` string[]
    - `exclude` string[]
  - `has_tag` boolean
  - `types` object
    - `include` string[]
    - `exclude` string[]
  - `has_type` boolean
  - `subtypes` object
    - `include` string[]
    - `exclude` string[]
  - `has_subtype` boolean
  - `business_presets` object
    - `include` string[]
    - `exclude` string[]
  - `has_business_preset` boolean
  - `expense_accounting_codes` object
    - `include` string[]
    - `exclude` string[]
  - `has_expense_accounting_code` boolean
  - `liability_accounting_codes` object
    - `include` string[]
    - `exclude` string[]
  - `has_liability_accounting_code` boolean

## Response `200`

OK

- object
  - `object` string — The type of the object in Nmbr (`"list"`).
  - `data` object[]
    - `id` string — The unique identifier of the object in Nmbr.
    - `object` string — The type of the object in Nmbr (`"accounting_code_rule"`).
    - `data` AccountingCodeRule
      - `business_entity` object
        - `id` string — The unique identifier of the object in Nmbr.
        - `object` string — The type of the object in Nmbr (`"business_entity"`).
      - `tag_group` object
        - `id` string — The unique identifier of the object in Nmbr.
        - `object` string — The type of the object in Nmbr (`"tag_group"`).
      - `tag` object
        - `id` string — The unique identifier of the object in Nmbr.
        - `object` string — The type of the object in Nmbr (`"tag"`).
      - `type` string, nullable — 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`.
      - `subtype` string, nullable — The line item subtype this rule applies to (e.g. `wage`, `salary`). Must be accompanied by a `type`.
      - `business_preset` unknown
      - `expense_accounting_code` object — The expense accounting code assigned when this rule matches.
        - `id` string — The unique identifier of the object in Nmbr.
        - `object` string — The type of the object in Nmbr (`"accounting_code"`).
      - `liability_accounting_code` unknown
      - `expense_segment_template` SegmentTemplate, nullable — Assembles a formatted accounting code for the journal entry report: each segment resolves to a value, is wrapped and transformed, and the results are concatenated in order. Only valid on rules with no tag and no tag group; `null` when unset.
        - `segments` union[], required — Ordered segments concatenated into the generated code.
          - union
            - object — Emits the referenced accounting code's `code`.
              - …
            - object — Emits the row's tag in this group — its expense template code in an expense template, its liability template code in a liability template.
              - …
            - object — Emits a fixed piece of text. A text segment takes no formatting.
              - …
      - `liability_segment_template` SegmentTemplate, nullable — Assembles a formatted accounting code for the journal entry report: each segment resolves to a value, is wrapped and transformed, and the results are concatenated in order. Only valid on rules with no tag and no tag group; `null` when unset.
        - `segments` union[], required — Ordered segments concatenated into the generated code.
          - union
            - object — Emits the referenced accounting code's `code`.
              - …
            - object — Emits the row's tag in this group — its expense template code in an expense template, its liability template code in a liability template.
              - …
            - object — Emits a fixed piece of text. A text segment takes no formatting.
              - …
      - `created_at` string, dateTime — The date and time the object was created in Nmbr.
      - `updated_at` string, dateTime — The date and time the object was last updated in Nmbr.

---

[API](https://skmtc.net/nmbr/apis/nmbr-api.md) · [All operations](https://skmtc.net/nmbr/apis/nmbr-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nmbr/nmbr-api/revisions/01cd9c45a923/schema)
