# 小红书 用户内容 API (xiaohongshu.user_posts)

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

小红书用户内容按 `user_id` 列出一个账号发布的笔记：标题、正文摘要、封面图、点赞收藏评论分享数和发布时间，视频笔记还带播放地址和时长。它回答「这个博主最近在发什么、哪类内容表现好」，适合做达人筛选、竞品账号监测和投放前的内容核查。

`user_id` 是主页链接 /user/profile/ 后面那串 ID，也可以直接传完整主页链接，或评论、搜索结果里的 `author_id`，不能用昵称。列表里的 `text` 是截断摘要，`url` 不带访问令牌、浏览器里打不开，需要全文或可打开的链接时，用笔记 ID 再调笔记详情。`video_url` 带签名、会过期，要留存请及时下载。和话题内容不同，这里没有排序参数。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| user_id | not declared | yes | not declared | 小红书用户主页 /user/profile/ 后面的用户 ID，或完整用户主页 URL；也可以直接用评论类结果里的 author_id。用于读取该账号资料或其发布的笔记，不是昵称。 |
| page_token | not declared | no | not declared | 翻页游标（comments、sub_comments、search、user_posts、search_users、hashtag）：把上一次返回结果行里的 next_page_token 原样传入就拿下一页；不传从第一页开始。每页算一次调用，按次计费。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在小红书上的链接。search、note、profile、hashtag 返回的链接一般带访问令牌，未登录的浏览器也能打开（令牌有时效，过期后重新调用即可）；user_posts 返回的笔记链接不带令牌，在浏览器里打开需要令牌：用笔记 ID 调 note 能拿到可以打开的链接；search_users 返回的主页链接同样不带令牌，用 user_id 调 profile 拿能打开的链接。pgy_content_square 不带 keyword 时笔记链接带令牌，带 keyword 时不带（用笔记 ID 调 note 拿能打开的链接）。followers_list 返回的是粉丝的主页链接，同样不带令牌；note_location 返回的笔记链接带上了请求里的令牌（请求里没带就没有）。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 笔记正文或评论内容。note、hashtag 返回笔记全文；search、user_posts 返回的笔记正文可能是截断的摘要（分别约 60 字、100 字以内），要全文用笔记 ID 调 note。reviews 是商品评价的全文。 |
| like_count | 点赞数。笔记、评论类结果是这条内容的点赞数；reviews 是这条商品评价被点「有用」的次数；profile 里是该账号所有笔记累计获得的点赞数。null 表示不公开或这次没拿到，不等于 0。 |
| collect_count | 收藏数。笔记类结果是这篇笔记被收藏的次数；profile 里是该账号笔记累计被收藏的次数。null 表示不公开或这次没拿到，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者的用户 ID，可直接传给 profile、user_posts。笔记类结果里是 24 位，与主页链接里的 ID 相同；评论类结果（comments、comments_batch、sub_comments）里多为 29 位的另一种写法。同一个人的两种写法不同，跨批次去重前先用 profile 换成它返回的 user_id。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| author_url | 作者主页链接，不带访问令牌，未登录的浏览器打不开；用 author_id 调 profile 返回的 url 可以直接打开。 |
| is_video | 是否视频笔记。视频播放地址不在详情返回里（2026-10-14 起）：要地址请用同一篇笔记的 url 单独调用 video 接口，按次计费。 |
| next_page_token | 翻页游标：同一页每行的值相同，原样作为下一次请求的 page_token 就取下一页，其余参数保持不变；为空或没有这个字段表示没有下一页。能传 page_token 的是 search、user_posts、comments、sub_comments、search_users、hashtag、product_search、pgy_content_square、reviews、followers_list；comments_batch 行上也带这一项，但它本身不收 page_token。 |
| video_url | 视频播放地址（mp4），带签名、会过期，要留存请及时下载。图文笔记或这次没拿到时为 null。search/user_posts 行与 video 接口返回；note 详情不含（2026-10-14 起要地址请单独调用 video 接口）。 |
| duration_sec | 视频时长，单位秒。图文笔记或这次没拿到时为 null。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| images | 图片链接列表。note、hashtag、search、user_posts 是笔记的全部图片（按原顺序）；评论类结果（comments、comments_batch、sub_comments）是评论所附的图片，含表情包贴图，没有图片时为空数组；reviews 是买家晒的图，没有晒图时为空数组。null 表示这次没拿到这一项。 |
| is_goods_note | 是否带货笔记（search、user_posts）。 |
| is_pinned | 是否作者主页置顶的笔记（user_posts）；置顶笔记排在最前面，按发布时间分析时要排除。 |
| ip_location | 小红书展示的 IP 归属地（省份/国家），平台强制显示，非用户填写。user_posts 只有部分笔记带。 |

