POST
Add an allocation rule (client account)
Client space Accounting module For: Accountant · Permission: analytic_rules.create Conditions
  • The accounting module must be included in the plan of the organization.
  • At least one of match_account_prefix, match_source_type or match_journal_id must be sent and non-empty; a rule with no matcher would allocate every line.
  • analytic_axis_id must be an axis of the book, and the axis must be active.
  • analytic_section_id must be an active section of the same axis and of the same book that is postable and has no child sections; otherwise the call is refused.
  • match_journal_id, when sent, must be a journal of the same book.
  • priority is required, an integer of 0 or more.
What else happens
  • The rule is created with status active: lines of entries posted later that match it are allocated to the section, unless a target sent with the entry or an earlier rule of the same axis already allocates them.
  • The creating actor is recorded in created_by and created_by_type.
  • Existing journal lines are not re-allocated.
Part of Set up analytic axes, sections and rules.

Authorizations

Authorization
string
header
required

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

Query Parameters

response
enum<string>
default:none

Response mode. Default none; none answers 204 No Content.

Available options:
none,
resource
fields
string

Comma-separated JSON keys of the root resource (id is always rendered). Available: id, analytic_axis_id, analytic_section_id, priority, match_account_prefix, match_source_type, match_journal_id, status, created_by, created_by_type, created_at, updated_at.

include
string

Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: axis, section, section.axis, section.parent, journal.

Body

application/json
analytic_axis_id
string
required

Required. Axis of the book on which the rule allocates; it must be active.

analytic_section_id
string
required

Required. Active, postable section of that axis with no child sections.

priority
integer
required

Required. Integer of 0 or more; order of evaluation among the rules of the axis.

Required range: x >= 0
match_account_prefix
string | null

Account code prefix to match, at most 16 characters. At least one of the three matchers is required.

Maximum string length: 16
match_source_type
string | null

Source type of the entry to match, at most 64 characters. At least one of the three matchers is required.

Maximum string length: 64
match_journal_id
string | null

Journal of the same book to match. At least one of the three matchers is required.

Response

Resource (only with response=resource).

id

Identifier of the rule (27-character KSUID).

analytic_axis_id

Identifier of the axis the rule allocates on.

axis
object | null

The axis, included only when the caller may retrieve analytic axes.

analytic_section_id

Identifier of the section that matching lines are allocated to.

section
object | null

The target section, included only when the caller may retrieve analytic sections.

priority
integer

Order of evaluation among the rules of the axis; an integer of 0 or more.

match_account_prefix

Matches journal lines whose account code starts with this prefix; null when this matcher is not used.

match_source_type

Matches entries created by this source type; null when this matcher is not used.

match_journal_id

Matches entries of this journal; null when this matcher is not used.

journal
object | null

The matched journal, included only when the caller may retrieve journals.

status

active or archived. Only active rules allocate.

created_by

Identifier of the actor that created the rule.

created_by_type

Kind of actor that created the rule (the actor's morph alias); null when it could not be resolved.

created_at

Date and time the record was created (ISO 8601, UTC).

updated_at

Date and time the record was last changed (ISO 8601, UTC).