社媒数据助手 社媒数据助手 免费登录
SocialDataX API

搜索小红书笔记

按关键词搜索小红书笔记,查看请求参数、笔记列表返回字段、分页方式和在线调用示例。

搜索小红书笔记

按关键词和筛选条件搜索公开小红书笔记;默认搜索所有类型,设置 note_type="image" 搜索图文笔记,设置 note_type="video" 搜索视频笔记。返回结构化笔记摘要和下一页分页令牌。结果包含可识别的广告笔记,is_ad 表示是否为广告;is_cooperation_note 表示是否带有商业合作笔记标记。

POST /socialdatax/api/v1/xhs/note/search

1 积分 = 0.01 元;成功调用扣减 10 积分,失败不扣费。

请求参数

  • keyword(必填):搜索词,可传关键词或短语,例如品牌名、话题、人物名、产品名或内容需求;不要传笔记链接、主页链接、note_id、user_id 或 page_token。
  • sort_type:笔记搜索结果排序方式。
  • note_type:笔记类型筛选。
  • publish_time_range:发布时间范围筛选。
  • page_token:笔记搜索分页令牌。首次请求留空;继续翻页时必须将上一页返回的完整 next_page_token 原样作为 page_token 传回。page_token 是不透明分页令牌,只能用于同一笔记搜索链路,不能跨关键词、排序、笔记类型、发布时间范围和调用方复用;不得修改、截断、缩写、脱敏、掩码、省略、规范化、重组或自行生成,不得用省略号替换中间内容。

请求示例

{
  "keyword": "露营",
  "sort_type": "general",
  "note_type": "all",
  "publish_time_range": "all",
  "page_token": ""
}

返回字段

  • items:笔记搜索结果中的笔记列表,包含可识别的广告笔记,已过滤非笔记卡片与不可公开笔记;当前页过滤后可能为空数组
  • next_page_token:下一页不透明分页令牌;为空表示没有更多结果或无法继续 token 翻页。继续翻页时必须将返回的完整 next_page_token 原样作为 page_token 传回。next_page_token 仅限同一工具、关键词和调用方;保持该工具支持的筛选条件不变,不得跨搜索工具复用;items 为空时不要单独据此判断结束。不得修改、截断、缩写、脱敏、掩码、省略、规范化、重组或自行生成,不得用省略号替换中间内容。
  • points:本次成功调用的积分消耗与调用完成时的账户积分余额。

响应示例(仅说明结构)

{
  "items": [
    {
      "note_url": "https://www.xiaohongshu.com/discovery/item/69e71b110000000022029e5e?xsec_source=app_share&xsec_token=CB8LYwuNCmdLCh4IingDx12rfddpSYoSu-dkiRRHnsk6o=",
      "note_id": "69e71b110000000022029e5e",
      "note_type": "image",
      "title": "露营装备清单",
      "is_ad": false,
      "is_cooperation_note": false,
      "summary": "适合周末出行的装备组合。",
      "cover_image_url": "https://example.invalid/cover.webp",
      "like_count": 120,
      "collect_count": 35,
      "comment_count": 18,
      "share_count": 4,
      "publish_time": 1714316800,
      "update_time": null,
      "video": null,
      "author": {
        "user_id": "67c25fdc000000000a03dae1",
        "name": "露营研究员",
        "avatar_url": "https://example.invalid/avatar.webp",
        "profile_url": "https://www.xiaohongshu.com/user/profile/67c25fdc000000000a03dae1",
        "red_id": "camp-001"
      }
    }
  ],
  "next_page_token": "opaque-search-page-token",
  "points": {
    "cost": 10,
    "balance": 990
  }
}

请求 Schema

