100 free credits. No credit card required. Get a key

How to scrape Xiaohongshu user notes with TypeScript

A Xiaohongshu account’s latest notes as its profile shows them: titles, likes, covers, pinned notes.

The examples type the fields they read with an interface taken from the recorded response, and wrap fetch in one typed helper that throws a typed error.

GET /v1/xiaohongshu/user/posts2 credits per callRefunded on failure

Before you start

  1. Get an API keySign up for 100 free credits, no card. Keys start with gs_live_.
  2. Put it in the environmentEvery example reads it from GROUNDSOCIAL_API_KEY: export GROUNDSOCIAL_API_KEY=gs_live_…
  3. Set up TypeScriptnpm init -y && npm pkg set type=module && npm i -D tsx typescript @types/node

Call Xiaohongshu user notes API from TypeScript

GET /v1/xiaohongshu/user/posts. Save this as main.ts and run npx tsx main.ts. It reads the items in data and prints displayTitle and interactInfo.likedCount for each.

main.ts
// The fields this script reads, as the recorded response has them.
interface Page {
  data: {
    displayTitle: string
    interactInfo: {
      likedCount: string
    }
  }[]
}

class ApiError extends Error {
  constructor(
    readonly code: string,
    readonly hint: string,
    readonly retryable: boolean,
  ) {
    super(`${code}: ${hint}`)
  }
}

async function call<T>(path: string, params: Record<string, string> = {}): Promise<T> {
  const url = new URL(path, 'https://api.groundsocial.dev')
  for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v)
  const res = await fetch(url, {
    headers: {
      Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}`,
    },
    signal: AbortSignal.timeout(60_000),
  })
  if (!res.ok) {
    const { error } = (await res.json()) as {
      error: { code: string; message: string; hint?: string; retryable: boolean }
    }
    throw new ApiError(error.code, error.hint ?? error.message, error.retryable)
  }
  return (await res.json()) as T
}

const data = await call<Page>('/v1/xiaohongshu/user/posts', { id: '5ff0e6410000000001008400' })
for (const item of data.data) {
  console.log(item.displayTitle, item.interactInfo?.likedCount)
}

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.

200 OK
{
  "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

FieldTypeDescription
dataXiaohongshuNote[]–
metaobject–

Parameters

NameInTypeDescription
idquerystringThe account id (24 hex characters). Example: 5ff0e6410000000001008400.
urlquerystringOr the profile URL (xiaohongshu.com or rednote.com).
limitqueryintegerNotes per page, 1 to 30. Defaults to 30.
sincequerystringOnly rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01.
untilquerystringOnly 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.

Errors
try {
  const data = await call<Page>('/v1/xiaohongshu/user/posts', { id: '5ff0e6410000000001008400' })
} catch (err) {
  if (!(err instanceof ApiError)) throw err
  if (err.code === 'insufficient_credits') console.error('Top up:', err.hint)
  else if (err.code === 'target_not_found') console.error('Nothing there (not charged).')
  else if (err.retryable) console.error('Try again after Retry-After:', err.hint)
  else throw err
}
StatusMeaning
200The latest notes.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The account does not exist.
429Too many requests. Wait for Retry-After seconds.
503Xiaohongshu is temporarily unavailable. Retryable; nothing was charged.

Every error code and what to do about it.

Pricing

Cost
Per call2 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 callRefunded, 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:

bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp

Then ask for it in words (“A Xiaohongshu account’s latest notes”), or call the tool directly:

json
{
  "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

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.