Preview Account Rule
POST/api/product-account-rules/preview
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).
accounting:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token with the accounting:write scope (a read that carries a body).
Request body fields: the same fields as Create Account Rule, all optional, plus:
rule_id(integer, optional;idis accepted as an alias) — the saved rule being edited. Its saved version is replaced by the draft in the simulation, and the response addsleaves_this_rulecounts. Without it the draft is simulated as a new rule at its insert position (orposition).
Response (data):
matches— active products meeting the draft's conditions.will_change— distinct active products whose product-level account would change for any account type.by_type— per account type the draft sets:moves_from_default/moves_from_rule(products that would move to the draft's account from the company default / from another rule),already_this_account,blocked_by_override(products keeping their own override),blocked_by_higher_rule(products a rule earlier in the order keeps),leaves_this_rule(edits only: products the saved rule sets today that the draft no longer matches),from_default_account(the company default being left),higher_rules({id, name, products}for the rules that keep products), and for Sales, COGS and Discount achannel_note(productssold on channels that set their own account, and those channels' names).sample— up to 50 changed product/account-type rows:product_id,sku,name,category,type,from({code, name, source}),to({code, name}).applying_in_progress—truewhile a re-apply run is still working through the catalog (counts reflect the rules, not the unfinished run).
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.