# /surugaya/products/search

`POST /api/surugaya/products/search`

Price: 20 credits

Search the Suruga-ya (駿河屋) catalogue of new and second-hand hobby goods by keyword, product name, barcode or manufacturer part number, narrowed by category, condition, brand, genre, hardware type, shop, price range, discount against the list price, release year, market movement and stock, with six orderings. Returns product cards with the id, name, photo, kind of product, brand, release date, the price of every condition on offer, the manufacturer list price and the cheapest partner-shop price with its offer count.

## How to use it

Search suruga-ya.jp. Give at least one of keyword, product_title (matches the name only), category_id (from the categories endpoint), brand, store_id, isbn (ISBN or JAN barcode, an exact lookup that normally returns a single product), model_number, condition or trend. Narrow further with genre and hardware_type (facets that only some categories publish), price_min/price_max in JPY, price_ratio_min/price_ratio_max (price as a percentage of the manufacturer list price), release_year_min/release_year_max, seller_scope and include_out_of_stock; order with sort. By default only products someone currently has in stock are returned, so set include_out_of_stock to reach the whole catalogue. Each result carries id (usable with the products and offers endpoints), url, name, image, product_type, brand (reusable as the brand filter), release_date, prices (one entry per condition Suruga-ya itself offers), price, list_price, is_sold_out, is_new_arrival, marketplace_price and marketplace_offer_count (the partner shops, listed in full by the offers endpoint). All prices are in JPY and tax-included. The source serves at most 9984 items per query.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `keyword` (string, nullable) — Free-text search query (examples: "ガンダム", "ONE PIECE"; minLength: 1)
- `exclude_keyword` (string, nullable) — Drop results matching these words (examples: "プラモデル"; minLength: 1)
- `product_title` (string, nullable) — Match only against the product name (examples: "ガンダム"; minLength: 1)
- `category_id` (string, nullable) — Category id to search inside (from the categories endpoint) (examples: "2", "50108")
- `count` (integer, required) — Max number of results to return (min: 1; max: 9984)
- `condition` (string, nullable) — Keep only products offered in this condition (one of: "new", "used", "preorder")
- `brand` (string, nullable) — Manufacturer, publisher or label, exactly as the brand field spells it
- `genre` (string, nullable) — Genre facet of the chosen category (examples: "ロールプレイング")
- `hardware_type` (string, nullable) — Hardware/software facet of the chosen category (examples: "本体")
- `store_id` (string, nullable) — Keep only products sold by this shop (seller_id of an offer) (examples: "400405")
- `trend` (string, nullable) — Keep only products with this movement (one of: "rising", "price_drop", "new_arrival")
- `seller_scope` (string, nullable) — Keep only products sold by partner shops or by Suruga-ya itself (one of: "marketplace", "surugaya")
- `price_min` (integer, nullable) — Minimum price in JPY (min: 0)
- `price_max` (integer, nullable) — Maximum price in JPY (min: 0)
- `price_ratio_min` (integer, nullable) — Minimum price as a percentage of the manufacturer list price (min: 0)
- `price_ratio_max` (integer, nullable) — Maximum price as a percentage of the manufacturer list price (min: 0)
- `release_year_min` (integer, nullable) — Earliest release year (min: 1900; max: 2200)
- `release_year_max` (integer, nullable) — Latest release year (min: 1900; max: 2200)
- `isbn` (string, nullable) — Exact lookup by ISBN or JAN barcode (examples: "9784088725093")
- `model_number` (string, nullable) — Exact lookup by manufacturer part number (examples: "ELJM-30654")
- `include_out_of_stock` (boolean) — Also return products nobody currently has in stock (default: false)
- `sort` (string) — Result ordering (default: "relevance"; one of: "relevance", "price_asc", "price_desc", "updated", "release_date_desc", "release_date_asc")

## Response

### 200 — Successful Response

- `@type` (string) (default: "SurugayaProductCard")
- `id` (string, required)
- `url` (string, required)
- `name` (string, nullable)
- `image` (string, nullable)
- `product_type` (string, nullable)
- `brand` (string, nullable)
- `release_date` (string, nullable)
- `prices` (array) (default: [])
  - `@type` (string) (default: "SurugayaPriceTag")
  - `condition` (string, required)
  - `price` (number, required)
- `price` (number, nullable)
- `list_price` (number, nullable)
- `currency` (string) (default: "JPY")
- `is_sold_out` (boolean) (default: false)
- `is_new_arrival` (boolean) (default: false)
- `marketplace_price` (number, nullable)
- `marketplace_offer_count` (integer, nullable)
- `marketplace_offer_label` (string, nullable)

## Errors

### 422 — Validation Error

No search scope was given, or a malformed category_id, isbn or model_number

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

The entity was not found, or a precondition failed

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.

