# Xiaohongshu-V2/小红书V2 - 搜索笔记

所属目录：Xiaohongshu-V2/小红书V2

文档地址：https://doc.getoneapi.com/434896650e0

`POST https://api.getoneapi.com/api/xiaohongshu-v2/search_notes`

## 鉴权

在请求头中传递 Authorization: Bearer YOUR_API_KEY（必填）

## 请求参数

### Header 参数

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| Authorization | string | 是 | 在 Header 添加参数 Authorization，其值为在 Bearer 之后拼接 apikey<br><br>默认值： Bearer YOUR_API_KEY |
| Content-Type | string | 是 | 默认值： application/json |

### Body 参数 · application/json

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| keyword | string | 是 | 关键词<br> |
| page | number | 是 | 页数<br>从1开始<br><br>默认值： 1 |
| sort_type | enum&lt;string&gt; | 是 | 排序<br>枚举值： general  综合 默认<br>time_descending 最新 按时间倒序<br>popularity_descending 最多点赞 按点赞数排序<br>comment_descending 最多评论 按评论数排序<br>collect_descending 最多收藏 按收藏数排序<br>english_preferred 英文优先<br><br>默认值： general |
| note_type | enum&lt;string&gt; | 是 | 笔记类型<br>枚举值： 不限 所有类型 默认<br>视频笔记 仅视频<br>普通笔记 仅图文<br>直播笔记 仅直播<br><br>默认值： 不限 |
| time_filter | enum&lt;string&gt; | 是 | 发布时间<br>不传默认不限<br><br>枚举值： 不限 所有时间 默认<br>一天内 24小时内<br>一周内 7天内<br>半年内 6个月内<br><br>默认值： 不限 |
| search_id | string | 否 | 搜索ID<br>翻页时传入首次搜索返回的值 |
| search_session_id | string | 否 | 搜索会话ID<br>翻页时传入首次搜索返回的值 |
| source | string | 否 | 来源<br>默认值： explore_feed |
| ai_mode | enum&lt;integer&gt; | 否 | AI模式<br>枚举值： 0 关闭<br>1 开启<br><br>默认值： 0 |

#### JSON Schema

```json
{
  "type" : "object",
  "properties" : {
    "keyword" : {
      "type" : "string",
      "title" : "关键词"
    },
    "page" : {
      "type" : "number",
      "title" : "页数",
      "description" : "从1开始",
      "default" : 1
    },
    "sort_type" : {
      "type" : "string",
      "title" : "排序",
      "enum" : [ "general ", "time_descending", "popularity_descending", "comment_descending", "collect_descending", "english_preferred" ],
      "default" : "general ",
      "enumNames" : {
        "general " : "综合",
        "time_descending" : "最新",
        "popularity_descending" : "最多点赞",
        "comment_descending" : "最多评论",
        "collect_descending" : "最多收藏",
        "english_preferred" : "英文优先"
      },
      "enumDescriptions" : {
        "general " : "默认",
        "time_descending" : "按时间倒序",
        "popularity_descending" : "按点赞数排序",
        "comment_descending" : "按评论数排序",
        "collect_descending" : "按收藏数排序"
      }
    },
    "note_type" : {
      "type" : "string",
      "title" : "笔记类型",
      "enum" : [ "不限", "视频笔记", "普通笔记", "直播笔记" ],
      "default" : "不限",
      "enumNames" : {
        "不限" : "所有类型",
        "视频笔记" : "仅视频",
        "普通笔记" : "仅图文",
        "直播笔记" : "仅直播"
      },
      "enumDescriptions" : {
        "不限" : "默认"
      }
    },
    "time_filter" : {
      "type" : "string",
      "title" : "发布时间",
      "description" : "不传默认不限",
      "enum" : [ "不限", "一天内", "一周内", "半年内" ],
      "default" : "不限",
      "enumNames" : {
        "不限" : "所有时间",
        "一天内" : "24小时内",
        "一周内" : "7天内",
        "半年内" : "6个月内"
      },
      "enumDescriptions" : {
        "不限" : "默认"
      }
    },
    "search_id" : {
      "type" : "string",
      "title" : "搜索ID",
      "description" : "翻页时传入首次搜索返回的值"
    },
    "search_session_id" : {
      "type" : "string",
      "title" : "搜索会话ID",
      "description" : "翻页时传入首次搜索返回的值"
    },
    "source" : {
      "type" : "string",
      "title" : "来源",
      "default" : "explore_feed"
    },
    "ai_mode" : {
      "type" : "integer",
      "title" : "AI模式",
      "enum" : [ 0, 1 ],
      "default" : 0,
      "enumNames" : {
        "0" : "关闭",
        "1" : "开启"
      }
    }
  },
  "required" : [ "keyword", "page", "sort_type", "note_type", "time_filter" ]
}
```

#### 示例

```json
{
  "keyword" : "罗永浩",
  "page" : 1,
  "sort_type" : "general",
  "note_type" : "不限",
  "time_filter" : "不限",
  "search_id" : "",
  "search_session_id" : "",
  "source" : "explore_feed",
  "ai_mode" : 0
}
```

## 返回响应

### 响应 200 · application/json

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| code | integer | 是 |  |
| message | string | 是 |  |
| data | object | 是 |  |

#### JSON Schema

```json
{
  "type" : "object",
  "properties" : {
    "code" : {
      "type" : "integer"
    },
    "message" : {
      "type" : "string"
    },
    "data" : {
      "type" : "object",
      "properties" : { }
    }
  },
  "required" : [ "code", "message", "data" ]
}
```

#### 示例

```json
{
  "code" : 200,
  "message" : "success",
  "data" : { }
}
```

## 请求示例代码

```sh
curl --globoff --request POST 'https://api.getoneapi.com/api/xiaohongshu-v2/search_notes' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "keyword" : "罗永浩",
  "page" : 1,
  "sort_type" : "general",
  "note_type" : "不限",
  "time_filter" : "不限",
  "search_id" : "",
  "search_session_id" : "",
  "source" : "explore_feed",
  "ai_mode" : 0
}'
```

