Api
Commercial API
REST for payment terms, UoM and pricelists.
Commercial API
Base path: /commercial. All routes require a session and commercial:read (mutations use create/update/delete). Cross-org access returns 404.
| Method | Path | Agent tool |
|---|---|---|
| GET | /payment-terms | list_payment_terms |
| POST | /payment-terms/compute | compute_payment_schedule |
| GET | /uoms | list_uoms |
| POST | /uoms/convert | convert_uom |
| GET | /pricelists/currencies | list_pricelist_currencies |
| GET | /pricelists | list_pricelists |
| POST | /pricelists | create_pricelist |
| PATCH | /pricelists/:id | update_pricelist |
| DELETE | /pricelists/:id | delete_pricelist |
| POST | /pricelists/resolve | resolve_price |
| POST | /pricelists/explain | explain_price |
Deletes are high_stakes Concierge tools and require confirmation. Money arguments are integer minor units.
Fiscal positions are not here: they are finance's (/finance/fiscal-positions, see the Finance guide).
Pricelists and currency
POST /pricelistsrequirescurrency: an ISO 4217 code (three upper-case letters) the currency registry knows. There is no default. A rule is{applies_to, compute, fixed_price_cents | percent, min_margin_cents?, max_margin_cents?, …}:compute: "fixed"takesfixed_price_cents(minor units) and nopercent;discount_percentandformulatakepercentand nofixed_price_cents. Aproduct/category/variantrule needs thatproduct_id/category_id/variant_id, and it must be one of the organisation's records.percentis 0–100 fordiscount_percentand -100 or more forformula; a percent price is rounded half-up. A margin guard needs the product's cost price. Responses return the currency on the pricelist and on every rule.GET /pricelists/currencieslists the codes a pricelist can be in, with their decimals (commercial:read).PATCH /pricelists/:idchanges only the fields it is sent.rules, when sent, replaces every live rule ([]removes them) and must come withcurrency, the currency its amounts are in; another currency than the pricelist's is the currency change. Acurrencychange while live rules exist must sendrulestoo.resolve/explaintakeproduct_id,date, optionalqty, andpricelist_idorcontact_id(the contact's default pricelist; an unknown contact, or a default pricelist that is gone, is 404 — never a silent list price). Prices are in minor units of the returnedcurrency(the product's).
Refusals, as {error: {code, message, details}}:
| Status | Code | When |
|---|---|---|
| 400 | PRICELIST_CURRENCY_MISMATCH | The pricelist (details.scope: "product") or one of its rules ("rule") is in another currency than the product. Never converted. |
| 400 | PRICELIST_CURRENCY_CHANGE_NEEDS_RULES | A currency change while rules exist, without rules in the same call. |
| 400 | UNKNOWN_CURRENCY / CURRENCY_REQUIRED | A currency the registry does not know / not three upper-case letters. |
| 400 | CURRENCY_REGISTRY_UNAVAILABLE | No currency registry (finance not installed): no decimals are assumed. |
| 400 | PRODUCT_PRICE_EXCEEDS_CURRENCY_PRECISION | The product's price has a digit its currency cannot hold (e.g. 10.50 JPY). |
| 400 | PRODUCT_CURRENCY_UNKNOWN | The product's own currency is malformed or not in the registry. Fix the product. |
| 400 | PRODUCT_COST_REQUIRED_FOR_MARGIN | The matching rule guards a margin and the product has no cost price (never read as 0). |
| 400 | PRICELIST_RULES_NEED_CURRENCY | PATCH sent rules without currency. |
| 404 | PRICELIST_NOT_FOUND | pricelist_id (or the contact's default pricelist, details.contact_id) is not a pricelist of this organisation; also update / delete of a missing pricelist. |
| 404 | PRICELIST_RULE_TARGET_NOT_FOUND | A rule's product_id / category_id / variant_id (details.field, details.rule_index) is not one of this organisation's records. |
| 404 | CONTACT_NOT_FOUND | contact_id is not a contact of this organisation. |
POST /sales/config (create_sales_config) refuses kind: "pricelist", and PATCH / DELETE /sales/config/:id refuse a pricelist row, with PRICELIST_USE_EDITOR: a pricelist is deleted with delete_pricelist (confirmation first).