# /dnsshop/products/price-history

`POST /api/dnsshop/products/price-history`

Price: 1 credit

Return the recorded price history of one DNS (dns-shop.ru) product for a named Russian city: every price point DNS has kept with its date label and month, the lowest and highest price over the recorded period, and the period summary DNS renders under the chart. Accepts a product URL, 16-hex url id, guid or numeric product code.

## How to use it

This is the only place a previous DNS price exists — the listing and the product record carry the current price alone, with no old price, discount amount or percentage anywhere, so a price cut has to be computed by comparing a point here against the current price. `dnsshop/products/search` reports has_price_history per card, and a product where that flag is false answers 412 rather than an empty list. The points are what DNS itself charts, grouped by month, and the period they cover is DNS's choice, not a range you can ask for. `city` matters for the same reason it matters elsewhere on DNS: the price is city-scoped.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `product` (string, required) — Product as a dns-shop.ru product URL, its 16-hex url id, its guid, or the numeric 'код товара' DNS shows on the product page (examples: "https://www.dns-shop.ru/product/f89a801b62bbd21a/69-smartfon-xiaomi-redmi-15-256-gb-cernyj/", "f89a801b62bbd21a", "f89a801b-62bb-11f0-935d-0050569d21a3", "5634783"; minLength: 1)
- `city` (string) — City the price and availability belong to. A city name, its dns-shop subdomain or its city guid. DNS prices the same product differently across cities (default: "Москва"; examples: "Москва", "Владивосток", "vladivostok"; minLength: 1)

## Response

### 200 — Successful Response

- `@type` (string) (default: "DnsshopPriceHistory")
- `guid` (string, required)
- `points` (array) (default: [])
  - `@type` (string) (default: "DnsshopPricePoint")
  - `month` (string, nullable)
  - `label` (string, nullable)
  - `price` (integer, nullable)
  - `price_label` (string, nullable)
- `price_range` (string, nullable)
- `min_price` (integer, nullable)
- `max_price` (integer, nullable)
- `city` (string, nullable)
- `city_id` (string, nullable)

## Errors

### 422 — Validation Error

The city is not in the DNS city catalogue, or product is empty

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

No DNS product resolves from this identifier, DNS keeps no price history for it, or DNS did not serve the history for this session

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

