# 小红书 话题内容 API (xiaohongshu.hashtag)

- Canonical page: https://everyinfra.com/xiaohongshu-api/hashtag
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "xiaohongshu", "action": "hashtag", "params": {...}}
- Price: $0.005556 per call ($5.56 per 1,000 requests); failed calls 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

小红书话题内容按 `topic_id` 读一个话题页下的笔记，每行是一篇笔记：标题、正文全文、图片、点赞收藏评论分享数、发布时间和作者。它回答「这个话题下大家在发什么、哪些笔记火」，适合围绕话题选题、看品牌话题的声量，或者挖出常发这类内容的博主。

`topic_id` 是 24 位的话题页 ID，不是话题名称。`sort` 不传时按 `newest` 排，最新发的笔记在前，适合盯话题的新动向；传 `popular` 则最热的在前，适合找热门笔记做参考。翻页途中别换取值。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| topic_id | not declared | yes | not declared | hashtag 的话题页 ID（24 位），或话题页链接（https://www.xiaohongshu.com/page/topics/<ID>、App 话题链接、小红书分享短链）。可以直接用 note 返回的 topics[].topic_id；注意不是笔记标签对象自己的 id，也不是话题名称。 |
| page_token | not declared | no | not declared | 翻页游标（comments、sub_comments、search、user_posts、search_users、hashtag）：把上一次返回结果行里的 next_page_token 原样传入就拿下一页；不传从第一页开始。每页算一次调用，按次计费。 |
| sort | enum: newest / popular | no | not declared | 话题页笔记的排序：newest 最新在前（不传时同此）、popular 最热在前。翻页时保持同一个取值。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| 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 返回的笔记链接带上了请求里的令牌（请求里没带就没有）。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 笔记正文或评论内容。note、hashtag 返回笔记全文；search、user_posts 返回的笔记正文可能是截断的摘要（分别约 60 字、100 字以内），要全文用笔记 ID 调 note。reviews 是商品评价的全文。 |
| like_count | 点赞数。笔记、评论类结果是这条内容的点赞数；reviews 是这条商品评价被点「有用」的次数；profile 里是该账号所有笔记累计获得的点赞数。null 表示不公开或这次没拿到，不等于 0。 |
| collect_count | 收藏数。笔记类结果是这篇笔记被收藏的次数；profile 里是该账号笔记累计被收藏的次数。null 表示不公开或这次没拿到，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者的用户 ID，可直接传给 profile、user_posts。笔记类结果里是 24 位，与主页链接里的 ID 相同；评论类结果（comments、comments_batch、sub_comments）里多为 29 位的另一种写法。同一个人的两种写法不同，跨批次去重前先用 profile 换成它返回的 user_id。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| author_url | 作者主页链接，不带访问令牌，未登录的浏览器打不开；用 author_id 调 profile 返回的 url 可以直接打开。 |
| is_video | 是否视频笔记。视频播放地址不在详情返回里（2026-10-14 起）：要地址请用同一篇笔记的 url 单独调用 video 接口，按次计费。 |
| 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。 |
| video_url | 视频播放地址（mp4），带签名、会过期，要留存请及时下载。图文笔记或这次没拿到时为 null。search/user_posts 行与 video 接口返回；note 详情不含（2026-10-14 起要地址请单独调用 video 接口）。 |
| duration_sec | 视频时长，单位秒。图文笔记或这次没拿到时为 null。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| images | 图片链接列表。note、hashtag、search、user_posts 是笔记的全部图片（按原顺序）；评论类结果（comments、comments_batch、sub_comments）是评论所附的图片，含表情包贴图，没有图片时为空数组；reviews 是买家晒的图，没有晒图时为空数组。null 表示这次没拿到这一项。 |

