Account Rules
List Account Rules
List account rules, paginated, in evaluation order.
Create Account Rule
Create an account rule that sets product GL accounts for every product matching its conditions.
Get Account Rule
Get one account rule, archived or not.
Update Account Rule
Replace an account rule's name, conditions, accounts and flags. Send the complete rule — fields left out of `conditions` and `accounts` are cleared.
Delete Account Rule
Delete an account rule permanently. Products it set accounts for fall through to the next matching rule or the company default when the re-apply run finishes. Consider archiving instead to keep the rule's history.
Archive Account Rule
Archive an account rule. Archived rules never match (whatever their `is_active` flag), are hidden from the list by default and are skipped by the evaluation order; reorder requests ignore them.
Unarchive Account Rule
Restore an archived rule. It comes back inactive (`is_active: false`) at the bottom of the order, so it never silently starts posting or outranks rules arranged while it was archived; activate it with `POST /api/product-account-rules/{rule}/activate` to apply it again. Refused with 422 when another non-archived rule now has the same name.
Duplicate Account Rule
Copy a rule directly below the original, named 'Copy of …'. Returns 201 with the copy.
Activate Account Rule
Switch a rule on. Clears `deactivated_reason`.
Deactivate Account Rule
Switch a rule off. It keeps its position but no longer matches any product.
Reorder Account Rules
Rewrite the evaluation order in one step. Send every non-archived rule id (active and inactive), top first. Archived ids in the list are ignored.
Re-apply Account Rules
Re-apply the current rule set to the whole catalog without changing any rule — for example after bulk product changes made outside the API. No request body.
Preview Account Rule
See what a draft rule would do before saving it. Nothing is saved and no background run starts. The draft may be incomplete (no name, no accounts yet).
Re-map Unsynced Journal Entries
After changing rules, move existing journal entries onto the accounts the rules now give. Only entries that are **not** synced to your accounting integration (QuickBooks Online / Xero) and **not** in a locked period are changed; each is re-derived from its source document and rewritten in place (same entry id and status). Lines with a manual account re-map are kept, and an entry whose manual re-map would be lost is skipped.
Export Account Rules
Download the account rules as CSV, in evaluation order. The file is the same format **Import Account Rules** accepts, so it can be edited and re-imported.
Get Account Rules Import Template
Download a CSV template to start an import from: one row per top-level product category, active, including sub-categories, with the account columns left blank.
Import Account Rules
Create and update account rules from a CSV file — all or nothing. Rows are matched to existing rules by name (case-insensitive): a matching row updates that rule, any other row creates one. Rules not in the file are left alone.
Get Guided Setup Dimensions
Step 1 of the guided setup: how well each way of splitting revenue covers the active catalog, so you can pick one. Read-only.
Preview Guided Setup
Steps 2–4 of the guided setup: turn the chosen accounts per group into rule drafts and project the result. Nothing is saved.
Apply Guided Setup
Create the rules the guided setup planned, in one transaction: new rules are placed **above** every existing rule (existing rules are never edited or deleted), the overrides named in `use_rule_product_ids` are cleared, and one re-apply run starts.
Get Account Map
Where the active catalog posts for one account type, as a grid of groups × accounts. Each product counts once, at its product-level account (override, rule or company default).
List Account Anomalies
Products whose account for one type differs from at least 80% of the other active products in their primary category (categories with 5 or more active products). Anomalies are a prompt to check, never a block. Dismissed anomalies are left out until the product moves to a different account.
Dismiss Account Anomaly
Keep a product's unusual account: the anomaly is dismissed against the product's **current** account for that type. If the product later moves to a different account, the anomaly can be raised again.
Use Rule For All Flagged Products
Hand every flagged product of one account type back to the account rules. The work runs in the background as a tracked job ('Clearing overrides to use account rules: <type>'): for **every** current anomaly of that type (not just one page) whose account comes from the product's own override while an account rule would otherwise apply, the override is cleared and the product's rule assignment is recomputed in bounded chunks, so it posts to the rule's account from now on. Running it again picks up any overrides still left.
Get Product Accounts
The GL account one product posts to for each account type, and where it comes from — product override, account rule or company default.
Get Accounts for Products
The resolved GL accounts and their source for up to 200 products in one call. `data` is keyed by product id; each value has the same per-type shape as **Get Product Accounts**. Unknown ids are left out.