{
  "additionalProperties": false,
  "properties": {
    "keyword": {
      "title": "Keyword",
      "type": "string",
      "description": "搜索词,可传关键词或短语,例如品牌名、话题、人物名、产品名或内容需求;不要传笔记链接、主页链接、note_id、user_id 或 page_token。"
    },
    "sort_type": {
      "default": "general",
      "enum": [
        "general",
        "time_descending",
        "like_count_descending",
        "comment_count_descending",
        "collect_count_descending"
      ],
      "title": "Sort Type",
      "type": "string",
      "description": "笔记搜索结果排序方式。",
      "x-socialdatax-enum-labels": {
        "general": "综合",
        "time_descending": "最新发布优先",
        "like_count_descending": "最多点赞优先",
        "comment_count_descending": "最多评论优先",
        "collect_count_descending": "最多收藏优先"
      }
    },
    "note_type": {
      "default": "all",
      "enum": [
        "all",
        "image",
        "video"
      ],
      "title": "Note Type",
      "type": "string",
      "description": "笔记类型筛选。",
      "x-socialdatax-enum-labels": {
        "all": "不限",
        "image": "图文",
        "video": "视频"
      }
    },
    "publish_time_range": {
      "default": "all",
      "enum": [
        "all",
        "day",
        "week",
        "half_year"
      ],
      "title": "Publish Time Range",
      "type": "string",
      "description": "发布时间范围筛选。",
      "x-socialdatax-enum-labels": {
        "all": "不限",
        "day": "一天内",
        "week": "一周内",
        "half_year": "半年内"
      }
    },
    "page_token": {
      "default": "",
      "title": "Page Token",
      "type": "string",
      "description": "笔记搜索分页令牌。首次请求留空;继续翻页时必须将上一页返回的完整 next_page_token 原样作为 page_token 传回。page_token 是不透明分页令牌,只能用于同一笔记搜索链路,不能跨关键词、排序、笔记类型、发布时间范围和调用方复用;不得修改、截断、缩写、脱敏、掩码、省略、规范化、重组或自行生成,不得用省略号替换中间内容。"
    }
  },
  "required": [
    "keyword"
  ],
  "title": "InternalSearchNotesRequest",
  "type": "object"
}

响应 Schema

