Metanow Docs
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.

MethodPathAgent tool
GET/payment-termslist_payment_terms
POST/payment-terms/computecompute_payment_schedule
GET/uomslist_uoms
POST/uoms/convertconvert_uom
GET/pricelists/currencieslist_pricelist_currencies
GET/pricelistslist_pricelists
POST/pricelistscreate_pricelist
PATCH/pricelists/:idupdate_pricelist
DELETE/pricelists/:iddelete_pricelist
POST/pricelists/resolveresolve_price
POST/pricelists/explainexplain_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 /pricelists requires currency: 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" takes fixed_price_cents (minor units) and no percent; discount_percent and formula take percent and no fixed_price_cents. A product / category / variant rule needs that product_id / category_id / variant_id, and it must be one of the organisation's records. percent is 0–100 for discount_percent and -100 or more for formula; 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/currencies lists the codes a pricelist can be in, with their decimals (commercial:read).
  • PATCH /pricelists/:id changes only the fields it is sent. rules, when sent, replaces every live rule ([] removes them) and must come with currency, the currency its amounts are in; another currency than the pricelist's is the currency change. A currency change while live rules exist must send rules too.
  • resolve / explain take product_id, date, optional qty, and pricelist_id or contact_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 returned currency (the product's).

Refusals, as {error: {code, message, details}}:

StatusCodeWhen
400PRICELIST_CURRENCY_MISMATCHThe pricelist (details.scope: "product") or one of its rules ("rule") is in another currency than the product. Never converted.
400PRICELIST_CURRENCY_CHANGE_NEEDS_RULESA currency change while rules exist, without rules in the same call.
400UNKNOWN_CURRENCY / CURRENCY_REQUIREDA currency the registry does not know / not three upper-case letters.
400CURRENCY_REGISTRY_UNAVAILABLENo currency registry (finance not installed): no decimals are assumed.
400PRODUCT_PRICE_EXCEEDS_CURRENCY_PRECISIONThe product's price has a digit its currency cannot hold (e.g. 10.50 JPY).
400PRODUCT_CURRENCY_UNKNOWNThe product's own currency is malformed or not in the registry. Fix the product.
400PRODUCT_COST_REQUIRED_FOR_MARGINThe matching rule guards a margin and the product has no cost price (never read as 0).
400PRICELIST_RULES_NEED_CURRENCYPATCH sent rules without currency.
404PRICELIST_NOT_FOUNDpricelist_id (or the contact's default pricelist, details.contact_id) is not a pricelist of this organisation; also update / delete of a missing pricelist.
404PRICELIST_RULE_TARGET_NOT_FOUNDA rule's product_id / category_id / variant_id (details.field, details.rule_index) is not one of this organisation's records.
404CONTACT_NOT_FOUNDcontact_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).

On this page