# 淘宝 关键词搜索 API (taobao.search)

- Canonical page: https://everyinfra.com/taobao-api/search
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "taobao", "action": "search", "params": {...}}
- Price: $0.0135 per call ($13.5 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 20 per call
- Mode: sync; add "mode": "async" for slow tasks

淘宝关键词搜索按 `keyword` 检索淘宝和天猫商品，返回标题、价格与币种、销量、评分、发货地、店铺名、主图和库存。它回答「这个品类在卖什么、什么价位、哪些卖得好」，常用于选品、竞品价格监测和品类调研。

用 `min_price` 和 `max_price` 圈定价格区间，用 `sort` 按相关度、人气或价格从高到低排序，用 `tmall_only` 只看天猫商品。`tmall_only` 只接受布尔值 true 或 false，传字符串会在扣费前被拒绝。比较 `rating` 之前先看同一行的 `rating_scale`，不同平台的满分不同。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=taobao&action=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | search 的淘宝/天猫商品关键词，不是店铺名精确查询。 |
| max_price | not declared | no | not declared | search 的商品最高价格条件，与 min_price 配合；不适用于店铺、详情、评论或问答。带小数时可能按整数筛选（向上取整）。带价格条件时不能翻页。 |
| min_price | not declared | no | not declared | search 的商品最低价格条件，不是评论评分或 API 费用；不适用于店铺、详情、评论或问答。带小数时可能按整数筛选（向下取整）。带价格条件时不能翻页。 |
| page | integer | no | not declared | search 的页码，1–50，每页 20 条；不传就是第 1 页，每翻一页按一次调用计费。只有普通关键词搜索能翻页（不带 min_price、max_price、tmall_only，sort 不传或为 relevance），这种用法更稳，但多数行没有销量和店铺名；带这些条件又传大于 1 的 page 会在扣费前拒绝，去掉价格区间、排序和 tmall_only 就能翻页。limit 只决定这一页取几条，翻页时保持 20。排序实时变化，相邻两页偶尔有几条重复，合并时按 id 去重。 |
| sort | enum: popular / price_desc / relevance | no | not declared | search 使用 popular、price_desc、relevance（不提供低价优先）；默认/relevance 最多 20 条，popular/price_desc 最多 10 条，也不能翻页。reviews、questions 不接受 sort。shop 的 sort 只在带 page 翻页时生效，见 shop 的 page、sort 说明。 |
| tmall_only | not declared | no | not declared | search 是否仅查询天猫商品，只接受布尔值 true / false，默认 false；开启时最多 10 条，也不能翻页。字符串 "false" 会在扣费前拒绝。 |
| limit | integer (1–20) | no | 20 | 这次调用最多返回的条数，整数，1–20；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| price | 价格数值，不含货币符号；币种见 currency。product_detail 的价格（含 skus 每条的 price）有两种：淘宝页面上的人民币价，或由美元价折算成的人民币价（可能比页面价高或低约 1–4%，以页面为准）。search 每行的价可能是页面现价、划线价或推广价。是哪种见 price_basis。 |
| currency | 价格币种代码（如 CNY、USD）。price 存在但 currency 为 null 时不要假定币种。 |
| price_basis | price 是怎么来的（有价才给）。product_detail：page 是淘宝页面上的人民币价；converted 是由美元价折算成的人民币价，可能比淘宝页面上的价格高或低约 1–4%。search（每行一个）：page 是淘宝页面上的现价；list 是划线价，商品打折时高于实际卖价，有时高出一倍；promotion 是淘宝推广价，常比页面价低很多。currency 都是 CNY；同一商品不同次调用可能不同。 |
| sold_count | 销量（search 有；product_detail 只有一部分调用会返回，占比每天不同）。 |
| rating | 评分。**分制随平台而异**，同一行的 `rating_scale` 给出该平台满分 (多数是 5，Booking/豆瓣/爱奇艺/NAVER 是 10)。跨平台比较前必须先按 rating_scale 换算。直接比数字会得出反的结论。 |
| rating_scale | 上一列 `rating` 的满分。5 表示五星制、10 表示十分制。只在该行有 rating 时出现。 |
| location | 发货地。卖家有多个仓时，同一商品不同次调用给出的发货地可能不同。 |
| shop_name | 店铺名。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| stock | 库存件数。卖家有多个仓时，同一商品不同次调用给出的库存可能不同（发货地也可能不同）。product_detail 的来源没给整件库存时，给的是各规格库存的合计。 |
| shop_id | 店铺 ID（search 行与详情、店铺商品行里是同一个 ID）。 |
| sold_text | 销量原文（search，如「10万+」）；带「+」或「万」的是平台展示的约数，不是精确销量。 |
| original_price | 原价（划线价）；search 无折扣时与 price 相同。product_detail 多数调用为空。shop 只有这一个价：列表展示的划线价，不是实际卖价，可能明显偏高；要卖价用 product_detail。 |
| coupon_price | 券后价（有优惠券时低于 price，无券时缺省）。product_detail 只有一部分调用会返回这一项（占比每天不同），缺省不一定是没有券。 |
| discount_type | 折扣/活动类型原文（如「特价秒杀」）。 |
| is_tmall | 是否为天猫店（区别于淘宝 C 店，开店门槛和保障不同）。product_detail 的部分来源不给这一项。 |
| brand | 品牌（product_detail 常缺省）。 |
| category_id | 类目 ID。 |
| seller_credit_level | 卖家信用等级（数字，越大越高）。 |
| seller_positive_rate | 卖家好评率（search，百分数，100 即 100%）。 |
| shop_score_description | 店铺动态评分·描述相符（5 分制）。 |
| shop_score_service | 店铺动态评分·服务态度（5 分制）。 |
| shop_score_delivery | 店铺动态评分·物流服务（5 分制）。 |
| subtitle | 商品副标题（search，卖点短句）。 |
| search_rank | 在本次搜索结果中的位置（search，从 1 起；翻页时接着往下数，第 3 页从 41 起）。 |
| free_shipping | 是否包邮。 |
| selling_points | 商品卖点标签列表。 |
| review_tags | 评价标签列表，每项 tag（标签文字）与 count（提到次数，可能缺省）。 |
| images | 图片链接列表：product_detail、search 是商品图（search 不含主图 image_url），reviews 是买家晒图（没晒图时没有这个字段）。 |
| discount_rate | 现价占原价的百分比（search；46.2 即打 4.62 折，100 为不打折）。 |
| spu_id | 标准商品 SPU ID（search；同款不同店的商品共用一个，可用来归并同款）。 |
| category_path | 类目路径（面包屑，用「 > 」连接；product_detail 与 search 都可能有）。 |
| review_count | 评价条数，用于商品/商家类能力。null 表示不公开，不等于 0。 |
| latest_review | 最新一条评价（search）：rating、text、posted_at、sku。 |
| seller_type | 卖家类型代码（product_detail、search；B 为天猫或企业店，C 为个人店）。 |
| shop_opened_at | 开店时间原文（product_detail、search）。 |
| shop_age_years | 开店年数（search）。 |
| shop_item_count | 店铺在售商品数（product_detail、search、shop）。 |
| shop_score_vs_industry | 店铺三项评分与同行比（search）：description、service、delivery 各为 higher / same / lower。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "taobao",
  "action": "search",
  "params": {
    "keyword": "便携咖啡秤"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "taobao",
        "action": "search",
        "params": {
            "keyword": "便携咖啡秤",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-10-24T18:28:34Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "taobao",
  "action": "search",
  "results": [
    {
      "id": "•••",
      "url": "https://item.taobao.com/item.htm?id=1036557039587",
      "title": "手冲电子称豆盘咖啡称重展示盘咖啡豆粉秤豆碟茶叶茶则茶器便携",
      "price": 59.8,
      "currency": "CNY",
      "location": "浙江 杭州",
      "shop_name": "好货严选工厂",
      "image_url": "https://g.search.alicdn.com/img/bao/uploaded/i4/i2/2206584264218/O1CN01sCMEZhb10YE1chua_!!2206584264218-0-C2M.jpg",
      "stock": 438,
      "shop_id": "2206584264218",
      "sold_text": "1000+",
      "original_price": 59.8,
      "discount_type": "特价秒杀",
      "seller_credit_level": 20,
      "seller_positive_rate": 100,
      "shop_score_description": 4.74,
      "shop_score_service": 4.8,
      "shop_score_delivery": 4.82,
      "subtitle": "",
      "search_rank": 1,
      "images": [
        "https://img.alicdn.com/imgextra/i4/3937219703/O1CN01VRbcrW2LY2B5R9Jq9_!!3937219703-0-C2M.jpg",
        "https://img.alicdn.com/imgextra/i3/3937219703/O1CN01Bs0puN2LY2B58j8Nm_!!3937219703-0-C2M.jpg",
        "https://img.alicdn.com/imgextra/i4/3937219703/O1CN010vTDpb2LY2B5NXjqG_!!3937219703-0-C2M.jpg"
      ],
      "discount_rate": 100,
      "spu_id": "8995243647",
      "platform": "taobao"
    },
    {
      "id": "•••",
      "url": "https://item.taobao.com/item.htm?id=803310769271",
      "title": "Bincoo咖啡电子秤意式专用咖啡豆称重智能手冲迷你便携秤咖啡器具",
      "price": 88,
      "currency": "CNY",
      "shop_name": "bincoo旗舰店",
      "image_url": "https://g.search1.alicdn.com/img/bao/uploaded/i4/i3/4249388314/O1CN013agzRw2BHrr0rcgBA_!!0-item_pic.jpg",
      "stock": 1267,
      "shop_id": "4249388314",
      "sold_text": "1000+",
      "original_price": 128,
      "discount_type": "优惠价",
      "seller_credit_level": 16,
      "seller_positive_rate": 100,
      "shop_score_description": 4.9,
      "shop_score_service": 4.92,
      "shop_score_delivery": 4.93,
      "subtitle": "",
      "search_rank": 2,
      "images": [
        "https://img.alicdn.com/imgextra/i1/4249388314/O1CN01ZKqJQV2BHrqxP8GFJ_!!4249388314.jpg",
        "https://img.alicdn.com/imgextra/i2/4249388314/O1CN01tX38az2BHrqz5tjuQ_!!4249388314.jpg",
        "https://img.alicdn.com/imgextra/i1/4249388314/O1CN01Jddc8c2BHrqyzT1fk_!!4249388314.jpg"
      ],
      "discount_rate": 68.75,
      "spu_id": "7410827142",
      "platform": "taobao"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 能翻页拿更多结果吗？

能，用 `page` 翻页：第 1 到 50 页，每页 20 条，每页按一次调用计费，不传就是第 1 页。翻页只支持普通关键词搜索，也就是不带 `min_price`、`max_price`、`tmall_only`，`sort` 不传或用 `relevance`；这种用法更稳，但多数行没有销量和店铺名。带价格区间或 `sort=popular` 的搜索可能带销量，但每次最多 10 或 20 条、不能翻页，这时传大于 1 的 `page` 会在扣费前被拒绝。排序实时变化，相邻两页偶尔有几条重复，合并时按 `id` 去重。

### `sort` 有哪些排序？

`relevance` 按相关度（默认），`popular` 按人气，`price_desc` 按价格从高到低，目前没有低价优先。按人气或价格排序时每次最多返回 10 条，也不能翻页；要更多结果，改用不排序的普通关键词搜索，再用 `page` 翻页。

### 价格区间怎么用？

`min_price` 和 `max_price` 是商品价格的下限和上限，可以只传其中一个；它们只作用于商品搜索，和评价评分、调用费用都无关。返回的 `price` 不带货币符号，币种看 `currency`。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=taobao
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
