库存列表
POST
/channel/api/v1/inventory/listAuth: request-token (channel_partner)
返回当前认证渠道伙伴可见库存的分页列表,按 sku_id + 仓库聚合。默认仅包含 owner_member_id 与令牌解析成员一致的库存行;若已授予 platform_stock 能力,还会包含平台自有库存(owner_member_id 为 NULL)。
所需能力: inventory_view(缺少时返回 606)。如需查看平台库存,另需 platform_stock。
请求头
| 请求头 | 必填 | 说明 |
|---|---|---|
request-token | 是 | 渠道伙伴应用令牌 |
Content-Type | 是 | application/json |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
pageNumber | integer | 否 | 页码,从 1 开始。默认 1;兼容别名 page |
pageSize | integer | 否 | 每页条数,最大 100。默认 20 |
warehouse_id | integer | 否 | 按仓库筛选 |
sku_id | integer | 否 | 按 SKU id 精确筛选 |
keyword | string | 否 | 关键字:仓库名称模糊匹配;纯数字额外按 sku_id 精确匹配;同时匹配变体的 sku / ean / origin_sku / shop_sku |
响应
json
{
"code": 200,
"msg": "success",
"data": {
"data": [
{
"sku_id": 789,
"sku_code": "PPS-500-BLK",
"product_title": "Portable Power Station",
"image": "https://cdn.example.com/products/pps500.jpg",
"options": { "color": "black", "size": "500W" },
"warehouse_id": 1,
"warehouse": { "id": 1, "name": "深圳仓" },
"sellable_quantity": 120,
"frozen_quantity": 5
}
],
"total": 1,
"per_page": 20,
"current_page": 1
}
}字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
sku_id | integer | 变体 id |
sku_code | string | 变体 SKU 编码 |
product_title | string | 商品标题 |
image | string | 主图 URL,无图时为空字符串 |
options | object | 变体选项(来自 standard),无选项时为 {} |
warehouse_id | integer | 仓库 id |
warehouse | object | { id, name } |
sellable_quantity | integer | 未冻结的可售数量 |
frozen_quantity | integer | 已冻结数量 |
total 为聚合后的分组数;分页字段为 per_page / current_page(不返回 has_more)。按 sku_id + 仓库 + 归属范围(自有/平台)聚合,未授予 platform_stock 时只有自有行;同一 SKU 与仓库的自有/平台行会分别成行。sellable_quantity 与 frozen_quantity 同时为 0 的行不返回。
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效 |
| 606 | 能力不足(需要 inventory_view) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/inventory/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"pageNumber": 1,
"pageSize": 20,
"warehouse_id": 1
}'