{
  "$defs": {
    "AuthorSummary": {
      "properties": {
        "user_id": {
          "description": "作者 user_id",
          "title": "User Id",
          "type": "string"
        },
        "name": {
          "description": "作者名称",
          "title": "Name",
          "type": "string"
        },
        "avatar_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "作者头像链接;没有头像链接时为 null",
          "title": "Avatar Url"
        },
        "profile_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "作者主页链接;没有主页链接时为 null",
          "title": "Profile Url"
        },
        "red_id": {
          "description": "作者公开小红书号;没有小红书号时为空字符串",
          "title": "Red Id",
          "type": "string"
        }
      },
      "required": [
        "user_id",
        "name",
        "avatar_url",
        "profile_url",
        "red_id"
      ],
      "title": "AuthorSummary",
      "type": "object"
    },
    "SearchNoteItem": {
      "properties": {
        "is_cooperation_note": {
          "default": false,
          "description": "是否带有商业合作笔记标记",
          "title": "Is Cooperation Note",
          "type": "boolean"
        },
        "is_ad": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "是否为广告",
          "title": "Is Ad"
        },
        "note_url": {
          "description": "note_url 是可打开笔记内容所需的完整 URL。任何使用该返回链接的场景都必须原样保留完整 URL,包括 xsec_token 等 query 参数;例如最终回答、展示、引用、存储、输出或传递;不得修改、截断、脱敏、规范化、重组,也不得用 note_id 重新拼接链接。",
          "title": "Note Url",
          "type": "string"
        },
        "note_id": {
          "description": "小红书笔记 ID。必须原样使用完整 note_id;不得截断、缩写、脱敏、补全、格式化、重组,也不得只传前缀。",
          "title": "Note Id",
          "type": "string"
        },
        "note_type": {
          "description": "笔记类型;当前公开值固定为 image 或 video",
          "enum": [
            "image",
            "video"
          ],
          "title": "Note Type",
          "type": "string",
          "x-socialdatax-enum-labels": {
            "image": "图文",
            "video": "视频"
          }
        },
        "title": {
          "description": "笔记标题",
          "title": "Title",
          "type": "string"
        },
        "summary": {
          "description": "笔记摘要;不是全文",
          "title": "Summary",
          "type": "string"
        },
        "cover_image_url": {
          "description": "统一封面图",
          "title": "Cover Image Url",
          "type": "string"
        },
        "like_count": {
          "description": "点赞数",
          "title": "Like Count",
          "type": "integer"
        },
        "collect_count": {
          "description": "收藏数",
          "title": "Collect Count",
          "type": "integer"
        },
        "comment_count": {
          "description": "评论数",
          "title": "Comment Count",
          "type": "integer"
        },
        "share_count": {
          "description": "分享数",
          "title": "Share Count",
          "type": "integer"
        },
        "publish_time": {
          "description": "发布时间,秒级 Unix 时间戳;0 表示未知,不应解释为实际发布日期",
          "title": "Publish Time",
          "type": "integer"
        },
        "update_time": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "更新时间,秒级 Unix 时间戳;没有有效更新时间时为 null",
          "title": "Update Time"
        },
        "video": {
          "anyOf": [
            {
              "$ref": "#/$defs/SearchNoteVideo"
            },
            {
              "type": "null"
            }
          ],
          "description": "视频摘要信息;视频笔记也可能为 null,表示未提供视频信息,不代表不是视频;图文为 null"
        },
        "author": {
          "$ref": "#/$defs/AuthorSummary",
          "description": "作者信息"
        }
      },
      "required": [
        "note_url",
        "note_id",
        "note_type",
        "title",
        "summary",
        "cover_image_url",
        "like_count",
        "collect_count",
        "comment_count",
        "share_count",
        "publish_time",
        "update_time",
        "video",
        "author"
      ],
      "title": "SearchNoteItem",
      "type": "object"
    },
    "SearchNoteVideo": {
      "additionalProperties": false,
      "properties": {
        "video_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "视频链接;没有视频链接时为 null",
          "title": "Video Url"
        },
        "duration_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "视频原始时长,单位毫秒;没有时长时为 null",
          "title": "Duration Ms"
        },
        "width": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "视频宽度,像素;没有时为 null",
          "title": "Width"
        },
        "height": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "视频高度,像素;没有时为 null",
          "title": "Height"
        }
      },
      "required": [
        "video_url",
        "duration_ms",
        "width",
        "height"
      ],
      "title": "SearchNoteVideo",
      "type": "object"
    }
  },
  "properties": {
    "items": {
      "description": "笔记搜索结果中的笔记列表,包含可识别的广告笔记,已过滤非笔记卡片与不可公开笔记;当前页过滤后可能为空数组",
      "items": {
        "$ref": "#/$defs/SearchNoteItem"
      },
      "title": "Items",
      "type": "array"
    },
    "next_page_token": {
      "description": "下一页不透明分页令牌;为空表示没有更多结果或无法继续 token 翻页。继续翻页时必须将返回的完整 next_page_token 原样作为 page_token 传回。next_page_token 仅限同一工具、关键词和调用方;保持该工具支持的筛选条件不变,不得跨搜索工具复用;items 为空时不要单独据此判断结束。不得修改、截断、缩写、脱敏、掩码、省略、规范化、重组或自行生成,不得用省略号替换中间内容。",
      "title": "Next Page Token",
      "type": "string"
    },
    "points": {
      "type": "object",
      "description": "本次成功调用的积分消耗与调用完成时的账户积分余额。",
      "properties": {
        "cost": {
          "type": "integer",
          "description": "本次请求最终确认消耗的积分。",
          "minimum": 0
        },
        "balance": {
          "type": "integer",
          "description": "本次接口完成时看到的当前积分余额。",
          "minimum": 0
        }
      },
      "required": [
        "cost",
        "balance"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "items",
    "next_page_token",
    "points"
  ],
  "title": "SearchNotesResult",
  "type": "object"
}

鉴权与在线测试

业务 API 使用 API Key 鉴权。公开文档无需登录;在线测试可手动输入 API Key,登录后也可选择账户已有 Key。手动输入的 Key 仅在当前页面使用,curl 示例始终引用 SOCIALDATAX_API_KEY 环境变量。

机器可读入口

开发工具和 AI 可以通过以下公共入口读取最新文档,接口数据由后端统一生成。

公共 API Catalog

结构化接口目录、参数、响应字段、计费与平台能力。

https://mcp.socialdatax.com/socialdatax/api/v1/docs/catalog

OpenAPI JSON

用于代码生成、API 客户端和支持 OpenAPI 的开发工具。

https://mcp.socialdatax.com/socialdatax/api/v1/docs/openapi.json

Docs MCP

让支持 MCP 的 AI 工具直接检索 SocialDataX API 文档。

https://mcp.socialdatax.com/docs/mcp

Docs MCP Server Card

Docs MCP 的机器可读服务描述和能力入口。

https://mcp.socialdatax.com/.well-known/mcp/docs-server-card.json