Xiaohongshu Comments from multiple URLs API
API health
- 24h health
- Normal
- Healthy / normal
- Available
- Limited
- Mostly down
Last 24 hours
Last 30 days
Collect comments from 1 to 20 Xiaohongshu notes in one call. Each row has its note_id and note_url, so threads stay separate. Every link needs a valid note ID and xsec_token. A note that fails is reported as missed, not as having zero comments.
Send POST https://api.everyinfra.com/api/v1/social with platform set to xiaohongshu and action set to comments_batch. Price $5.56 per 1,000 requests ($0.005556 per call). Failed calls and empty results are not charged. Synchronous only: everything it returns (every target of a batch, or every SKU of a product) is read within this call, and "mode": "async" returns a 422 before any charge.
AI prompt
#Please help me write a data collection script with the EveryInfra Xiaohongshu Comments from multiple URLs endpoint (xiaohongshu/comments_batch).
How the endpoint works:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to xiaohongshu and action to comments_batch, and put the parameters inside params.
- Required parameters:
- urls: Specifies an array of 1 to 20 Xiaohongshu note URLs for the comments_batch action. Each URL must contain a valid note ID and an xsec_token. Billing is per target note.
- Optional parameters:
- sort: Comment order for every note in the request: 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. (allowed: default / most_liked / newest)
- Returns a list of records. Main fields of each record: id, text (Note body or comment text), like_count (Like count), posted_at, ip_location (IP location (province or country) that…), author_name, author_id (The author's user ID), sub_comment_count (Number of replies under this comment), note_id (Note ID), note_url (Link to the note the comment belongs to), next_page_token (Page token (search, comments, sub_comme…), images (Image links); 19 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=xiaohongshu.
- Example request body:
{
"platform": "xiaohongshu",
"action": "comments_batch",
"params": {
"urls": [
"https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D"
]
}
}
- Price: $5.56 per 1,000 requests; failed and empty results are not charged.
- This endpoint runs synchronously only; do not add "mode": "async" to the body.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.
Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.Request parameters
#| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | header | string | Yes | - | Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository. |
platform | body | string | Yes | xiaohongshu | Platform identifier, fixed value. |
action | body | string | Yes | comments_batch | Capability identifier, fixed value. |
urls | body.params | array | Yes | - | Specifies an array of 1 to 20 Xiaohongshu note URLs for the comments_batch action. Each URL must contain a valid note ID and an xsec_token. Billing is per target note; check partial or missed response fields if some notes fail rather than assuming zero comments exist. |
sort | body.params | string (enum) | No | - | Comment order for every note in the request: 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.Allowed valuesdefaultmost_likednewest |
Code samples
#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_batch",
"params": {
"urls": [
"https://www.xiaohongshu.com/explore/6aa7a3f600000000110335f8?xsec_token=YByFNzoKupps8B3qI774Gx7XGxfHpq4QWEvxU4zsD8454%3D"
]
}
}'OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.
Response example
#{ "id": "req_…", "platform": "xiaohongshu", "action": "comments_batch", "results": [ { "id": …, "text": …, "like_count": …, "posted_at": …, "ip_location": …, "author_name": …, "author_id": …, "sub_comment_count": …, "note_id": …, "note_url": …, "next_page_token": …, "images": …, "is_author": …, "author_avatar_url": …, "author_red_id": …, "author_is_ai_agent": …, "mentioned_users": …, "comment_tags": …, "sub_comments": …, "platform": … } ], "count": …, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
Response fields
#Business data is in results. The table lists the fields a record can contain; values the platform does not show are never made up.
| 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 | Keeps the platform's own meaning |
sub_comments | Keeps the platform's own meaning |
platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Errors and billing
#- 401
- Missing or invalid key.
- 402
- Insufficient balance. Top up first.
- 422
- Invalid parameter name or value. Fix it using the suggestions in the error. No charge.
- 429
- Per-minute request limit reached. Wait for Retry-After, then try again.
- 503
- Could not complete. The held charge is returned to your balance. If the outcome is unknown, verify it before you retry.
- 200 empty
- No data. No charge.