# /bookoff/products/search

`POST /api/bookoff/products/search`

Price: 20 credits

Search the BookOff Online (ブックオフ) catalogue of second-hand and new books, manga, magazines, CDs, DVDs, Blu-rays and video games by keyword, barcode, author, publisher or related-word tag, narrowed by genre, second-hand price, release month, stock and branch collection, in seven orderings. Returns listing cards with the product code, title, author, cover, price with the saving against the retail price, the previous price where the shop published one, reward points, release date, genre labels, badges and stock.

## How to use it

Search shopping.bookoff.co.jp. Every filter is optional, so count alone browses the catalogue. Narrow with keyword (a JAN or ISBN barcode here returns exactly the one matching entry, which is the only way to turn a barcode into a product code), exclude_keyword, category_id (a genre id such as 12 for books, 11 comics, 31 CD, 71 DVD and Blu-ray, 51 games, and any deeper id from a product's categories chain), author, publisher, tag (a related-word tag a product reports), price_min/price_max in JPY over the second-hand price only, release_from/release_to as YYYYMM, stock and store_pickup_only. Order with sort; note that the new_price orderings use the brand-new price while the used_price ones use the second-hand price. Each card carries id and condition, which together address the entry on the products endpoint. The catalogue keeps entries nobody currently stocks, so use stock to see only what can be bought today, and is_in_stock on a card follows the shop's own stock line including its low-stock wordings. Prices are tax-included JPY.

## 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 query; a JAN or ISBN barcode resolves to a single entry (minLength: 1)
- `exclude_keyword` (string, nullable) — Drop entries matching this word (examples: "文庫"; minLength: 1)
- `category_id` (string, nullable) — Genre id to search inside (an id from a product's categories chain) (examples: "12", "11", "31", "71", "51", "122503")
- `count` (integer, required) — Max number of results to return (min: 1; max: 119880)
- `author` (string, nullable) — Author or artist name, exactly as the catalogue spells it (minLength: 1)
- `publisher` (string, nullable) — Publisher or label name, exactly as the catalogue spells it (minLength: 1)
- `tag` (string, nullable) — Related-word tag, as a product reports it in tags (minLength: 1)
- `price_min` (integer, nullable) — Minimum second-hand price in JPY (min: 0)
- `price_max` (integer, nullable) — Maximum second-hand price in JPY (min: 0)
- `release_from` (string, nullable) — Earliest release month, YYYYMM (examples: "202001"; pattern: ^\d{6}$)
- `release_to` (string, nullable) — Latest release month, YYYYMM (examples: "202012"; pattern: ^\d{6}$)
- `stock` (string) — Restrict to second-hand copies, to copies in stock, or to both (default: "any"; one of: "any", "in_stock", "used_only", "used_in_stock")
- `store_pickup_only` (boolean) — Keep only entries that can be collected from a branch (default: false)
- `sort` (string) — Result ordering (default: "popularity"; one of: "popularity", "release_desc", "release_asc", "new_price_asc", "new_price_desc", "used_price_asc", "used_price_desc")

## Response

### 200 — Successful Response

- `@type` (string) (default: "BookoffProductCard")
- `id` (string, required)
- `url` (string, required)
- `condition` (string, required)
- `name` (string, nullable)
- `image` (string, nullable)
- `author` (string, nullable)
- `price` (number, nullable)
- `currency` (string) (default: "JPY")
- `discount_amount` (number, nullable)
- `discount_percent` (integer, nullable)
- `previous_price` (number, nullable)
- `previous_price_note` (string, nullable)
- `reward_points` (integer, nullable)
- `release_date` (string, nullable)
- `category` (string, nullable)
- `subcategory` (string, nullable)
- `tags` (array) (default: [])
- `is_in_stock` (boolean) (default: false)
- `is_store_pickup_available` (boolean) (default: false)

## Errors

### 422 — Validation Error

Malformed category_id (a BookOff genre id is digits in pairs, e.g. '12' or '122503')

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.

