Bulk import volume cost prices
Import the quantity-based purchase prices of many products in a single call, for example the volume breaks your supplier gives on each product. The API calls them bulk cost prices.
Endpoint
POST /v2/bulk-cost-prices/bulk
Request
{
"bulkCostPrices": [
{
"source": { "id": "PRD-00482", "name": "MY_ERP" },
"quantityFrom": 25,
"value": 14.20
},
{
"source": { "id": "PRD-00482", "name": "MY_ERP" },
"quantityFrom": 100,
"value": 12.85
},
{
"source": { "id": "PRD-00483", "name": "MY_ERP" },
"quantityFrom": 10,
"value": 31.40
}
],
"directives": [
{ "operation": "resetOnUpdate", "fields": [] }
]
}
Response
{
"created": 3,
"updated": 0,
"total": 3
}
How it works
Each entry is one tier: from quantityFrom units, value is the cost price per unit. Volume cost prices attach to the product's price, so import the price first, for example with Bulk import prices. When a product in the request has no price, the call answers 404 and saves nothing, also not the tiers of the other products. Identify products by productId or by source, which takes the product's source as name and its sourceId as id. You can also send the ID of the product's price in priceId. Each tier takes one of these three fields: unlike the prices and discounts endpoints, this endpoint has no productSource field.
Volume cost prices are a separate set from the cost prices of Bulk import cost prices. Both endpoints take the same body, including the bulkCostPrices key, so check the path: a tier sent to one endpoint does not show up in the other.
Add validFrom and validTo (ISO 8601 timestamps) for a tier that applies only in a period. A dated tier is stored next to the undated tier at the same quantity. Propeller identifies a tier by its product, quantityFrom and validFrom. Without directives the call merges: a tier you send again gets its new value, a new tier is added and tiers you leave out stay. Each tier can appear only once per request: a repeated product, quantityFrom and validFrom refuses the whole request with 400.
Replace the tiers of a product
With the resetOnUpdate directive the call replaces all volume cost prices of every product in the request with the tiers it carries, dated tiers included. A tier your supplier dropped then disappears from Propeller on the next import. An empty fields list is enough: the directive replaces the whole set of tiers, not single fields.
- Products that are not in the request keep their volume cost prices.
- Keep all tiers of a product in one request. A second request with the directive replaces the tiers the first one created.
- The response counts every tier as
created, because the tiers are written anew.
To remove all volume cost prices of a product, find the ID of its price with POST /v2/prices/search and the productIds filter, then call DELETE /v2/prices/{id}/bulk-cost-prices. Read the tiers of a price with POST /v2/bulk-cost-prices/search and the priceIds filter.