Skip to main content

Finding articles and pricelists

Besides price queries, the API lets you search your articles and pricelists, see which pricelists have a price for a SKU, and list the SKUs on a pricelist. The console uses the same endpoints. Each request counts as one unit against your query rate limit.


Searching articles​

json
POST /article/search
{
"query": "office chair",
"filters": { "brand": "ergo" },
"limit": 20
}
FieldDescription
queryWords to match against the SKU, the name and the metadata values. Every word must match, and the last word can be the beginning of a word: chai finds chair. Omit it to list every article that the filters allow.
fieldsLimits matching to these fields: sku, name, meta, or a single metadata key as meta.<key>.
filtersExact values that every result must have, for sku or for a metadata key such as brand.
limit, offsetlimit is the maximum number of results per request: 50 by default, at most 500. offset skips that many results.

A query that contains :, * or ? is interpreted as query syntax instead, for example meta.brand:ergo or name:chai*.

json
{
"items": [
{ "sku": "SKU-CHAIR-001", "name": "Office chair", "type": "article", "metadata": { "brand": ["ergo"] }, "...": "..." }
],
"total_hits": 1,
"took_ms": 3
}

With a query, the best matches come first; without one, articles are returned in the order they were created. Deleted articles are never returned. GET /article/search/metadata lists the fields you can search and filter on.

Searching pricelists​

json
POST /pricelist/search
{
"query": "wholesale",
"filters": { "currency": "SEK" }
}

query finds pricelists whose code, name, description or metadata values contain the text. filters accepts code, currency, vat_mode, parent or a metadata key. fields, limit and offset work as they do for articles. Pricelists are returned in the order they were created, and deleted pricelists are never returned.

Metadata keys and values​

EndpointReturns
GET /article/metadataEvery metadata key used on articles, with the number of distinct values for each
GET /article/metadata/{key}The values of one key, each with the number of articles that carry it
GET /pricelist/metadataEvery metadata key used on pricelists, with the number of distinct values for each
GET /pricelist/metadata/{key}The values of one key, each with the number of pricelists that carry it

The key listings return a map, for example {"brand": 12, "category": 40}. The value listings return {"items": [{"value": "acme", "count": 310}], "total": 12, "start": 0, "size": 50}. In the value listings, the page parameter is the position of the first value to return, counted from 0, not a page number.

Use them to build filters, such as a list of brands to choose from. See Metadata.


Pricelists for a SKU​

GET/price/pricelists-for-sku/SKU-CHAIR-001?tax_area=SE

This returns every pricelist that is active now and has a price for the SKU, each with the SKU's price on that pricelist excluding and including VAT:

json
{
"items": [
{ "code": "base-sek", "currency_code": "SEK", "vat_mode": "NET", "sales_price_ex_vat": 2390.0, "sales_price_inc_vat": 2987.5, "...": "..." },
{ "code": "outlet-eur", "currency_code": "EUR", "vat_mode": "NET", "sales_price_ex_vat": 199.0, "sales_price_inc_vat": 248.75, "...": "..." }
],
"page": 1,
"size": 10,
"total": 2
}

tax_area defaults to the default.tax.area setting, and currency_code defaults to each pricelist's own currency. A price that cannot be calculated because a VAT rate or an exchange rate is missing is null. Set asOf to query another time. Use page and size to page through the results.

SKUs on a pricelist​

GET/price/skus-for-pricelist/base-sek?limit=500

This returns the SKUs that have a price on the pricelist, in SKU order, with at most 500 per page:

json
{ "items": ["SKU-CHAIR-001", "SKU-DESK-002", "SKU-LAMP-010"], "next_cursor": "SKU-LAMP-010", "has_more": true }

While has_more is true, request the next page with afterSku set to next_cursor. On the last page, has_more is false and next_cursor is null. An unknown pricelist, or one that is not active at asOf, returns an empty page.

Checking a pricelist filter​

json
POST /pricelist/query
{ "metadata": { "segment": ["wholesale"] }, "currency_code": "SEK" }

This endpoint takes a pricelist_filter and lists the pricelists it selects, which are the pricelists that a price query with the same filter uses. Use it to check a filter before you query prices with it.

Counting prices​

GET/price/count

This returns the number of prices in force, as a plain number. Each SKU counts once on each pricelist, however many versions its price has. Set asOf to count at another time.