## 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": "hashtag",
  "params": {
    "topic_id": "5be3ef92a514290001a15147"
  }
}'
```

```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": "hashtag",
        "params": {
            "topic_id": "5be3ef92a514290001a15147",
        },
    },
    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 18. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "xiaohongshu",
  "action": "hashtag",
  "results": [
    {
      "id": "6adcf9ce000000002a02aa53",
      "url": "https://www.xiaohongshu.com/explore/6adcf9ce000000002a02aa53?xsec_token=FBguhMknWemCgqYU8sbFRwAQQTt1uvZ-Fdz-Fi4p9ejxw%3D",
      "title": "提拉米苏",
      "text": "#星巴克[话题]# #提拉米苏[话题]# #贝果三明治[话题]#",
      "like_count": 0,
      "collect_count": 0,
      "comment_count": 0,
      "share_count": 0,
      "posted_at": "2026-10-24T18:32:47+00:00",
      "image_url": "https://sns-na-i2.xhscdn.com/1040g008326nfm9r5lq5g5pe4smi4alonjl0mrhg?imageView2/2/w/608/format/heif/q/56|imageMogr2/strip&redImage/frame/0/enhance/4&ap=22&sc=LF_PRV&sign=c51ee6a96b89f340c8ec4ad13fda0469&t=6add00a2",
      "author_name": "•••",
      "author_id": "•••",
      "avatar_url": "https://sns-avatar-qc.xhscdn.com/•••",
      "author_url": "https://www.xiaohongshu.com/•••",
      "is_video": false,
      "next_page_token": "n1.tWzE3OTI4NjIyOTAwMDAsIjZhZGNlODUyMDAwMDAwMDAyNTAyMjAyYyIsIkxZRG03V3VzM1ByV3JDZHNxTEtGb3ciXQ",
      "video_url": null,
      "duration_sec": null,
      "platform": "xiaohongshu",
      "images": [
        "https://sns-na-i2.xhscdn.com/1040g008326nfm9r5lq5g5pe4smi4alonjl0mrhg?imageView2/2/w/608/format/heif/q/56|imageMogr2/strip&redImage/frame/0/enhance/4&ap=22&sc=LF_PRV&sign=c51ee6a96b89f340c8ec4ad13fda0469&t=6add00a2",
        "https://sns-na-i2.xhscdn.com/1040g008326nfm9r5lq3g5pe4smi4alon85o1dog?imageView2/2/w/540/format/webp|imageMogr2/strip&redImage/frame/0"
      ],
      "duration_seconds": null
    },
    {
      "id": "6adcf8b3000000002a02a99b",
      "url": "https://www.xiaohongshu.com/explore/6adcf8b3000000002a02a99b?xsec_token=FBguhMknWemCgqYU8sbFRwARusWG8xYkzW1rDs95JQxQk%3D",
      "title": "",
      "text": "一顆心，只為你。#安乾镐[话题]# #keonho[话题]# #营业图[话题]# #星巴克[话题]# #热点[话题]#",
      "like_count": 3,
      "collect_count": 0,
      "comment_count": 0,
      "share_count": 0,
      "posted_at": "2026-10-24T18:28:03+00:00",
      "image_url": "https://sns-na-i2.xhscdn.com/notes_pre_post/1040g3k0326nfehtr5q105q92os8tp6j1dn10jko?imageView2/2/w/608/format/heif/q/56|imageMogr2/strip&redImage/frame/0/enhance/4&ap=22&sc=LF_PRV&sign=bd0e8a7248ede2cf3b3bc3f1a97ed2bd&t=6add00a2",
      "author_name": "•••",
      "author_id": "•••",
      "avatar_url": "https://sns-avatar-qc.xhscdn.com/•••",
      "author_url": "https://www.xiaohongshu.com/•••",
      "is_video": false,
      "next_page_token": "n1.tWzE3OTI4NjIyOTAwMDAsIjZhZGNlODUyMDAwMDAwMDAyNTAyMjAyYyIsIkxZRG03V3VzM1ByV3JDZHNxTEtGb3ciXQ",
      "video_url": null,
      "duration_sec": null,
      "platform": "xiaohongshu",
      "images": [
        "https://sns-na-i2.xhscdn.com/notes_pre_post/1040g3k0326nfehtr5q105q92os8tp6j1dn10jko?imageView2/2/w/608/format/heif/q/56|imageMogr2/strip&redImage/frame/0/enhance/4&ap=22&sc=LF_PRV&sign=bd0e8a7248ede2cf3b3bc3f1a97ed2bd&t=6add00a2",
        "https://sns-na-i2.xhscdn.com/notes_pre_post/1040g3k0326nfehtr5q1g5q92os8tp6j1l2aufco?imageView2/2/w/540/format/webp|imageMogr2/strip&redImage/frame/0"
      ],
      "duration_seconds": null
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 18,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `topic_id` 应该从哪里拿？

最省事的是先读一篇带这个话题的笔记，笔记详情返回的话题列表里每项都有话题 ID，原样传进来即可。手边只有话题页时，复制它的链接也行，格式是 https://www.xiaohongshu.com/page/topics/<ID>，App 话题链接和分享短链同样收。直接填 #话题名 的文字读不到，标签对象自带的那个 id 也不对。

### 为什么某一页不到 20 条，后面却还有？

因为话题页每页条数不固定，最多 20 条，短页不代表到底。判断读完只看一件事：响应里还有没有 `next_page_token`，没有才是最后一页。按条数判断会提前停下；每读一页都算一次调用，热门话题笔记多，先定好要读几页再开始。

### 话题内容和用户内容怎么配合？

先用话题内容找人，再用用户内容看人。话题里每篇笔记带 `author_id`，是笔记类结果的 24 位写法，可以直接传给用户内容，读这位作者的全部笔记，看他是不是长期发这类内容。两边的正文也不一样：这里的 `text` 是全文，用户内容给的是截断摘要；`url` 这里一般带访问令牌，未登录也能打开，令牌过期就重新调一次。

## 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