## 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": "user_posts",
  "params": {
    "user_id": "5bec178863f51f0001859bd9"
  }
}'
```

```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": "user_posts",
        "params": {
            "user_id": "5bec178863f51f0001859bd9",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-10-24T18:28:34Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "xiaohongshu",
  "action": "user_posts",
  "results": [
    {
      "id": "6ad2ee3d000000001500a406",
      "url": "https://www.xiaohongshu.com/explore/6ad2ee3d000000001500a406",
      "title": "西藏的后劲太大",
      "text": "从西藏回来后总觉得空落落的。\n晚上六点后看马路上行人少了不习惯，保障湖夜里聚着的人群没了，常去的网红S湾也冷冷清清，整个人就像在静静等着冬眠，日子过得格外无聊。\n之前在旅途里虽然身体累，但倒头就能睡，",
      "like_count": 4,
      "collect_count": 0,
      "comment_count": 2,
      "share_count": 0,
      "posted_at": "2026-10-17T03:40:45+00:00",
      "image_url": "https://sns-i27-ae.rednotecdn.com/1040g008326dlp9rr44004bqnt5boh6upnbbi730?imageView2/2/w/576/format/heif/q/58|imageMogr2/strip&redImage/frame/0&ap=12&sc=USR_PRV&sign=8a41040bd29d219271a31b35d28b1710&t=6add009f",
      "author_name": "•••",
      "author_id": "5bec178863f51f0001859bd9",
      "avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_url": "https://www.xiaohongshu.com/user/profile/5bec178863f51f0001859bd9",
      "is_video": true,
      "next_page_token": "n1.6a9801c2000000002902d3f5",
      "video_url": "https://sns-v28-ae.rednotecdn.com/stream/79/110/258/01ead2edf98cd6564f037001a147f2cfc3_258.mp4?sign=3488ebb9d403bf590a06aba3c94581b5&t=6ae19ddf",
      "duration_sec": 12,
      "platform": "xiaohongshu",
      "images": [
        "https://sns-i27-ae.rednotecdn.com/1040g008326dlp9rr44004bqnt5boh6upnbbi730?imageView2/2/w/576/format/heif/q/58|imageMogr2/strip&redImage/frame/0&ap=12&sc=USR_PRV&sign=8a41040bd29d219271a31b35d28b1710&t=6add009f"
      ],
      "is_goods_note": false,
      "is_pinned": false,
      "ip_location": "•••",
      "duration_seconds": 12
    },
    {
      "id": "6acc9f40000000001b02e074",
      "url": "https://www.xiaohongshu.com/explore/6acc9f40000000001b02e074",
      "title": "扬州人冬天都喜欢干啥？",
      "text": "很好奇扬州人的冬天白天都喜欢去哪里玩？晚上又喜欢干什么去哪里玩？#如果冬天有味道[话题]# #扬州人的冬天日常分享[话题]# #冬天的味道[话题]# #冬天的烦恼[话题]# #冬天的样子[话题]#",
      "like_count": 2,
      "collect_count": 0,
      "comment_count": 0,
      "share_count": 0,
      "posted_at": "2026-10-12T08:50:08+00:00",
      "image_url": "https://sns-i27-ae.rednotecdn.com/notes_pre_post/1040g3k83267gk1jm44704bqnt5boh6up9ulnts0?imageView2/2/w/576/format/heif/q/58|imageMogr2/strip&redImage/frame/0&ap=12&sc=USR_PRV&sign=c3cc24a4f64405fdd87eaa5922f49a0e&t=6add009f",
      "author_name": "•••",
      "author_id": "5bec178863f51f0001859bd9",
      "avatar_url": "https://sns-avatar-qc-ae.rednotecdn.com/•••",
      "author_url": "https://www.xiaohongshu.com/user/profile/5bec178863f51f0001859bd9",
      "is_video": false,
      "next_page_token": "n1.6a9801c2000000002902d3f5",
      "video_url": null,
      "duration_sec": null,
      "platform": "xiaohongshu",
      "images": [
        "https://sns-i27-ae.rednotecdn.com/notes_pre_post/1040g3k83267gk1jm44704bqnt5boh6up9ulnts0?imageView2/2/w/576/format/heif/q/58|imageMogr2/strip&redImage/frame/0&ap=12&sc=USR_PRV&sign=c3cc24a4f64405fdd87eaa5922f49a0e&t=6add009f"
      ],
      "is_goods_note": false,
      "is_pinned": false,
      "duration_seconds": null
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `user_id` 从哪里找？

打开博主主页，链接里 /user/profile/ 后面那串 ID 就是；也可以直接传完整主页链接，或者用评论、搜索结果里的 `author_id`。昵称不能用来定位账号。评论结果里的作者 ID 多是 29 位的另一种写法，同样能直接传进来；读到的笔记行里，`author_id` 是 24 位，和主页链接里那串一致，以后存档统一用这个，跨批次去重才对得上。

### 为什么列表里的笔记链接打不开？

用户内容返回的笔记链接不带访问令牌，未登录的浏览器打不开。用笔记 ID 调笔记详情，返回的 `url` 带令牌、可以直接打开，那里也能拿到正文全文。列表里的摘要大约 100 字以内，判断一篇笔记讲什么够用，做文本分析就得补全文。作者主页链接 `author_url` 也不带令牌，用 `author_id` 调主页资料，拿到的链接才能直接打开。`ip_location` 只有部分笔记带，按属地统计时样本不全，要在结论里注明。

### 怎么读完一个账号的全部笔记？

每次返回一页，把响应顶层的 `next_page_token` 作为 `page_token` 传回就拿下一页，直到响应里不再有 `next_page_token` 为止。每一页都算一次调用，笔记多的账号要留意调用次数。每页固定 20 条，最后一页可能更少。读完后先挑出 `is_pinned` 为真的置顶笔记，它们排在最前面，按发布时间分析时要排除；`is_goods_note` 标出带货笔记，可以算这个账号带货内容的占比。

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