# Xiaohongshu Comments API (xiaohongshu.comments)

- Canonical page: https://everyinfra.com/en/xiaohongshu-api/comments
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "xiaohongshu", "action": "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 15 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

Xiaohongshu Comments reads the top-level comments under one note, given the note's `url`. Each row carries the comment text, likes, publish time, IP region, the commenter's nickname and Xiaohongshu ID, and how many replies it has. Use it to see what readers say about a note: product feedback, sentiment around a launch, or how a seeding post landed.

Choose the order with `sort` (the platform default, newest or most liked), and pass `next_page_token` back as `page_token` for the next page. `sub_comment_count` gives only the number of replies; read the replies themselves with the Comment replies capability. `is_author` flags comments from the note's author and `author_is_ai_agent` flags accounts the platform marks as AI, so you can set both aside before scoring sentiment.

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | Specifies the full Xiaohongshu note URL, formatted as /explore/<note_id> or /discovery/item/<note_id>. Use recent search URLs that retain query parameters like xsec_token. The sub_comments action requires both this url and a valid comment_id. |
| page_token | not declared | no | not declared | Pagination cursor for the comments, sub_comments, search, user_posts, search_users and hashtag actions: pass back the next_page_token value from a row of the previous response to fetch the next page; omit it to start from the first page. Each page is one call, billed per request. |
| sort | enum: default / most_liked / newest | no | not declared | Comment order: default follows the platform's own order (the same as omitting it), newest puts the latest comments first, and most_liked puts the most-liked first. Keep the same value while paging; with a different value, the previous next_page_token no longer applies. default is the platform's recommended order and is re-ranked on every request, so when rankings shift, paging skips or repeats some comments; newest orders by time and pages consistently, though for some notes the platform returns only the most recent part. A page without next_page_token only means the platform reported no next page, not that every comment has been returned. With default, running through all the pages from the start several times and merging by comment id recovers some of the missed ones. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| text | Note body or comment text. note and hashtag return the full body; search and user_posts may return a truncated excerpt (up to about 60 and 100 characters respectively). Call note with the note ID for the full text. |
| like_count | Like count. On note and comment results, the likes on that item; on profile, the total likes the account's notes have received. null means not public or not returned this time, not zero. |
| posted_at | Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
| ip_location | IP location (province or country) that Xiaohongshu displays; not entered by the user. Only some user_posts rows carry it. |
| author_name | Author's display name. |
| author_id | The author's user ID. Pass it to profile or user_posts. Note results carry the 24-character ID from profile URLs; comment results (comments, comments_batch, sub_comments) usually carry a different 29-character form. The two forms of one person do not match, so convert them with the user_id that profile returns before de-duplicating across batches. |
| sub_comment_count | Number of replies under this comment. |
| note_id | Note ID. Comment capabilities use it to point back to the note. |
| note_url | Link to the note the comment belongs to. |
| next_page_token | Page token (search, comments, sub_comments, user_posts, search_users, hashtag): pass it back unchanged as page_token, with the other parameters the same, to fetch the next page. |
| images | Image links. On note, hashtag, search and user_posts, every image of the note in order. On comment results (comments, comments_batch, sub_comments), the images attached to the comment, stickers included; an empty array means none. null means this item was not returned this time. |
| is_author | Whether the note's author wrote this comment. null means this item was not returned this time, not false. |
| author_avatar_url | The commenter's avatar link (comments, comments_batch, sub_comments). |
| author_red_id | The author's Xiaohongshu ID: on comment results (comments, comments_batch, sub_comments) the commenter's, on note the note author's. |
| author_is_ai_agent | Whether the commenter is an account the platform marks as AI; absent when this item was not returned. |
| mentioned_users | People @-mentioned: on comment results, those mentioned in the comment; on note, those mentioned in the note. Each entry has user_id and nickname. Absent when there are none. |
| comment_tags | platform-native meaning |
| sub_comments | platform-native meaning |
| platform | Source platform identifier, the same as platform in the request (for example 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": "comments",
  "params": {
    "url": "https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D"
  }
}'
```

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

## Response example

Real response to the example request above, captured 2026-10-15T15:16:12Z. `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": "xiaohongshu",
  "action": "comments",
  "results": [
    {
      "id": "6aa80e9b000000000200c6ad",
      "text": "一点不像33平米的  感觉远不止  我住的45平在规划设计下 都很小",
      "like_count": 41,
      "posted_at": "2026-09-14T15:11:23+00:00",
      "author_name": "•••",
      "author_id": "•••",
      "sub_comment_count": 7,
      "note_id": "6aa7a3f600000000110335f8",
      "note_url": "https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D",
      "next_page_token": "n1.6abba9cd000000001001c13b",
      "images": [],
      "is_author": false,
      "author_avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_red_id": "•••",
      "author_is_ai_agent": false,
      "platform": "xiaohongshu"
    },
    {
      "id": "6aa7dbde000000000a027007",
      "text": "房屋原博主有小红书吗",
      "like_count": 5,
      "posted_at": "2026-09-14T11:34:54+00:00",
      "author_name": "•••",
      "author_id": "•••",
      "sub_comment_count": 4,
      "note_id": "6aa7a3f600000000110335f8",
      "note_url": "https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D",
      "next_page_token": "n1.6abba9cd000000001001c13b",
      "images": [],
      "is_author": false,
      "author_avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_red_id": "•••",
      "author_is_ai_agent": false,
      "platform": "xiaohongshu"
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### How do I get the replies under a comment?

This capability returns top-level comments only, and `sub_comment_count` tells you how many replies each has. To read them, call the Comment replies capability with the same note link and the comment's `id`.

### Does paging return every comment?

Not always. With `sort` set to `default` (or left out), the platform re-ranks comments on every request, and the next page can only continue from the last comment of the previous one, so when the ranking shifts some comments are skipped or repeated. `newest` orders by publish time and pages consistently, though some notes return only the most recent part. No `next_page_token` only means the platform reported no next page, not that you have every comment. With `default`, running through all the pages from the start several times and merging by comment `id` recovers some of the missed ones. If you change `sort` midway, start over from page one.

### Can I match commenters to note authors by ID?

Not directly. `author_id` on comment results usually uses a different form from the ID in note results and profile links. Before de-duplicating across batches, look it up with the Xiaohongshu Details capability, which reads the profile and returns one consistent user ID.

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