**版本：202601**

# 查询商品库存详情

**GET** `/openapi/2026-01/products/:product_id/inventory`

通过商品 ID 获取指定商品的库存详情。

## 请求

**Path参数**

- `product_id` string (required)

  商品 ID

**Query参数**

- `location_id` uint64

  地点 ID（可选；指定后只返回该地点的库存）

## 响应

**200**

OK

**application/json**

**数据结构 | 示例**

**数据结构**

- `code` string

  错误码
- `message` string

  错误信息
- `data` object

  - `product_id` string

    商品 ID
  - `Stock` int32

    库存
  - `variants` object[]

    子款式库存列表

    *   Array \[

    - `variant_id` string

      子款式 ID
    - `location_items` object[]

      各地点的库存详情

      *   Array \[

      - `location_id` uint64

        地点 ID
      - `stock` int32

        该地点的当前库存数量
      *   \]
    *   \]

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "product_id": "string",
    "Stock": 0,
    "variants": [
      {
        "variant_id": "string",
        "location_items": [
          {
            "location_id": 0,
            "stock": 0
          }
        ]
      }
    ]
  }
}
```
