Xiaohongshu (RedNote) note comments
The comments Xiaohongshu shows logged-out visitors on a note: the top comments (usually 5), each with its first replies (up to 3), with text, date, likes, IP location, author, pictures and reply count, plus the note's total and top-level comment counts. Further comments are shown to logged-in accounts only, so next_cursor is always null (has_more tells whether more exist). Xiaohongshu only opens a note or profile with the xsec_token that comes with its link (the site adds it to every link it shows: feeds, share links, the url fields of our responses). Pass the whole link as url, or the id with xsec_token.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
url | string | A xiaohongshu.com note link with its xsec_token (explore/<id>?xsec_token=... or discovery/item/<id>?xsec_token=...). Example: https://www.xiaohongshu.com/explore/64a771f3000000002b038d17?xsec_token=ABiZBO7VhFKBtbIJuwS1YLbdbiwijCFcgc10NCFU21BQk=&xsec_source=pc_feed |
note_id | string | Note id (24 hex characters), with xsec_token, instead of url. |
xsec_token | string | The note's xsec_token (from the link), with note_id. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/xiaohongshu/v1/note/comments?url=https%3A%2F%2Fwww.xiaohongshu.com%2Fexplore%2F64a771f3000000002b038d17%3Fxsec_token%3DABiZBO7VhFKBtbIJuwS1YLbdbiwijCFcgc10NCFU21BQk%3D%26xsec_source%3Dpc_feed" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/xiaohongshu/v1/note/comments",
params={"url": "https://www.xiaohongshu.com/explore/64a771f3000000002b038d17?xsec_token=ABiZBO7VhFKBtbIJuwS1YLbdbiwijCFcgc10NCFU21BQk=&xsec_source=pc_feed"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/xiaohongshu/v1/note/comments");
url.searchParams.set("url", "https://www.xiaohongshu.com/explore/64a771f3000000002b038d17?xsec_token=ABiZBO7VhFKBtbIJuwS1YLbdbiwijCFcgc10NCFU21BQk=&xsec_source=pc_feed");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).