# 小红书 评论回复 API (xiaohongshu.sub_comments)

- Canonical page: https://everyinfra.com/xiaohongshu-api/sub_comments
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "xiaohongshu", "action": "sub_comments", "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 10 per call (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page)
- 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

小红书评论回复展开某一条评论底下的楼中楼：笔记链接 `url` 和这条评论的 `comment_id` 两样都要给。每行是一条回复，有回复内容、赞数、时间、属地和回复者，独有的三列是 `reply_to_id`、`reply_to_author_name` 和 `reply_to_author_id`，说明这条回复是冲着谁去的。它回答「这条评论底下在聊什么、谁在回谁」，适合把追问和争论整理成对话树。

`comment_id` 来自评论那一页的结果行，就是那一行的 `id`；它不是笔记 ID，也不是评论作者的 ID。`reply_to_author_id` 和 `author_id` 是同一种评论类写法，多为 29 位，两者可以直接比对，看出谁和谁在来回争论。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 小红书笔记完整链接，路径为 /explore/<笔记ID> 或 /discovery/item/<笔记ID>；优先使用近期搜索结果中的完整 URL，保留 xsec_token 等查询参数。sub_comments 还需同一笔记下的 comment_id。 |
| comment_id | not declared | yes | not declared | 要展开回复的父评论 ID；从同一篇笔记的 comments 返回结果取得，并与 url 配对。不是笔记 ID，也不是评论作者 ID。 |
| page_token | not declared | no | not declared | 翻页游标（comments、sub_comments、search、user_posts、search_users、hashtag）：把上一次返回结果行里的 next_page_token 原样传入就拿下一页；不传从第一页开始。每页算一次调用，按次计费。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| text | 笔记正文或评论内容。note、hashtag 返回笔记全文；search、user_posts 返回的笔记正文可能是截断的摘要（分别约 60 字、100 字以内），要全文用笔记 ID 调 note。reviews 是商品评价的全文。 |
| like_count | 点赞数。笔记、评论类结果是这条内容的点赞数；reviews 是这条商品评价被点「有用」的次数；profile 里是该账号所有笔记累计获得的点赞数。null 表示不公开或这次没拿到，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| ip_location | 小红书展示的 IP 归属地（省份/国家），平台强制显示，非用户填写。user_posts 只有部分笔记带。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者的用户 ID，可直接传给 profile、user_posts。笔记类结果里是 24 位，与主页链接里的 ID 相同；评论类结果（comments、comments_batch、sub_comments）里多为 29 位的另一种写法。同一个人的两种写法不同，跨批次去重前先用 profile 换成它返回的 user_id。 |
| reply_to_id | 被回复的评论 ID，楼中楼里用来重建对话树。 |
| reply_to_author_name | 被回复人的昵称（sub_comments）。 |
| reply_to_author_id | 被回复人的用户 ID（sub_comments），与 author_id 同为评论类结果里的写法。 |
| 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。 |
| images | 图片链接列表。note、hashtag、search、user_posts 是笔记的全部图片（按原顺序）；评论类结果（comments、comments_batch、sub_comments）是评论所附的图片，含表情包贴图，没有图片时为空数组；reviews 是买家晒的图，没有晒图时为空数组。null 表示这次没拿到这一项。 |
| is_author | 这条评论是不是笔记作者本人写的。null 表示这次没拿到这一项，不等于 false。 |
| author_avatar_url | 评论者的头像链接（comments、comments_batch、sub_comments）。 |
| author_red_id | 作者的小红书号：评论类结果（comments、comments_batch、sub_comments）是评论者的，note、search 是笔记作者的。 |
| author_is_ai_agent | 评论者是不是平台标记的 AI 账号；这次没拿到这一项时没有这个字段。 |
| mentioned_users | 被 @ 的人：评论类结果是评论里 @ 的人，note 是笔记里 @ 的人；每项有 user_id、nickname。没有时没有这个字段。 |
| comment_tags | 评论标签（comments、comments_batch、sub_comments），每项 type（is_author 作者、note_first 首评、user_top 置顶、product_review 商品评价等）与 text（展示文字，可能是中文或英文）；没有标签时为空数组。 |
| 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": "sub_comments",
  "params": {
    "url": "https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D",
    "comment_id": "6aa80e9b000000000200c6ad"
  }
}'
```

```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": "sub_comments",
        "params": {
            "url": "https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D",
            "comment_id": "6aa80e9b000000000200c6ad",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

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

```text
{
  "id": "req_…",
  "platform": "xiaohongshu",
  "action": "sub_comments",
  "results": [
    {
      "id": "6aaa0e53000000000b01276f",
      "text": "卫生间一个浴缸至少1米，然后一个盥洗盆至少一米，加上卫生间门向内打开，还留了几十公分，加上门至少3米了，宽度一个浴缸加上两个过道还有一个马桶，加上墙体的厚度，至少五六平了。客厅长度和宽度至少有二三十平。如果加上公摊，建筑面积在60平。",
      "like_count": 11,
      "posted_at": "2026-09-16T03:34:44+00:00",
      "author_name": "依•••亦",
      "author_id": "•••",
      "reply_to_id": "6aa80e9b000000000200c6ad",
      "reply_to_author_name": "小•••鱼",
      "reply_to_author_id": "•••",
      "next_page_token": "n1.6aaa68c700000000150010fb",
      "images": [],
      "is_author": false,
      "author_avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_red_id": "•••",
      "author_is_ai_agent": false,
      "comment_tags": [],
      "platform": "xiaohongshu"
    },
    {
      "id": "6aaa1eb000000000150141c3",
      "text": "这种看看得了，还当真[偷笑R]",
      "like_count": 3,
      "posted_at": "2026-09-16T04:44:32+00:00",
      "author_name": "小•••D",
      "author_id": "•••",
      "reply_to_id": "6aaa0e53000000000b01276f",
      "reply_to_author_name": "依•••亦",
      "reply_to_author_id": "•••",
      "next_page_token": "n1.6aaa68c700000000150010fb",
      "images": [],
      "is_author": false,
      "author_avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_red_id": "•••",
      "author_is_ai_agent": false,
      "comment_tags": [],
      "platform": "xiaohongshu"
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 5,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `comment_id` 从哪里来？

从同一篇笔记的评论结果里取，结果行的 `id` 就是 `comment_id`，传的时候和这篇笔记的 `url` 配成一对，换了笔记链接就要换评论 ID。示例里选的是回复数大于 0 的评论；回复数为 0 的评论没有可展开的内容，调用前先按回复数筛一遍。

### 怎么把回复还原成对话？

看 `reply_to_id`，它是被回复的评论 ID，按它把回复挂回去，就得到楼中楼的对话树。`reply_to_author_name` 直接给出被回复人的昵称，不用再回头去查。回复里被 @ 的人在 `mentioned_users`，每项带用户 ID 和昵称，没人被 @ 时没有这个字段。

### 评论回复和评论那一页每页条数一样吗？

不一样。评论回复每页固定 10 条，最后一页可能更少，`limit` 照收但不起作用；评论那一页每页 15 条。`next_page_token` 为空或没有这个字段，说明这条评论下的回复读完了。评论回复也没有排序参数，评论那一页能按最新或点赞排序，这里只能按平台给的顺序逐页读完，要按时间排就用 `posted_at` 自己排。

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