淘宝 API 仅向有效付费订阅开放。7 天免费试用只包含 1688、微店。未订阅时调用淘宝将返回 HTTP 403,错误码为 PAID_SUBSCRIPTION_REQUIRED。请在开发者中心升级套餐,升级后可继续使用原 API Key。
商品关键词搜索 API
兼容接口
GET /v1/products/search仍保留,但生产代码已标记废弃。它使用查询参数q而非keyword,返回标准结构。新集成请使用下方 POST JSON 契约;旧 GET 不支持currency或 POST 的response_format切换。
POST /v1/products/search — 关键词搜索,返回分页商品列表。
- 淘宝 → 上游
/traffic/item/search - 1688 → 上游
product.search.keywordQuery
既有的渠道特有字段可能被不支持的渠道忽略;新增 rating_start 会校验渠道及响应格式,不兼容时返回 HTTP 400。
公共请求字段
| 字段 | 必填 | 说明 |
|---|---|---|
channel | 是 | 1688 | taobao |
keyword | 是 | 搜索词 |
rating_start | 否 | 可选的 1688 当前页最低 trade_score;JSON 数字 ≥ 0,仅标准格式支持。分页、缺失评分及示例见 1688 评分过滤。 |
language | 否 | 默认 en |
page / page_size | 否 | 分页(淘宝每页最多 20) |
response_format | 否 | standard(默认)或 upstream |
sort_field | 否 | price | sales | credit(credit 仅 1688;淘宝忽略) |
sort_order | 否 | asc | desc(默认 asc;需配合 sort_field) |
price_start / price_end | 否 | 价格区间,单位 元(支持小数,如 19.9) |
ship_within_hours | 否 | 0(当日)| 24 | 48 |
category_ids | 否 | 类目 ID,逗号分隔。仅 1688;淘宝忽略。对照表见 1688 分类 |
product_collection_id | 否 | 商机货盘 ID。仅 1688;淘宝忽略 |
排序 sort_field + sort_order
sort_field | sort_order | → 1688 | → 淘宝 |
|---|---|---|---|
price | asc / desc | {"bid":"asc|desc"} | PRICE_ASC / PRICE_DESC |
sales | asc / desc | {"sale":"asc|desc"} | SALE_QTY_ASC / SALE_QTY_DESC |
credit | asc / desc | {"credit":"asc|desc"} | 忽略 |
兼容别名:bid→price,sale→sales。
价格
- 对外一律 元(可小数)。
- 1688 →
priceStart/priceEnd。 - 淘宝 →
filters的min_price/max_price(分,Math.round(元 * 100))。
发货时效 ship_within_hours
| 值 | → 1688 filter | → 淘宝 filters |
|---|---|---|
0 | shipInToday | 忽略 |
24 | shipIn24Hours | 24shipping |
48 | shipIn48Hours | 48shipping |
1688 语义筛选(淘宝忽略)
| 字段 | 类型 | 说明 |
|---|---|---|
experience_score_level | integer | 1…4 → totalEpScoreLv1…Lv4 |
product_attrs | string | 逗号分隔:isOnePsale、isOnePsaleFreePost、new7、new30、1688Selection、isQqyx |
filter | string | 高级逗号分隔标签,与上表语义字段 合并去重 |
sale_filters | object[] | 映射 saleFilterList(sale_type:sales7 | sales14 | sales30 | totalSales,可选 sale_start / sale_end) |
keyword_translate | boolean | 关键词是否已翻译 |
兼容(deprecated):category_id、category_id_list(请用 category_ids)。
请求示例
1688
POST /v1/products/search
{
"channel": "1688",
"keyword": "phone case",
"language": "en",
"page": 1,
"page_size": 20,
"sort_field": "sales",
"sort_order": "desc",
"price_start": 10.5,
"price_end": 99.9,
"ship_within_hours": 24,
"experience_score_level": 2,
"product_attrs": "isOnePsale,1688Selection",
"filter": "noReason7DReturn",
"category_ids": "123,456",
"product_collection_id": "262105288"
}淘宝
POST /v1/products/search
{
"channel": "taobao",
"keyword": "帽子",
"language": "en",
"page": 1,
"page_size": 20,
"sort_field": "price",
"sort_order": "asc",
"price_start": 20,
"price_end": 100,
"ship_within_hours": 24
}响应
StandardProductList — items[] 中为摘要卡片。items[].id 为淘宝 mi_id 或 1688 offerId,请作为 id 传给 商品详情。
淘宝 id / mi_id 会周期性变化,请勿长期缓存列表;过期 id 会导致详情、相似推荐和下单失败。
response_format: "upstream" 时返回渠道原厂载荷(见 响应格式)。
1688 评分:当前页过滤
POST /v1/products/search 和 POST /v1/products/seller/search 在 channel=1688 的标准响应中返回 items[].trade_score,映射本次上游搜索的 tradeScore,类型为数值字符串。缺失或无效评分为 null;真实的 "0" 不等于缺失。不额外调用商品详情。
可选参数 rating_start 必须是有限、非负的 JSON 数字(例如 4.0)。仅保留当前上游页中 trade_score >= rating_start 的商品,并排除缺失或无效评分。省略时不筛选。仅支持 channel=1688 和 response_format=standard(默认);其他渠道或 upstream 传此参数,在认证及权限校验后返回 HTTP 400。微店保持原有行为。
这不是全库评分筛选或评分排序。上游顺序保持不变,不额外翻页补齐结果。experience_score_level 是另一项上游筛选,与 rating_start 含义不同。
page、page_size、total 保留未筛选的上游含义(上游缺少总数时,total 沿用当前页原始数量)。rating_filter.source_count 是当前页筛选前数量,returned_count 是筛选后数量;rating_filter.scope 固定为 current_page。仅在启用过滤时返回此元数据。
结果可能少于一页,甚至 items 为空,但仍存在后续页。has_next(若有)根据未筛选的上游分页计算;缺失时表示分页信息未知,不能用筛选后数量判断结束。客户端继续翻页时应设置最大页数。
关键词搜索示例
POST /v1/products/search
{
"channel": "1688",
"keyword": "phone case",
"page": 1,
"page_size": 20,
"rating_start": 4.0,
"response_format": "standard"
}店铺搜索示例
POST /v1/products/seller/search
{
"channel": "1688",
"seller_open_id": "YOUR_1688_SELLER_OPEN_ID",
"page": 1,
"page_size": 20,
"rating_start": 4.0
}筛选响应示意
{
"request_id": "req_example_rating",
"channel": "1688",
"keyword": "phone case",
"page": 1,
"page_size": 20,
"total": 120,
"has_next": true,
"items": [
{
"id": "1234567890",
"channel": "1688",
"source_product_id": "1234567890",
"source_url": "https://detail.1688.com/offer/1234567890.html",
"title": {
"original": "手机壳",
"translated": "Phone case",
"language": "en"
},
"price": {
"original_currency": "CNY",
"original_amount": 5.45,
"display_currency": "CNY",
"display_amount": 5.45
},
"image": "https://example.com/product.jpg",
"seller": {
"name": "Example seller"
},
"trade_score": "4.8"
}
],
"rating_filter": {
"rating_start": 4,
"scope": "current_page",
"source_count": 20,
"returned_count": 1
}
}获取支持
需要集成帮助?请联系开发者支持 support@hiobuy.com · 预计 1–2 个工作日内回复