# /sofmap/products/ranking

`POST /api/sofmap/products/ranking`

Price: 5 credits

Get the Sofmap (ソフマップ) best-seller ranking of one category, aggregated over the last week or the last month, across the whole Bic Camera group or Sofmap alone. Each entry carries its position, whether it moved up or down since the previous ranking, and the product card with product number, name, brand, image, price, point reward and stock line.

## How to use it

Best sellers on sofmap.com inside one category, given as a code such as '001010110' from the categories endpoint. period switches between the weekly and the monthly sales window, scope between the whole Bic Camera group and Sofmap alone. Each entry has rank (1 is the best seller), rank_change (up, down or stay against the previous ranking), id (the product number, usable with the products endpoint), url, name, brand, image, jan, price, point, release_date, stock_status/stock_message, rating with review_count and review_url, and is_sold_out. A category with no ranking for the requested combination returns an empty list. All prices are in JPY and tax-included.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `category_id` (string, required) — Category to rank inside, e.g. '001010110' (from the categories endpoint) (examples: "001010110")
- `count` (integer, required) — Max number of results to return (min: 1; max: 50)
- `period` (string) — Sales window the ranking is aggregated over (default: "weekly"; one of: "weekly", "monthly")
- `scope` (string) — Rank across the whole Bic Camera group or Sofmap only (default: "group"; one of: "group", "sofmap")
- `product_type` (string) — Rank new or second-hand stock (default: "all"; one of: "all", "new", "used")
- `stock` (string, nullable) — Keep only orderable, in-stock, newly released or newly arrived products (one of: "orderable", "in_stock", "new_product", "new_arrival")

## Response

### 200 — Successful Response

- `@type` (string) (default: "SofmapProductCard")
- `id` (string, nullable)
- `url` (string, required)
- `name` (string, nullable)
- `brand` (string, nullable)
- `image` (string, nullable)
- `jan` (string, nullable)
- `price` (number, nullable)
- `currency` (string) (default: "JPY")
- `is_price_from` (boolean) (default: false)
- `point` (integer, nullable)
- `release_date` (string, nullable)
- `release_date_text` (string, nullable)
- `stock_status` (string, nullable)
- `stock_message` (string, nullable)
- `is_sold_out` (boolean) (default: false)
- `is_used` (boolean) (default: false)
- `used_rank` (string, nullable) (one of: "S", "A", "B", "C", "D", "E")
- `used_count` (integer, nullable)
- `store` (object, nullable)
  - `@type` (string) (default: "SofmapCardStore")
  - `id` (string, nullable)
  - `name` (string, required)
  - `url` (string, nullable)
- `badges` (array) (default: [])
- `rating` (number, nullable)
- `review_count` (integer, nullable)
- `review_url` (string, nullable)
- `rank` (integer, nullable)
- `rank_change` (string, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

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 requested category does not exist on sofmap.com

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.

