小红书 API - 用户搜索 (V2)
通过关键词搜索小红书用户,返回包含基本资料(如用户ID、昵称、头像、可用时的个人简介)及公开计数/信号(可用时)的分页结果集。
典型使用场景:
- 通过细分领域、品牌或主题关键词查找创作者/KOL
- 构建用于监测和分析的创作者列表
- 发现竞品账号及相关个人资料
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | 此 API 服务的访问令牌。 |
keyword | query | string | 是 | 搜索关键词。 |
page | query | integer | 否 | 用于分页的页码。 |
代码示例
💡 环境说明
默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择。
bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE"text
我想使用 Just One API 提供的“用户搜索 (V2)”接口。
接口地址: https://api.justoneapi.com/api/xiaohongshu/search-user/v2
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/xiaohongshu-apis/user-search-v2-zh.json
请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- keyword (query): 搜索关键词。 (必填)
- page (query): 用于分页的页码。
返回格式: JSON
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 余额不足
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url)
print(response.json())js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/xiaohongshu/search-user/v2?token=YOUR_API_KEY&keyword=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;响应结果
json
{
"code": 0,
"data": {
"users": [
{
"name": "Amir Ali",
"red_official_verify_type": 0,
"self": false,
"reason": "",
"id": "68b016570000000018028e20",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7efe1fc3de4c930effac.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_id": "26814156493",
"show_red_official_verify_icon": false,
"red_official_verified": false,
"link": "xhsdiscover://1/user/user.68b016570000000018028e20",
"sub_title": "",
"desc": "小红书号:26814156493"
},
{
"sub_title": "",
"desc": "小红书号:18654598764",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f83b46568f580649586.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verified": false,
"show_red_official_verify_icon": false,
"self": false,
"link": "xhsdiscover://1/user/user.694e2e980000000037032b89",
"reason": "",
"id": "694e2e980000000037032b89",
"name": "AMIR Ali",
"red_id": "18654598764",
"red_official_verify_type": 0
},
{
"id": "689f145b00000000190221a3",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7ecfb46568f58064957a.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verified": false,
"reason": "",
"sub_title": "",
"name": "Amir Ali",
"desc": "小红书号:18996540717",
"red_id": "18996540717",
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"self": false,
"link": "xhsdiscover://1/user/user.689f145b00000000190221a3"
},
{
"reason": "",
"name": "Amir Ali",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f8f2a34639eb26eb1cd.jpg?imageView2/2/w/360/format/webp",
"red_id": "26265359318",
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.66b416c1000000001d03221e",
"sub_title": "",
"id": "66b416c1000000001d03221e",
"desc": "小红书号:26265359318",
"followed": false,
"red_official_verify_type": 0,
"red_official_verified": false,
"self": false
},
{
"red_id": "5402725779",
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.63711e98000000001f018c3f",
"desc": "小红书号:5402725779",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/63711e98000000001f018c3f.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verified": false,
"self": false,
"sub_title": "",
"reason": "",
"id": "63711e98000000001f018c3f",
"name": "amir ali"
},
{
"id": "67ed5618000000000e01c058",
"name": "Amir Ali",
"desc": "小红书号:95318072831",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7e78731e07eb8ca3d81b.jpg?imageView2/2/w/360/format/webp",
"show_red_official_verify_icon": false,
"red_official_verified": false,
"sub_title": "",
"followed": false,
"red_id": "95318072831",
"red_official_verify_type": 0,
"self": false,
"link": "xhsdiscover://1/user/user.67ed5618000000000e01c058",
"reason": ""
},
{
"desc": "小红书号:4m1rr22",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f6e338379fac1893093.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"show_red_official_verify_icon": false,
"id": "6785afc4000000000803d019",
"name": "Amir Ali",
"red_official_verified": false,
"self": false,
"link": "xhsdiscover://1/user/user.6785afc4000000000803d019",
"sub_title": "",
"reason": "",
"red_id": "4m1rr22",
"red_official_verify_type": 0
},
{
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"red_official_verified": false,
"id": "679096af000000000e012092",
"name": "Amir ali",
"desc": "小红书号:11512498587",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b807d338379fac18930a8.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_id": "11512498587",
"self": false,
"link": "xhsdiscover://1/user/user.679096af000000000e012092",
"sub_title": "",
"reason": ""
},
{
"name": "Amir Ali",
"red_id": "42934536844",
"red_official_verified": false,
"self": false,
"sub_title": "",
"id": "6792367f000000000e01fbf2",
"desc": "小红书号:42934536844",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7e371fc3de4c930eff9d.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.6792367f000000000e01fbf2",
"reason": ""
},
{
"name": "Amir Ali",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b800677c97ef1a2abc7e0.jpg?imageView2/2/w/360/format/webp",
"red_id": "95028500559",
"self": false,
"sub_title": "",
"id": "6813ce61000000000e01f21d",
"followed": false,
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"red_official_verified": false,
"link": "xhsdiscover://1/user/user.6813ce61000000000e01f21d",
"reason": "",
"desc": "小红书号:95028500559"
},
{
"red_official_verify_type": 0,
"red_official_verified": false,
"self": false,
"desc": "小红书号:95502854544",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b6985573b2ad2b5243b1d.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.6880a4e5000000001d015614",
"sub_title": "",
"reason": "",
"id": "6880a4e5000000001d015614",
"name": "Amir Ali",
"red_id": "95502854544"
},
{
"name": "Amir Ali",
"followed": false,
"show_red_official_verify_icon": false,
"self": false,
"link": "xhsdiscover://1/user/user.6792aafe000000000e01e93f",
"reason": "",
"sub_title": "",
"id": "6792aafe000000000e01e93f",
"desc": "小红书号:42934052090",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b6abf2e368555521befcc.jpg?imageView2/2/w/360/format/webp",
"red_id": "42934052090",
"red_official_verify_type": 0,
"red_official_verified": false
},
{
"id": "67a4ba43000000000e013232",
"name": "Amir Ali",
"desc": "小红书号:11595138576",
"red_id": "11595138576",
"self": false,
"sub_title": "",
"reason": "",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f83b46568f580649586.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"red_official_verified": false,
"link": "xhsdiscover://1/user/user.67a4ba43000000000e013232"
},
{
"id": "6843f5a2000000001b020f2f",
"name": "Amir Ali",
"desc": "小红书号:27491033698",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f257b3e7e60e53504de.jpg?imageView2/2/w/360/format/webp",
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.6843f5a2000000001b020f2f",
"sub_title": "",
"followed": false,
"red_id": "27491033698",
"red_official_verify_type": 0,
"red_official_verified": false,
"self": false,
"reason": ""
},
{
"id": "679fce83000000000d00a9b9",
"name": "Amir Ali",
"desc": "小红书号:63842909993",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b807d338379fac18930a8.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_official_verify_type": 0,
"self": false,
"sub_title": "",
"reason": "",
"red_id": "63842909993",
"show_red_official_verify_icon": false,
"red_official_verified": false,
"link": "xhsdiscover://1/user/user.679fce83000000000d00a9b9"
},
{
"red_official_verify_type": 0,
"self": false,
"sub_title": "",
"id": "682c8272000000001703e6d8",
"desc": "小红书号:26105636530",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f8f2a34639eb26eb1cd.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_id": "26105636530",
"name": "Amir Ali",
"show_red_official_verify_icon": false,
"red_official_verified": false,
"link": "xhsdiscover://1/user/user.682c8272000000001703e6d8",
"reason": ""
},
{
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7eecf82b98b5c9349913.jpg?imageView2/2/w/360/format/webp",
"red_id": "95588314694",
"show_red_official_verify_icon": false,
"red_official_verified": false,
"self": false,
"link": "xhsdiscover://1/user/user.68a9f16800000000190184cc",
"id": "68a9f16800000000190184cc",
"desc": "小红书号:95588314694",
"sub_title": "",
"red_official_verify_type": 0,
"reason": "",
"name": "Amir Ali",
"followed": false
},
{
"id": "686a1680000000001e001e4e",
"red_official_verified": false,
"sub_title": "",
"reason": "",
"self": false,
"name": "Amir Ali",
"desc": "小红书号:42297699740",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7ecfb46568f58064957a.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"red_id": "42297699740",
"red_official_verify_type": 0,
"show_red_official_verify_icon": false,
"link": "xhsdiscover://1/user/user.686a1680000000001e001e4e"
},
{
"name": "Amir Ali",
"red_id": "11588655182",
"red_official_verify_type": 0,
"self": false,
"link": "xhsdiscover://1/user/user.679648ab000000000e01ca48",
"id": "679648ab000000000e01ca48",
"desc": "小红书号:11588655182",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b6985573b2ad2b5243b1d.jpg?imageView2/2/w/360/format/webp",
"followed": false,
"show_red_official_verify_icon": false,
"red_official_verified": false,
"sub_title": "",
"reason": ""
},
{
"name": "Amir Ali",
"followed": false,
"red_id": "95355142911",
"red_official_verify_type": 0,
"red_official_verified": false,
"self": false,
"link": "xhsdiscover://1/user/user.678b1e17000000000d0084f2",
"sub_title": "",
"id": "678b1e17000000000d0084f2",
"desc": "小红书号:95355142911",
"image": "https://sns-avatar-qc.xhscdn.com/avatar/645b7f3c86578b8c6ab3b068.jpg?imageView2/2/w/360/format/webp",
"show_red_official_verify_icon": false,
"reason": ""
}
],
"filters": [
{
"type": "single",
"name": "粉丝数量",
"id": "fans_count",
"group_show_type": 0,
"filter_tags": [
{
"need_location_info": false,
"sub_filters_select_type": "",
"sub_filters": null,
"origin_text": "",
"icon_tail_url": "",
"icon_tail_url_night": "",
"icon_url_night": "",
"id": "all",
"name": "不限",
"icon_url": ""
},
{
"icon_tail_url_night": "",
"need_location_info": false,
"sub_filters": null,
"origin_text": "",
"icon_url_night": "",
"icon_url": "",
"icon_tail_url": "",
"sub_filters_select_type": "",
"id": "0-100",
"name": "0-100"
},
{
"icon_tail_url_night": "",
"need_location_info": false,
"sub_filters": null,
"name": "100-1000",
"origin_text": "",
"icon_url": "",
"icon_url_night": "",
"icon_tail_url": "",
"id": "100-1000",
"sub_filters_select_type": ""
},
{
"origin_text": "",
"icon_url_night": "",
"need_location_info": false,
"sub_filters": null,
"id": "1000-10000",
"name": "1000-1万",
"icon_tail_url_night": "",
"sub_filters_select_type": "",
"icon_url": "",
"icon_tail_url": ""
},
{
"id": "10000-100000",
"name": "1万-10万",
"icon_url": "",
"icon_tail_url": "",
"need_location_info": false,
"sub_filters_select_type": "",
"origin_text": "",
"icon_url_night": "",
"icon_tail_url_night": "",
"sub_filters": null
},
{
"name": "10万以上",
"origin_text": "",
"icon_url": "",
"need_location_info": false,
"id": "100000",
"icon_url_night": "",
"icon_tail_url": "",
"icon_tail_url_night": "",
"sub_filters_select_type": "",
"sub_filters": null
}
],
"word_request_id": "61eed1ba52c1751c5ebe1bd3cdae45a6",
"invisible": true
},
{
"invisible": true,
"type": "single",
"name": "用户类型",
"id": "user_type",
"group_show_type": 0,
"filter_tags": [
{
"need_location_info": false,
"origin_text": "",
"icon_url": "",
"icon_url_night": "",
"icon_tail_url": "",
"icon_tail_url_night": "",
"sub_filters_select_type": "",
"sub_filters": null,
"id": "all",
"name": "不限"
},
{
"origin_text": "",
"icon_url": "",
"icon_tail_url_night": "",
"sub_filters_select_type": "",
"id": "regular_user",
"name": "普通用户",
"icon_url_night": "",
"icon_tail_url": "",
"need_location_info": false,
"sub_filters": null
},
{
"need_location_info": false,
"sub_filters_select_type": "",
"sub_filters": null,
"icon_url": "",
"name": "个人认证",
"origin_text": "",
"icon_url_night": "",
"icon_tail_url": "",
"icon_tail_url_night": "",
"id": "personal_verification"
},
{
"icon_url_night": "",
"need_location_info": false,
"sub_filters_select_type": "",
"sub_filters": null,
"icon_tail_url_night": "",
"id": "business_verification",
"name": "企业认证",
"origin_text": "",
"icon_url": "",
"icon_tail_url": ""
}
],
"word_request_id": "0a1ae450a1c8b13052708c04487576ea"
}
]
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
