# /onlinetrade/products

`POST /api/onlinetrade/products`

Price: 1 credit

Return one ONLINE TRADE.RU (onlinetrade.ru) product for a named Russian city by its numeric product id or product URL: name, brand, manufacturer code, current and pre-discount price in roubles with the discount percentage, the ON-bonus amount, stock state and stock note, warranty term, the full specification sheet, the headline specifications, the marketing description, product images, the category breadcrumb trail with category ids, the colour and memory variants of the same model, and the delivery options with their dates and costs for that city.

## How to use it

The numeric id resolves on its own — the slug in a product URL is decorative, so a bare «Код товара» is enough and the URL form is only a convenience. Pass the id search returns as `item_id`; the other number onlinetrade prints, the one in its basket and compare links, belongs to a different id space and is answered with 412 rather than with a neighbouring product. `city` changes price, stock and delivery dates, and the record echoes the city it was priced in. `specs` is the full sheet and `highlights` the short list the site shows beside the price; read `specs` for anything the flat fields do not carry. `modifications` are the sibling colour and capacity variants, each with its own `item_id` to fetch.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `item_id` (string, required) — Product id — the number onlinetrade prints as «Код товара», the number at the end of a product URL, or the product URL itself (examples: "5461220", "https://www.onlinetrade.ru/catalogue/smartfony-c13/huawei/smartfon_huawei_pura_90s_pro_12_256gb_belyy_51098yxm-5461220.html"; minLength: 1)
- `city` (string) — City the price, availability and delivery dates belong to, as a city name or as the numeric city id onlinetrade uses in its own ?c= parameter. The record echoes the city it was priced in (default: "Москва"; examples: "Москва", "Новосибирск", "60"; minLength: 1)

## Response

### 200 — Successful Response

- `@type` (string) (default: "OnlinetradeProduct")
- `item_id` (string, required)
- `model_id` (string, nullable)
- `name` (string, nullable)
- `url` (string, nullable)
- `brand` (string, nullable)
- `mpn` (string, nullable)
- `price` (integer, nullable)
- `old_price` (integer, nullable)
- `currency` (string, nullable)
- `discount_percent` (integer, nullable)
- `badges` (array) (default: [])
- `price_valid_until` (string, nullable)
- `bonus` (integer, nullable)
- `availability` (string, nullable)
- `availability_note` (string, nullable)
- `condition` (string, nullable)
- `warranty` (string, nullable)
- `rating` (number, nullable)
- `rating_count` (integer, nullable)
- `image` (string, nullable)
- `images` (array) (default: [])
- `highlights` (array) (default: [])
  - `@type` (string) (default: "OnlinetradeSpec")
  - `label` (string, required)
  - `value` (string, required)
- `specs` (array) (default: [])
  - `@type` (string) (default: "OnlinetradeSpec")
  - `label` (string, required)
  - `value` (string, required)
- `description` (string, nullable)
- `category_id` (integer, nullable)
- `breadcrumbs` (array) (default: [])
  - `@type` (string) (default: "OnlinetradeCategoryRef")
  - `name` (string, required)
  - `id` (integer, nullable)
  - `url` (string, nullable)
- `modifications` (array) (default: [])
  - `@type` (string) (default: "OnlinetradeModification")
  - `item_id` (string, required)
  - `label` (string, required)
  - `selected` (boolean) (default: false)
- `delivery_options` (array) (default: [])
  - `@type` (string) (default: "OnlinetradeDeliveryOption")
  - `name` (string, required)
  - `date` (string, nullable)
  - `cost` (integer, nullable)
- `pickup_points` (array) (default: [])
  - `@type` (string) (default: "OnlinetradePickupPoint")
  - `name` (string, required)
  - `address` (string, nullable)
  - `url` (string, nullable)
  - `date` (string, nullable)
  - `cost` (integer, nullable)
- `top_review` (string, nullable)
- `listed_at` (string, nullable)
- `city` (string, nullable)
- `city_id` (string, nullable)

## Errors

### 422 — Validation Error

The city is not one onlinetrade prices in, or item_id is neither a numeric id nor a product URL

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 onlinetrade product resolves from this id

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

onlinetrade's anti-bot wall never served the product page within the retry and session-mint budget; the id is unrelated, retry the call

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.

