Skip to main content
POST
Create an accounting code rule

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
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
enum<string>

The line item type to scope this rule to (e.g. earning, deduction). Mutually exclusive with business_preset_id.

Available options:
allowance,
deduction,
earning,
employee_benefit,
employer_benefit,
employer_statutory_withholding,
reimbursement,
statutory_withholding
subtype
string | null
deprecated

This attribute is deprecated and will be removed.

Use subtypes. Still accepted, meaning a single-member set, and rejected against a rule that already holds several subtypes rather than truncating it. Sending both fields with values that disagree is rejected.

subtypes
string[]

The line item subtypes to further scope this rule to (e.g. wage, salary). A rule matches a line item whose subtype is any member of the set. Every subtype must belong to type, which a non-empty set requires. Supplying the set replaces it outright — there is no add-one or remove-one. No two rules in the same scope (same tag, same tag group, or both global) and on the same type may share a subtype.

business_preset_id
string

A business preset to scope this rule to. Provides the highest specificity match. Mutually exclusive with type and subtypes.

A rule with none of tag_id, tag_group_id, type, or business_preset_id is the catch-all: it matches any line item as the last resort when no other rule applies. At most one catch-all may exist per business entity.

expense_accounting_code_id
string
liability_accounting_code_id
string
expense_segment_template
object | null

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.

liability_segment_template
object | null

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.

Response

201 - application/json

Created

id
string
read-only

The unique identifier of the object in Nmbr.

object
string
read-only

The type of the object in Nmbr ("accounting_code_rule").

data
Accounting Code Rule · object