商品 API 响应模型
使用 response_format: "standard"(默认)时,商品端点返回下列类型。权威 TypeScript 定义:packages/shared/src/products.ts。
响应信封
| Endpoint | 结构 |
|---|---|
detail, parse | { product: StandardProductDetail, request_id } |
search, search-by-image | StandardProductList & { request_id } |
upload-image | { channel, image_id, request_id } |
StandardProductDetail
用于商品页与结账的完整商品快照。预览时,product.id 对应 lines[].id,所选 variants[].sku_id 对应 lines[].spec_id。淘宝创单使用预览返回的已解析配对。
标识与渠道
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 淘宝 = mi_id(预览传 lines[].id;会周期性变化,勿长期缓存)。1688 = offerId。微店目前为 prod_weidian_{source_product_id} |
channel | string | 1688、taobao 或 weidian |
source_product_id | string | 1688 = offerId(与 id 相同);淘宝 = 原 item_id |
source_url | string | 规范商品页 URL |
本地化文本(title、description)
| 字段 | 类型 | 说明 |
|---|---|---|
original | string | 卖场原文(通常为中文) |
translated | string | null | 按请求 language 翻译的文本 |
language | string | translated 的语言区域 |
description | object | null | 长描述(常为 HTML) |
定价(price、price_tiers[])
所有金额为 CNY 元(非分)。优先使用 promotion_amount,否则用 display_amount。
| 字段 | 类型 | 说明 |
|---|---|---|
price.original_amount | number | 1 件标价(1688 有 retailPrice 时用零售价) |
price.display_amount | number | 买家可见 1 件价(CNY) |
price.promotion_amount | number | null | 适用时的促销单价 |
price.original_currency / display_currency | string | 恒为 CNY |
variants[].price.wholesale_amount | number | null | 1688 SKU 批发价(≥2 件;仅新零售价货盘) |
price_tiers[] | array | 1688 批发阶梯(新货盘首档 ≥2);淘宝为空 |
min_order_quantity | number | null | 1688 用上游起订量;淘宝零售默认 1 |
order_quantity_multiple | integer | 购买数量倍数(一手数量);1688 映射 batchNumber。缺失或无效时,以及淘宝、微店,默认 1。 |
distribution_min_quantity | number | null | 1688 代发最低量 |
购买数量规则
product.order_quantity_multiple 为正整数,购买数量必须为此值的整数倍。1688 映射 batchNumber(一手数量),缺失或无效时默认 1;淘宝和微店返回 1。
起订量和数量倍数需分别满足。例如 min_order_quantity = 10、order_quantity_multiple = 6 时,数量应从 12、18、24…… 开始,并满足库存及渠道的其他购买规则。
商品详情请求中,response_format: "upstream" 保留原始 batchNumber;该标准字段不会改名原始响应,也不会自动调整下单数量。
媒体(images[]、videos)
| 字段 | 类型 | 说明 |
|---|---|---|
images[].url | string | 图片 CDN URL |
images[].type | enum | main、gallery 或 variant |
videos.main / videos.detail | string | null | 1688 视频;淘宝为 null |
属性 vs 规格变体
仅 variants[] 驱动 SKU 选择与订单行。
| 字段 | 作用 |
|---|---|
attributes[] | CPV 规格——仅展示,不用于 SKU 解析 |
variants[] | 可购 SKU 矩阵,含价格、库存、规格 |
变体对象(variants[])
| 字段 | 类型 | 说明 |
|---|---|---|
sku_id | string | 所选 SKU 标识,用于预览 spec_id;淘宝创单使用预览解析后的配对 |
upstream_sku_id | string | null | 1688 数字 skuId |
attributes[] | array | 规格维度(颜色、尺码等) |
attributes[].name / value | string | 展示文案(按请求 language 翻译) |
attributes[].original_name / original_value | string | 稳定中文键,用于分组 / 匹配 |
attributes[].prop_id | string | null | 上游属性 ID(字符串;淘宝 prop_id;1688 attributeId)。有值时优先于名称文本 |
attributes[].value_id | string | null | 上游属性值 ID(字符串;淘宝 value_id)。1688 无 valueId → null |
attributes[].image | string | null | 规格配图 / 色块图 |
price | object | SKU 级价格(元) |
stock | number | 可用数量;0 = 缺货 |
image | string | null | SKU 主图 |
shipping | object | null | 1688 SKU 件重尺(见下表);淘宝为 null |
min_order_quantity | number | null | 1688 商品级下发到各 SKU;淘宝默认 1 |
distribution | object | null | 1688 代发定价 |
淘宝下单前的 SKU 价格
商品展示时,读取所选 variant 的 price.promotion_amount ?? price.display_amount,单位为 CNY 元。不要把商品级价格当作所有 SKU 的价格。淘宝 SKU 金额优先使用上游 SKU 促销价,否则使用 SKU 价格;original_amount 不保证是未优惠的采购原价。目录数据是快照,不是结账报价。
获取当前采购报价时,以所选标识、数量和实际收货地址调用 POST /v1/orders/preview,并确认 success === true。读取 sellers[].lines[].unit_price.amount 获取 SKU 报价单价、line_total.amount 获取返回的行小计。total.payment.amount 是包含国内运费的整单应付金额,不是 SKU 单价。预览 Money 单位为 CNY 分(CNY_minor):5580 表示 55.80 元。未返回行价格时,不要按零价处理。
报价遵循 App 的履约模式。HIOBuy Fulfillment(warehouse)预览排除平台促销,使用未优惠的采购价格,因此可能与目录促销价不同。预览不锁价;create 金额也可能是估算值,创单后应调用 POST /v1/orders/detail,在付款前确认当前订单金额。
SKU 件重尺(variants[].shipping)
映射自 1688 上游 productShippingInfo.skuShippingDetails(SkuShippingDetail)。淘宝无此数据,恒为 null。空值或 0 的尺寸/重量会规范为 null;若该 SKU 完全无件重尺数据,整个 shipping 为 null。
| 字段 | 类型 | 说明 |
|---|---|---|
width_cm | number | null | 宽,cm(商家自填) |
length_cm | number | null | 长,cm |
height_cm | number | null | 高,cm |
weight_kg | number | null | 重,kg |
official_width_cm | number | null | 官方测量宽度,cm |
official_length_cm | number | null | 官方测量长度,cm |
official_height_cm | number | null | 官方测量高度,cm |
official_weight_kg | number | null | 官方测量重量,kg |
ai_weight_kg | number | null | AI 预测重量,kg |
ai_weight_accuracy | string | null | AI 预测重量在该商品叶子类目的准确率(如 80%) |
source | string | null | 件重尺来源(如 商家自填) |
运费估算可优先使用 official_*,其次商家自填尺寸/重量,再用 ai_weight_kg(并参考 ai_weight_accuracy)。
卖家、运费与元数据
| 字段 | 类型 | 说明 |
|---|---|---|
seller.id / seller.name | string | 店铺 ID 与展示名 |
seller.shop_url | string | null | 店铺链接 |
shipping.shipping_from | string | null | 国内发货地区 |
shipping.domestic_shipping_fee | object | null | 预估国内运费(元) |
metadata.raw_category | string | null | 上游类目 |
metadata.brand | string | null | 申报品牌 |
metadata.updated_at | string | ISO 8601 最后同步时间 |
trade_score | string | null | 1688 质量分 |
示例(截断)
{
"product": {
"id": "554456348334",
"channel": "1688",
"source_product_id": "554456348334",
"min_order_quantity": 10,
"order_quantity_multiple": 6,
"title": {
"original": "...",
"translated": "...",
"language": "en"
},
"price": {
"display_amount": 29.9,
"promotion_amount": 24.9
},
"variants": [
{
"sku_id": "b266e0...",
"upstream_sku_id": "12123313",
"stock": 100,
"shipping": {
"width_cm": 10,
"length_cm": 10,
"height_cm": 10,
"weight_kg": 1.2,
"official_width_cm": 5,
"official_length_cm": 12,
"official_height_cm": 14,
"official_weight_kg": 0.001,
"ai_weight_kg": 0.001,
"ai_weight_accuracy": "80%",
"source": "商家自填"
}
}
]
},
"request_id": "req_..."
}各渠道字段可用性
| 字段 | 1688 | Taobao | Weidian |
|---|---|---|---|
order_quantity_multiple | batchNumber / 1 | 1 | 1 |
videos, price_tiers, trade_score | ✓ | — | 视情况 |
variants[].shipping, distribution | ✓ | — | — |
variants[].attributes[].prop_id | ✓(attributeId) | ✓(prop_id) | — |
variants[].attributes[].value_id | —(null) | ✓(value_id) | — |
下单 lines[].id | id / offerId | id(mi_id) | 平台 ID |
StandardProductList
来自搜索与以图搜索。items[] 每项为摘要——需调用详情获取 SKU 矩阵。
| 字段 | 类型 | 说明 |
|---|---|---|
channel | string | 查询的卖场 |
keyword | string | 关键词回显(纯以图搜索时为空) |
page / page_size | number | 已应用的分页 |
total | number | 上游总数(可能为近似值) |
items[] | array | StandardProductListItem 对象 |
pic_region_info | object | 以图搜索:检测到的裁剪区域 |
StandardProductListItem
| 字段 | 类型 | 说明 |
|---|---|---|
id, channel, source_product_id, source_url | string | 使用搜索结果 id 获取详情;淘宝 source_product_id 是原始 item_id |
title | LocalizedTitle | 列表标题 |
price | ProductPrice | 摘要价格(CNY 元) |
image | string | 缩略图 URL |
seller.name | string | 店铺名称 |
上传图片响应
| 字段 | 类型 | 说明 |
|---|---|---|
channel | string | 存储图片的卖场 |
image_id | string | 在以图搜索中复用 |
规格选择
- 加载详情 → 读取
product.variants。 - 按
attributes[].original_name分组做维度选择器(有prop_id时也可按 ID 分组)。 - 随用户每次选择过滤变体;禁用缺货选项。
- 将商品
id与所选variants[].sku_id传入订单预览。淘宝创单使用预览返回的已解析配对。
匹配键: 淘宝在同时有 prop_id + value_id 时优先用 ID——这是稳定的 CPV 身份,可避免多 SKU 共用同一属性名(如大量选项都叫 Color Classification)导致的串配。UI 分组可回退到 original_name + original_value。name / value 仅用于展示。不要根据文案推断语义类型。
{
"prop_id": "1627207",
"value_id": "43553464153",
"name": "Color Classification",
"value": "[Special for Bicycle Maintenance] Professional 46-Piece Set",
"original_name": "颜色分类",
"original_value": "【自行车维修专用】专业46件套",
"image": "https://img.alicdn.com/..."
}1688 使用同一结构:prop_id 来自 attributeId,value_id 为 null(上游 SkuAttribute 无 valueId)。
1688 评分:当前页过滤
items[].trade_score: 仅 1688 关键词及店铺标准搜索:上游 tradeScore,数值字符串;缺失或无效时为 null。其他渠道及图片搜索保持不变。
page、page_size、total 保留未筛选的上游含义(上游缺少总数时,total 沿用当前页原始数量)。rating_filter.source_count 是当前页筛选前数量,returned_count 是筛选后数量;rating_filter.scope 固定为 current_page。仅在启用过滤时返回此元数据。
结果可能少于一页,甚至 items 为空,但仍存在后续页。has_next(若有)根据未筛选的上游分页计算;缺失时表示分页信息未知,不能用筛选后数量判断结束。客户端继续翻页时应设置最大页数。
rating_start: 可选的 1688 当前页最低 trade_score;JSON 数字 ≥ 0,仅标准格式支持。分页、缺失评分及示例见 1688 评分过滤。
获取支持
需要集成帮助?请联系开发者支持 support@hiobuy.com · 预计 1–2 个工作日内回复