Skip to main content

Apply Guided Setup

POST 

/api/product-account-rules/setup/apply

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.

Required scope: accounting:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token with the accounting:write scope and the manage-accounting-settings permission.

Request body fields:

  • dimension (string, required) — how revenue is split: category, brand, supplier or type.
  • groups (array, required, may be empty, max 500) — one entry per group from Get Guided Setup Dimensions.
    • groups.*.id (integer or string, required) — the group id (category / brand / supplier id, or a product type value such as manufactured).
    • groups.*.accounts (object, optional) — nominal code id per account type: sales, cogs, inventory, inventory_in_transit, accrued_purchases, discount (each integer or null). Groups with no account are skipped; groups with identical accounts are merged into one rule.
  • suggestions (array of strings, optional) — keys of suggestions from the preview to accept (e.g. brand:8:3, manufactured).
  • use_rule_product_ids (array of integers, optional) — products whose own account override disagrees with the new rules and should be cleared so they follow the rules (see exceptions in the preview).
  • channel_accounts_take_priority (boolean, optional) — set on every generated rule.
  • confirm_type_mismatch (boolean, optional) — accept accounts whose type does not fit their slot.
  • map_account_type (string|null, optional, default sales) — the account type the preview's before/after account_map shows: sales, cogs, inventory, inventory_in_transit, accrued_purchases or discount. Ignored by apply.

Send the same body you previewed. Response (data): rules ({id, name, position, conditions_summary} for each created rule) and tracked_job_id (the re-apply run).

Request​

Responses​

OK

Response Headers
    Content-Type