---
title: "Retrieve an accounting code rule"
method: GET
path: "/accounting_code_rules/{accounting_code_rule}"
tags: ["Accounting Code Rules"]
---

# Retrieve an accounting code rule

`GET /accounting_code_rules/{accounting_code_rule}`

## Path parameters

- `accounting_code_rule` string, required

## Query parameters

- `expand` string[]

## Response `200`

OK

- 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`.
            - `type` 'accounting_code', required
            - `id` string, required — Id of an accounting code in this business entity.
            - `prefix` string, nullable — Literal text prepended to the resolved value.
            - `suffix` string, nullable — Literal text appended to the resolved value.
            - `transform` string[], nullable — Transforms applied to the resolved value in the order listed.
            - `max_length` integer, nullable — Truncates the resolved value to this many characters.
            - `fallback` string, nullable — Substituted when the resolved value is empty. When absent or empty, an empty segment is dropped instead — prefix and suffix included.
          - 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.
            - `type` 'tag_group', required
            - `tag_group_id` string, required — Id of a tag group in this business entity.
            - `prefix` string, nullable — Literal text prepended to the resolved value.
            - `suffix` string, nullable — Literal text appended to the resolved value.
            - `transform` string[], nullable — Transforms applied to the resolved value in the order listed.
            - `max_length` integer, nullable — Truncates the resolved value to this many characters.
            - `fallback` string, nullable — Substituted when the resolved value is empty. When absent or empty, an empty segment is dropped instead — prefix and suffix included.
          - object — Emits a fixed piece of text. A text segment takes no formatting.
            - `type` 'text', required
            - `text` string, required — The literal text to emit.
    - `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`.
            - `type` 'accounting_code', required
            - `id` string, required — Id of an accounting code in this business entity.
            - `prefix` string, nullable — Literal text prepended to the resolved value.
            - `suffix` string, nullable — Literal text appended to the resolved value.
            - `transform` string[], nullable — Transforms applied to the resolved value in the order listed.
            - `max_length` integer, nullable — Truncates the resolved value to this many characters.
            - `fallback` string, nullable — Substituted when the resolved value is empty. When absent or empty, an empty segment is dropped instead — prefix and suffix included.
          - 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.
            - `type` 'tag_group', required
            - `tag_group_id` string, required — Id of a tag group in this business entity.
            - `prefix` string, nullable — Literal text prepended to the resolved value.
            - `suffix` string, nullable — Literal text appended to the resolved value.
            - `transform` string[], nullable — Transforms applied to the resolved value in the order listed.
            - `max_length` integer, nullable — Truncates the resolved value to this many characters.
            - `fallback` string, nullable — Substituted when the resolved value is empty. When absent or empty, an empty segment is dropped instead — prefix and suffix included.
          - object — Emits a fixed piece of text. A text segment takes no formatting.
            - `type` 'text', required
            - `text` string, required — The literal text to emit.
    - `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)
