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
POST /article/search
{
"query": "office chair",
"filters": { "brand": "ergo" },
"limit": 20
}
| Field | Description |
|---|---|
query | Words 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. |
fields | Limits matching to these fields: sku, name, meta, or a single metadata key as meta.<key>. |
filters | Exact values that every result must have, for sku or for a metadata key such as brand. |
limit, offset | limit 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*.
{
"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
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
| Endpoint | Returns |
|---|---|
GET /article/metadata | Every 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/metadata | Every 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
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:
{
"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
This returns the SKUs that have a price on the pricelist, in SKU order, with at most 500 per page:
{ "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
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
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.