---
title: "Create an accounting code rule"
method: POST
path: "/accounting_code_rules"
tags: ["Accounting Code Rules"]
---

# Create an accounting code rule

`POST /accounting_code_rules`

## Request body

- object
  - `business_entity_id` string, required
  - `tag_group_id` string — A tag group to scope this rule to. When set without `tag_id`, creates a tag-group-level rule that applies to all tags in the group.
  - `tag_id` string — A tag from the business entity's accounting code tag group. Optional — when omitted, the rule matches line items by `type`/`subtype` or `business_preset_id` alone.
  - `type` 'allowance' | 'deduction' | 'earning' | 'employee_benefit' | 'employer_benefit' | 'employer_statutory_withholding' | 'reimbursement' | 'statutory_withholding' — The line item type to scope this rule to (e.g. `earning`, `deduction`). Mutually exclusive with `business_preset_id`.
  - `subtype` string, nullable — The line item subtype to further scope this rule (e.g. `wage`, `salary`). Requires `type` to be set.
  - `business_preset_id` string — A business preset to scope this rule to. Provides the highest specificity match. Mutually exclusive with `type` and `subtype`. When both `tag_id` and `tag_group_id` are omitted, either `type` or `business_preset_id` must be set.
  - `expense_accounting_code_id` string
  - `liability_accounting_code_id` string

## Response `201`

Created

- 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
    - `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.dev/nmbr/apis/nmbr-api.md) · [All operations](https://skmtc.dev/nmbr/apis/nmbr-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nmbr/nmbr-api/revisions/22e92d8c3376/schema)
