Before you start
- Get an API keySign up for 100 free credits, no card. Keys start with
gs_live_. - Put it in the environmentEvery example reads it from
GROUNDSOCIAL_API_KEY:export GROUNDSOCIAL_API_KEY=gs_live_… - Set up PHP
php -m | grep curl # the curl extension ships with most PHP builds
Call Xiaohongshu user notes API from PHP
GET /v1/xiaohongshu/user/posts. Save this as main.php and run php main.php. It reads the items in data and prints displayTitle and interactInfo.likedCount for each.
<?php
function groundsocial(string $path, array $params = []): array
{
$url = 'https://api.groundsocial.dev' . $path . ($params ? '?' . http_build_query($params) : '');
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('GROUNDSOCIAL_API_KEY')],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
$data = json_decode($raw, true);
if ($status !== 200) {
$e = $data['error'];
throw new RuntimeException($e['code'] . ': ' . ($e['hint'] ?? $e['message']));
}
return $data;
}
$data = groundsocial('/v1/xiaohongshu/user/posts', ['id' => '5ff0e6410000000001008400']);
foreach ($data['data'] as $item) {
echo $item['displayTitle'] ?? '', ' ', $item['interactInfo']['likedCount'] ?? '', PHP_EOL;
}The response
A real Xiaohongshu response to this call, recorded from the live source and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 5 items in data. Live calls return current data in the same shape.
{
"data": [
{
"noteId": "",
"type": "video",
"displayTitle": "好喜欢这套 休闲帅气~",
"time": 1758014155000,
"user": {
"userId": "5ff0e6410000000001008400",
"nickname": "小王不爱睡",
"nickName": "小王不爱睡",
"avatar": "https://sns-avatar-qc.rednotecdn.com/avatar/61b1d83dc6f75a2f6b7215fa.jpg"
},
"interactInfo": {
"likedCount": "32",
"sticky": false,
"liked": false
},
"cover": {
"url": "",
"traceId": "",
"infoList": [
{
"imageScene": "WB_PRV",
"url": "http://sns-web-i10.rednotecdn.com/202611251029/ca1c4f5cedc179418177b77f6570343d/1040g00831mg4m13cli7g5nvgsp0g9100mel8m8o…"
},
{
"imageScene": "WB_DFT",
"url": "http://sns-web-i10.rednotecdn.com/202611251029/bbafe997894468558dd32d036d600d54/1040g00831mg4m13cli7g5nvgsp0g9100mel8m8o…"
}
],
"urlPre": "http://sns-web-i10.rednotecdn.com/202611251029/ca1c4f5cedc179418177b77f6570343d/1040g00831mg4m13cli7g5nvgsp0g9100mel8m8o…",
"urlDefault": "http://sns-web-i10.rednotecdn.com/202611251029/bbafe997894468558dd32d036d600d54/1040g00831mg4m13cli7g5nvgsp0g9100mel8m8o…",
"fileId": "",
"height": 1440,
"width": 1080
},
"xsecToken": "ABhu_Cqz8_LewlXka4tu0shQoDhOeSAXIEhiuBC1qij2c=",
"noteTranslation": {
"displayTitleTrans": "Love this set, casual and handsome~",
"imageTransList": [
{
"imageIndex": 0,
"needTranslation": true,
"translatedUrl": "https://sns-translate-i11.rednotecdn.com/cloudrender-translate/bfe01203-6e2b-4bf9-9021-5df5282d1867.jpg!1080jpg?ap=25&sc…"
}
],
"displayTitleLanguage": "zh_cn"
}
},
{
"noteId": "",
"type": "video",
"displayTitle": "条纹衬衫配牛仔裤真的好帅!!",
"time": 1756623126000,
"user": {
"userId": "5ff0e6410000000001008400",
"nickname": "小王不爱睡",
"nickName": "小王不爱睡",
"avatar": "https://sns-avatar-qc.rednotecdn.com/avatar/61b1d83dc6f75a2f6b7215fa.jpg"
},
"interactInfo": {
"likedCount": "56",
"sticky": false,
"liked": false
},
"cover": {
"urlPre": "http://sns-web-i10.rednotecdn.com/202611251029/21e373e9fe9bf9d29174fe15a4814250/1040g00831lrddi65li005nvgsp0g91008sdru18…",
"urlDefault": "http://sns-web-i10.rednotecdn.com/202611251029/14fa063b5100ae24f7eef48aec321986/1040g00831lrddi65li005nvgsp0g91008sdru18…",
"fileId": "",
"height": 1440,
"width": 1080,
"url": "",
"traceId": "",
"infoList": [
{
"imageScene": "WB_PRV",
"url": "http://sns-web-i10.rednotecdn.com/202611251029/21e373e9fe9bf9d29174fe15a4814250/1040g00831lrddi65li005nvgsp0g91008sdru18…"
},
{
"imageScene": "WB_DFT",
"url": "http://sns-web-i10.rednotecdn.com/202611251029/14fa063b5100ae24f7eef48aec321986/1040g00831lrddi65li005nvgsp0g91008sdru18…"
}
]
},
"xsecToken": "ABhu_Cqz8_LewlXka4tu0shQoDhOeSAXIEhiuBC1qij2c=",
"noteTranslation": {
"imageTransList": [
{
"imageIndex": 0,
"needTranslation": false
}
],
"displayTitleLanguage": "zh_cn",
"displayTitleTrans": "Striped shirts with jeans look really ha"
}
},
"… 3 more"
],
"meta": {
"result_count": 5,
"has_more": true
}
}Top-level fields
| Field | Type | Description |
|---|---|---|
data | XiaohongshuNote[] | – |
meta | object | – |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | query | string | The account id (24 hex characters). Example: 5ff0e6410000000001008400. |
url | query | string | Or the profile URL (xiaohongshu.com or rednote.com). |
limit | query | integer | Notes per page, 1 to 30. Defaults to 30. |
since | query | string | Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01. |
until | query | string | Only rows published on or before this date: YYYY-MM-DD (that whole UTC day) or an ISO 8601 timestamp. Example: 2026-12-31. |
Errors and retries
Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.
try {
$data = groundsocial('/v1/xiaohongshu/user/posts', ['id' => '5ff0e6410000000001008400']);
} catch (RuntimeException $e) {
// "code: hint", e.g. "target_not_found: ..." (never charged).
fwrite(STDERR, $e->getMessage() . PHP_EOL);
exit(1);
}| Status | Meaning |
|---|---|
200 | The latest notes. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The account does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Xiaohongshu is temporarily unavailable. Retryable; nothing was charged. |
Every error code and what to do about it.
Pricing
| Cost | |
|---|---|
| Per call | 2 credits per call |
| 1,000 calls | $2.00 on the starter pack, $0.80 at volume |
| No key (MPP or x402) | $0.02 per call |
| Failed call | Refunded, never charged |
Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.
From an AI agent (MCP)
The same call is the xiaohongshu_user_posts tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcpThen ask for it in words (“A Xiaohongshu account’s latest notes”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "xiaohongshu_user_posts",
"arguments": {
"id": "5ff0e6410000000001008400"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
See what a creator posts
Read titles and likedCount.
Questions
Is it paged?
No: the guest profile shows the latest 30.
Keep going
- This call in Python, JavaScript, TypeScript, Go, cURL.
- Xiaohongshu user notes API reference: every field and status code.
- Xiaohongshu tutorials and all PHP tutorials.
- Xiaohongshu API: every endpoint and price.
- How to scrape Xiaohongshu explore feed with PHP: Xiaohongshu’s explore feed for guests.
- How to scrape Xiaohongshu profile with PHP: A Xiaohongshu profile: bio, followers, likes and saves.
Run it on your own data
One key for Xiaohongshu and 76 more platforms, over REST or MCP. Free credits on signup, no card.
Xiaohongshu is a trademark of Xingyin Information Technology. We are not affiliated with or endorsed by Xingyin Information Technology.