Docs

Docs / Data Feed / Pricing rules

For Data Feed stores
Endpoint · Create a pricing rule

POST/pricing-rules

Add a pricing rule. It goes directly above the first rule broader than it, and your prices are worked out again.

Needs Pricing rules: Read and writeBase URL https://backend.fflmonkey.com/api/v1Counts 1 toward 120 a minute

Fields

Needs Pricing rules: Read and write. Send the rule's fields as GET /pricing-rules shows them, without id and sort_order. A field left out is null, false or an empty list.

FieldTypeRule
namerequiredstringUp to 120 characters.
markup_percentageoptionalstring, number or nullPercent added to the base, -100 to 999.99, at most two decimals, or null for none. Best sent as a string, such as "22.50".
markup_value_fixedoptionalstring, number or nullDollars added after the percentage, -100000 to 100000, at most two decimals, or null for none.
apply_markup_price_torequiredstringThe base the markup is added to: cost, msrp, map_then_cost or map_then_msrp.
apply_only_when_has_mapoptionalbooleantrue skips a product whose offer has no MAP above its cost.
apply_only_when_has_msrpoptionalbooleantrue skips a product whose offer has no MSRP.
enforce_map_flooroptionalboolean or nulltrue never prices below MAP, false may, null follows your store's setting.
categoriesoptionallist of stringsCategory slugs from GET /categories; each takes in the categories below it. Empty or left out: any.
manufacturersoptionallist of stringsBrand slugs from GET /manufacturers. Empty or left out: any.
product_classesoptionallist of stringsProduct class slugs from GET /product-classes. Empty or left out: any.
distributorsoptionallist of stringsDistributor slugs, as a product's sourced_from names them. Empty or left out: any.
upcsoptionallist of stringsUPCs, each up to 32 characters. Empty or left out: any.
from_priceoptionalstring, number or nullThe lowest distributor cost the rule applies to, 0 to 9999999.99, at most two decimals, or null for no lower bound.
to_priceoptionalstring, number or nullThe highest distributor cost it applies to, on the same terms, or null for no upper bound.
disabledoptionalbooleantrue keeps the rule and never applies it.
auto_placeoptionalbooleanDefault true: directly above the first rule that is broader than this one. false: last.
acknowledge_zero_matchoptionalboolean Send true to save a rule that matches no product in the catalog, after a 422 zero_match_confirmation_required.

Each list takes at most 1,000 entries. Money with a third decimal is refused, never rounded. A rule's place is not a field: sort_order is refused. Move a rule with POST /pricing-rules/reorder.

  • Where it goes. With auto_place (the default) it goes directly above the first rule that is broader than it, as your Pricing screen places a new rule, so a narrow rule is checked before a general one. false puts it last. To choose another place, reorder afterwards.
  • Slugs are checked, not guessed. A slug that names nothing, or a brand merged into another, is 422 validation_failed, named by its place, such as manufacturers.1. It is never dropped: a dropped slug would widen the rule. Slugs are checked once every other field passes, so fix the fields errors names first; then every slug that names nothing is named at once.
  • What follows: exactly what follows a rule saved on the Pricing screen. Your prices are worked out again and arrive as merchant_price.recomputed changes, and the rule is announced as pricing_rule.created.

A rule that would match nothing

A rule whose conditions name no product in the catalog is not saved: the answer is 422 zero_match_confirmation_required, with the sentence your Pricing screen shows and acknowledge_field naming the field to send. If you meant it (the stock is still to arrive, say), send the same body again with "acknowledge_zero_match": true. It is not asked for a rule with no condition, or one with a cost range, whose products cannot be counted. Preview a rule to see what it names before you save it.

A retried create makes a second rule

A create is not idempotent. If a request timed out, list the rules before you send it again, and delete a copy you find with DELETE /pricing-rules/{id}. Two identical rules price the same, since the first one wins.

Returns

This endpoint can also answer 401 invalid_api_key, 403 license_not_active, 403 product_not_included, 403 insufficient_scope and 429 rate_limited.

Example

FFL Monkey Data Feed API, version 1. Questions: Support in your FFL Monkey account, or [email protected].