# /dnsshop/products/search

`POST /api/dnsshop/products/search`

Price: 1 credit

Search the DNS (dns-shop.ru) catalogue by keyword and/or category for a named Russian city, and return product cards with the current price in roubles, the instalment offer, availability class, rating, review and comment counts, the reliability badge, headline specifications, the product image and the canonical product URL. Narrows by availability, brand, promotion, price range, customer rating, reliability, presence of reviews and by any of the category's own specification facets, and orders by price, novelty, discount, popularity, rating or number of reviews.

## How to use it

`city` decides the answer, not the presentation: DNS prices the same product differently by city and the catalogue membership differs too, so the same query in Москва and Владивосток is genuinely two result sets. Every card echoes the city it was priced in. Pass `query`, `category` or both — a product word DNS recognises is resolved to one of its categories and searched inside it, so a broad product word answers with one category's listing and not with the whole shop, while a bare brand name (xiaomi, apple, samsung) is answered with the brand's landing page, which carries no listing at all: pass such a brand through `brands` together with a `category`, and pin `category` whenever you know it. `stock` values are disjoint, not cumulative: out_of_stock is a separate archive of products DNS no longer sells and is never included in the default answer, so ask for it explicitly when you want discontinued models. `brands`, `promos`, `spec_filters` and `spec_ranges` take DNS's own slugs and facet codes, which differ per category — read them from a category page's URL rather than guessing, because a value DNS does not know narrows the listing to nothing and comes back as 412, not as an unfiltered list. Set `with_availability` when you need pickup and courier dates; without it the card still carries the availability class. There is no previous price or discount amount anywhere in the listing — use dnsshop/products/price-history for that, and only where a card reports has_price_history.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `query` (string, nullable) — Search text. A product word DNS recognises is resolved to one of its categories and searched inside it; a bare brand name is answered with the brand's landing page instead of a listing, so pass the brand through `brands` together with a `category` (examples: "iphone", "холодильник", "rtx 5070"; minLength: 1)
- `category` (string, nullable) — Category as its 16-hex id or as any dns-shop.ru catalogue URL (examples: "17a8a01d16404e77", "https://www.dns-shop.ru/catalog/17a8a01d16404e77/smartfony/"; minLength: 1)
- `city` (string) — City the prices, stock and delivery dates belong to. A city name, its dns-shop subdomain or its city guid. DNS prices the same product differently across cities and the catalogue itself is city-scoped, so this is part of the result, not a display preference (default: "Москва"; examples: "Москва", "Владивосток", "vladivostok", "Санкт-Петербург"; minLength: 1)
- `sort` (string) — Result ordering (default: "popular"; one of: "popular", "price-asc", "price-desc", "new", "discount", "opinion", "rating")
- `stock` (string, nullable) — Restrict to one availability class in the selected city. Left unset DNS returns everything it currently sells; out_of_stock is a separate, disjoint set of products it no longer stocks (one of: "now", "today", "tomorrow", "later", "out_of_stock")
- `brands` (array, nullable) — Brand slugs as DNS spells them in the facet list (examples: ["apple","samsung"])
- `promos` (array, nullable) — Promotion slugs, e.g. tovarysoskidkoj for discounted items (examples: ["tovarysoskidkoj"])
- `min_price` (integer, nullable) — Lowest price in RUB (min: 0; max: 9999999)
- `max_price` (integer, nullable) — Highest price in RUB (min: 0; max: 9999999)
- `has_rating` (boolean) — Keep only products carrying a customer rating (default: false)
- `reliable_only` (boolean) — Keep only products DNS marks as reliable in service (default: false)
- `reviewed_only` (boolean) — Keep only products with at least one written review (default: false)
- `spec_filters` (object, nullable) — Category-specific specification facets, keyed by the facet code DNS uses in its own URLs without the f[] wrapper, each with one or more variant ids (examples: {"3u":["1qz","1qy"],"al":["4pv"]})
  - `*` (array)
- `spec_ranges` (object, nullable) — Category-specific numeric specification ranges, keyed by facet code, value 'min-max' (examples: {"4a":"4000-5000"})
  - `*` (string)
- `with_availability` (boolean) — Also resolve per-product pickup and home-delivery dates for the selected city (default: false)
- `count` (integer, required) — Max number of products to return (min: 1; max: 960)

## Response

### 200 — Successful Response

- `@type` (string) (default: "DnsshopProductCard")
- `guid` (string, required)
- `code` (string, nullable)
- `hex_id` (string, nullable)
- `url` (string, nullable)
- `name` (string, nullable)
- `short_specs` (string, nullable)
- `specs` (array) (default: [])
  - `@type` (string) (default: "DnsshopSpec")
  - `label` (string, required)
  - `value` (string, required)
- `rating` (number, nullable)
- `review_count` (integer, nullable)
- `review_count_label` (string, nullable)
- `comment_count` (integer, nullable)
- `reliability` (string, nullable)
- `image` (string, nullable)
- `photo_count` (integer, nullable)
- `price` (integer, nullable)
- `credit_payment` (integer, nullable)
- `credit_months` (integer, nullable)
- `has_price_history` (boolean, nullable)
- `availability` (object, nullable)
  - `@type` (string) (default: "DnsshopAvailability")
  - `status` (string, nullable)
  - `store_note` (string, nullable)
  - `store_date` (string, nullable)
  - `pickup_note` (string, nullable)
  - `pickup_date` (string, nullable)
  - `delivery_note` (string, nullable)
  - `delivery_date` (string, nullable)
- `city` (string, nullable)
- `city_id` (string, nullable)

## Errors

### 422 — Validation Error

The city is not in the DNS city catalogue, or a payload field is malformed

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

Nothing matched the query, category or filter combination, or DNS answered a bare brand name with its brand landing page instead of a listing (X-Error says which), or DNS did not serve the listing

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.

