# 小红书 商品搜索 API (xiaohongshu.product_search)

- Canonical page: https://everyinfra.com/xiaohongshu-api/product_search
- Endpoint: POST /api/v1/social with {"platform": "xiaohongshu", "action": "product_search", "params": {...}}
- Price: $0.005556 per call ($5.56 per 1,000 requests); failed and empty results are not charged
- Returns: list, one page of up to 20 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

小红书商品搜索按 `keyword` 在小红书商城里找商品，返回的是商品（SKU），不是笔记。每行有标题、价格 `price`、原价 `original_price`、币种 `currency`、已售件数 `sold_count`、是否有货 `in_stock`、主图 `image_url` 和店铺。它回答「这个品类商城里在卖什么、卖多少、哪些店在卖」，适合选品调研、同类商品比价和竞品店铺摸底。

每页最多 20 条，通常 19 个，实测在 18–20 个之间，`limit` 照收但不起作用。读到哪里算到底，只看响应里还有没有 `next_page_token`，一页条数少几条不代表读完。`price` 不含货币符号，币种看 `currency`，为 null 时别假定币种。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 小红书商城的商品搜索词，如 防晒霜；返回商品（SKU），不是笔记。返回的 id 可作为 product_detail 的 product_id。 |
| page_token | not declared | no | not declared | 翻页令牌。第一页不传；之后把上一页响应里的 next_page_token 原样传回取下一页，其余参数不变。每页通常 19 个商品（实测 18–20 个），每页算一次调用；商城的排序会变，相邻两页偶有几个相同的商品，请按 id 去重。令牌请在 24 小时内使用，翻到底时响应里没有 next_page_token。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| url | 该记录在小红书上的链接。search、note、profile、hashtag 返回的链接一般带访问令牌，未登录的浏览器也能打开（令牌有时效，过期后重新调用即可）；user_posts 返回的笔记链接不带令牌，在浏览器里打开需要令牌：用笔记 ID 调 note 能拿到可以打开的链接；search_users 返回的主页链接同样不带令牌，用 user_id 调 profile 拿能打开的链接。pgy_content_square 不带 keyword 时笔记链接带令牌，带 keyword 时不带（用笔记 ID 调 note 拿能打开的链接）。followers_list 返回的是粉丝的主页链接，同样不带令牌；note_location 返回的笔记链接带上了请求里的令牌（请求里没带就没有）。 |
| price | 价格数值，不含货币符号；币种见 currency。 |
| original_price | 商品原价（product_search、product_detail），人民币元；没有划线价时和 price 相同。 |
| currency | 价格币种代码（如 CNY、USD）。price 存在但 currency 为 null 时不要假定币种。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| sold_count | 商品已售件数（product_search、product_detail），按商品页显示的数：搜索结果是精确数；详情页显示「7.2万+」这类约数时给换算后的下限（72000）。有的商品按斤、片等单位卖，就是这个单位的数量。页面没显示时没有这个字段。 |
| in_stock | 商品当前是否有货（product_search、product_detail）。 |
| shop_id | 店铺 ID（product_search、product_detail）。 |
| shop_name | 店铺名称（product_search、product_detail）。 |
| next_page_token | 翻页游标：同一页每行的值相同，原样作为下一次请求的 page_token 就取下一页，其余参数保持不变；为空或没有这个字段表示没有下一页。能传 page_token 的是 search、user_posts、comments、sub_comments、search_users、hashtag、product_search、pgy_content_square、reviews、followers_list；comments_batch 行上也带这一项，但它本身不收 page_token。 |
| 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": "xiaohongshu",
  "action": "product_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": "xiaohongshu",
        "action": "product_search",
        "params": {
            "keyword": "咖啡",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "xiaohongshu",
  "action": "product_search",
  "results": [
    {
      "id": …,
      "title": …,
      "url": …,
      "price": …,
      "original_price": …,
      "currency": …,
      "image_url": …,
      "sold_count": …,
      "in_stock": …,
      "shop_id": …,
      "shop_name": …,
      "next_page_token": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 商品搜索和笔记搜索有什么区别？

这里搜的是小红书商城的商品（SKU），不是笔记，返回行是商品，带 `price`、`sold_count`、`shop_name` 这类字段。要搜笔记，用小红书的关键词搜索。想只看有货的商品，读完结果后按 `in_stock` 自己过滤，这一页没有对应的筛选参数。

### 搜到的商品怎么读详情？

把结果行的 `id` 当作商品详情的商品 ID 传过去，不用再加工。详情那一页再返回主图、详情长图、规格名和商品参数，店铺评分和累计销量也在那里。

### 翻页时会有重复的商品吗？

会。商城的排序会变，相邻两页偶有几个相同的商品，请按 `id` 去重。拿到的 `next_page_token` 要在 24 小时内传回；每页算一次调用，翻页前先估好要读几页。

## Also

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