---
title: "Posts"
description: "获取小红书的发现页推荐：当前推荐的笔记及其作者、封面和点赞数。"
---

> Every apinoa docs page as markdown: https://apinoa.com/llms.txt (all in one file: https://apinoa.com/llms-full.txt; this API family in one file: https://apinoa.com/docs/social/llms.txt)

```http
GET | POST /v1/xiaohongshu/posts
```

参数可以用 `GET` 的查询字符串发送，也可以用 `POST` 的 JSON 请求体发送，两者等价。

## 请求

```bash tab="cURL"
curl "https://gateway.apinoa.com/v1/xiaohongshu/posts" \
  -H "x-api-key: $APINOA_API_KEY"
```

```js tab="JavaScript"
const res = await fetch("https://gateway.apinoa.com/v1/xiaohongshu/posts", {
  headers: { "x-api-key": process.env.APINOA_API_KEY },
});
const { success, data, error } = await res.json();
```

```python tab="Python"
import os

import requests

res = requests.get(
    "https://gateway.apinoa.com/v1/xiaohongshu/posts",
    headers={"x-api-key": os.environ["APINOA_API_KEY"]},
)
body = res.json()
```

## 传入内容

| 传入 | 读取内容 | 说明 |
|---|---|---|
| 不传 | 发现页 | 小红书当前向访客推荐的笔记，约 30 条 |

## 参数

| Parameter | Type | Required | Notes |
|---|---|---|---|
| `username` | string |  | Not served: the profile page lists a creator's posts without their ids. Ask `profile`, whose `ext.posts` lists them. |

The same parameters, and every response type, are in the OpenAPI document: https://apinoa.com/openapi.json

## 响应

在 `data` 中返回 [`Post`](/docs/api-reference/sns/response-schema#post) 的 [`Page`](/docs/api-reference/sns/response-schema#page)。 真实响应的节选：数组只保留前几项，长文本已截断。

```json
{
  "success": true,
  "data": {
    "platform": "xiaohongshu",
    "items": [
      {
        "platform": "xiaohongshu",
        "id": "6a730db50000000033011c29",
        "url": "https://www.xiaohongshu.com/explore/6a730db50000000033011c29",
        "author": {
          "platform": "xiaohongshu",
          "id": "641305180000000012012c22",
          "displayName": "干完这票就碎觉",
          "url": "https://www.xiaohongshu.com/user/profile/641305180000000012012c22",
          "avatarUrl": "https://sns-avatar-qc.rednotecdn.com/avatar/1040g2jo31pnjhj14kk005p0j0kc4ib12…",
          "ext": {
            "xsecToken": "AByHSjvm2GViDK9ORqlP8Vshbv1Tg0fd5xEEEy03JJo2k="
          }
        },
        "title": "share🫧两位数get的波点草莓刘海梳！ꈍᗜꈍ",
        "ext": {
          "type": "video",
          "cover": {
            "type": "image",
            "url": "http://sns-web-i10.rednotecdn.com/202611270748/e56035417575c2c5e7743851c3a996…",
            "width": 1290,
            "height": 1720,
            "thumbnailUrl": "http://sns-web-i10.rednotecdn.com/202611270748/ce04d5acb7f45ca2386e7ff4064f3a…",
            "variants": [
              {
                "url": "http://sns-web-i10.rednotecdn.com/202611270748/ce04d5acb7f45ca2386e7ff4064f3a…",
                "quality": "WB_PRV"
              },
              {
                "url": "http://sns-web-i10.rednotecdn.com/202611270748/e56035417575c2c5e7743851c3a996…",
                "quality": "WB_DFT"
              }
            ]
          },
          "videoDurationSec": 32,
          "metricsText": {
            "likes": "28.9K"
          },
          "translation": {
            "title": "share🫧Got this polka dot strawberry com"
          },
          "xsecToken": "ABnB-G86g96Km7WPUmitMAA99VGEbK1DDT-jTUeQI2msg="
        },
        "media": []
      },
      {
        "platform": "xiaohongshu",
        "id": "6ae89201000000002c01a61f",
        "url": "https://www.xiaohongshu.com/explore/6ae89201000000002c01a61f",
        "author": {
          "platform": "xiaohongshu",
          "id": "5746e9ea84edcd0e83e3f956",
          "displayName": "琛宝的精致小厨房",
          "url": "https://www.xiaohongshu.com/user/profile/5746e9ea84edcd0e83e3f956",
          "avatarUrl": "https://sns-avatar-qc.rednotecdn.com/avatar/1040g2jo322ipun667u0048cmtvkuluam…",
          "ext": {
            "xsecToken": "ABN3EoBxnINmkfELcjl2HIomAPJUHpWRzUgxLNhst-huo="
          }
        },
        "title": "在家自制宝宝火腿肠！巨香！巨好吃！",
        "metrics": {
          "likes": 320
        },
        "ext": {
          "type": "video",
          "cover": {
            "type": "image",
            "url": "http://sns-web-i10.rednotecdn.com/202611270748/13e65727db9498a360f057f3f6247a…",
            "width": 2880,
            "height": 3840,
            "thumbnailUrl": "http://sns-web-i10.rednotecdn.com/202611270748/14240279651d9e5f8292df0b6e6c8c…",
            "variants": [
              {
                "url": "http://sns-web-i10.rednotecdn.com/202611270748/14240279651d9e5f8292df0b6e6c8c…",
                "quality": "WB_PRV"
              },
              {
                "url": "http://sns-web-i10.rednotecdn.com/202611270748/13e65727db9498a360f057f3f6247a…",
                "quality": "WB_DFT"
              }
            ]
          },
          "videoDurationSec": 49,
          "translation": {
            "title": "DIY Baby Ham Sausages at Home! So fragra"
          },
          "xsecToken": "ABlGmzOS3GInWUNbvuM4MkcN__A92ZATOkBP30l-4SxhA="
        },
        "media": []
      }
    ]
  }
}
```

## 错误

| 状态 | 代码 | 含义 |
|---|---|---|
| 400 | `INVALID_PARAMS` | 参数缺失、未知或超出范围。消息中会指出是哪一个。 |
| 401 | `UNAUTHORIZED` | 缺少 `x-api-key` 请求头，或密钥已吊销或未知。 |
| 402 | `INSUFFICIENT_CREDITS` | 积分不足以支付本次调用。请在控制台选择套餐或充值。 |
| 404 | `NOT_FOUND` | 账号、帖子或分组不存在，或为私密、已删除、有年龄限制。 |
| 429 | `MARKETPLACE_SATURATED` | 并发调用过多。请等待 `Retry-After` 秒后重试。 |
| 502 | `UPSTREAM_ERROR` | 平台返回了无法使用的内容。请退避后重试。 |

全部错误代码见 [Errors](/docs/errors)。失败的调用不计费。

## 价格

**Price** 1 credit per call. [Plans and credits](https://apinoa.com/en/pricing).

## 说明

- 每条笔记与发现页显示的一致：标题、作者、封面（`ext.cover`）和点赞数。正文和媒体请用 [`post`](/docs/api-reference/xiaohongshu/post) 获取。
- 发现页只有一页，没有 `cursor`。
- 不提供某个账号的笔记列表：小红书列出它们时不给 id。[`profile`](/docs/api-reference/xiaohongshu/profile) 会在 `ext.posts` 中以预览形式返回。
