Skip to main content

Historical pricing

Every change keeps the version it replaces, for prices, articles, pricelists and rounding profiles, within the limits described in How long history is kept. Query any past moment with as_of and you get the price that was in force then, on any pricelist, calculated with the pricelist settings, article data, rounding, exchange rates and VAT rates that applied at that moment.

Use it to verify an invoice, settle a dispute, audit a change, or reproduce the price behind an old order or quote.


Querying the past​

Add as_of to a price query:

json
POST /price/query
{
"skus": ["SKU-CHAIR-001"],
"pricelist_filter": { "pricelists": ["customer-acme"] },
"currency_code": "SEK",
"tax_area": "SE",
"as_of": "2026-01-15T00:00:00Z"
}

Inherited prices, bundles, scheduled changes, exchange rates and VAT rates are all resolved as they were at that moment. So are the pricelists (whether each was active, and its currency and VAT mode), the articles (whether each was a bundle, and its components) and the rounding profiles, including which profile was the default.


Articles, pricelists and rounding profiles​

Each write of an article, pricelist or rounding profile creates a new version. To read one as it was at a given moment, use asOf:

DataEndpoints
Articles: name, metadata, bundle componentsGET /article/{sku} and GET /article
Pricelists: currency, VAT mode, parent, rules, metadata, start and end datesGET /pricelist/{code} and GET /pricelist
Rounding profiles, and which profile is a defaultGET /rounding/{code} and GET /rounding

Each response includes valid_from, the moment that version took effect. Search (/article/search, /pricelist/search) and the metadata summaries (/article/metadata, /pricelist/metadata) return current data only.

A write takes effect now, or at a later valid_from; see Scheduled updates. A valid_from in the past also means now, as it does for a price's start_date, so history is never rewritten. A write that is identical to the version in force stores nothing.

The first version of an article, pricelist or rounding profile also applies to every earlier moment: an article created today is shown, with its metadata, to a query about last year. An article, pricelist or rounding profile written before this history was kept counts as a first version.


When rules or metadata change​

A price is calculated with the inputs in force when it takes effect: the pricelist's rules, the article's metadata, the parent pricelist's metadata and, for an inherited price, the parent's price. When one of these inputs changes, the prices it affects are recalculated from that moment, either now or at a scheduled date. This covers the pricelist's own prices, the prices it inherits, and the pricelists that inherit from it. Prices before the change remain as they were.


The changes to one price​

To see how a price has changed, list its versions:

GET/changes/{pricelist}/{sku}?days=30

The response lists the versions written in the last days (default 30), newest first, up to limit (default 1000), including versions scheduled for later. Each version shows the price as it was after that change: its fields, sales price and quantity breaks, when it took effect, and who wrote it. If the price has no changes in the period, the response is 404. The console shows the same list under History on a price's page.


The lowest price over a period​

The EU price-reduction rule (Omnibus) concerns announced price reductions to consumers and refers to the lowest price of the 30 days before the reduction; member states apply it with their own exceptions. For an overview with a worked example, see The lowest price of the last 30 days. To get it:

json
POST /price/historical-best
{
"sku": "SKU-CHAIR-001",
"pricelist_filter": { "metadata": { "audience": ["public"] } },
"currency_code": "EUR",
"tax_area": "SE"
}
json
{
"sku": "SKU-CHAIR-001",
"currency_code": "EUR",
"from": "2026-10-02T09:00:00Z",
"to": "2026-11-01T09:00:00Z",
"sales_price_ex_vat": 179.0,
"pricelist": "campaign-eur",
"pricelists": [
{ "pricelist": "campaign-eur", "currency_code": "EUR", "sales": 179.0, "sales_price_ex_vat": 179.0, "start_at": "2026-10-10T00:00:00Z", "end_at": "2026-10-17T00:00:00Z", "inherited": false },
{ "pricelist": "retail-eur", "currency_code": "EUR", "sales": 199.0, "sales_price_ex_vat": 199.0, "start_at": "2026-09-01T00:00:00Z", "end_at": null, "inherited": false }
]
}

sales_price_ex_vat and pricelist give the lowest price in force at any moment in the period, excluding VAT and in currency_code, and the pricelist it was on. pricelists lists the lowest price on each pricelist, lowest first, with the period when that price was in force (start_at, end_at; end_at is null while the price is still in force), so you can show where the figure comes from. For a SKU without a price in the period, the values are null.

  • The period runs from from to to, or covers the days (default 30, at most 3650) before as_of (default now). Send either to or as_of, not both, and either from or days, not both.
  • A price counts if it was in force during the period. The price in force when the period begins counts even if it was set earlier, because it is the price a price query returned on the first day. A price is in force from its start until it is deleted or the next price on the pricelist starts.
  • The pricelists are those that pricelist_filter selects, as in a price query. You decide which pricelists count; they are not limited to public ones.
  • Prices are compared by their base price (without quantity breaks), excluding VAT and converted to currency_code, exactly as a price query showed them: rounded with rounding_profile (as in a price query; otherwise the currency's default, otherwise the global default), with VAT calculated to the currency's precision, and with a bundle's VAT removed per component at each component's rate. Each price is calculated with the exchange rates, VAT rates and rounding profiles of the first moment in the period when it was in force, and evaluated against the pricelist as it was at that moment. Inherited prices and bundle prices count like any other price.

The answer is based on the stored price history: a price that retention has removed does not count. If retention is on, turn on retention.keep.reference.prices to keep every price needed for the 30 days before a price reduction.


How long history is kept​

Prices​

By default, every version is kept, and every kept version counts toward your plan's price limit.

If your plan includes history retention, you can limit how much history is kept per SKU and pricelist with these settings:

SettingEffect
retention.enabledTurns retention on. Default false.
retention.max.versionsThe maximum number of versions to keep. 0 means no limit.
retention.history.msKeep versions from the last N milliseconds, and the version in force when that period begins. Default 30 days.
retention.keep.reference.pricesNever remove a version that was in force during the 30 days before the start of a price that is in force now or scheduled, per SKU across all pricelists, regardless of the two limits above. Default false.

Your plan sets the maximum values you can choose. Retention never removes the version in force or anything scheduled after it, and always keeps the most recent few versions. Removed versions can no longer be queried with as_of, and their removal is not recorded in the change log.

You change these like any other setting; see Settings.

Articles, pricelists and rounding profiles​

Your plan sets how much history these keep. By default, each keeps at most 10 versions, and a version that stopped being in force more than a year ago is removed.

The version in force, anything scheduled after it, and the version that was in force when that year began are always kept, so a query within the past year is exact. A query from before the oldest kept version sees that version.


Use cases​

  • Verifying customer invoices and resolving disputes
  • Regulatory compliance and pricing audits
  • Reconstructing prices for long-running orders or quotes
  • Finding when a price changed, by stepping through dates
  • Checking a scheduled change to prices, assortment or rules before it goes live

Summary​

Every change to prices, articles, pricelists and rounding profiles is kept as history, within your plan's retention. A query with as_of returns the prices in force at that moment, calculated as they were then.