小红书 API - 用户资料 (V3)
prod-global
GET
/api/xiaohongshu/get-user/v3
获取小红书用户资料数据,包括用户标识符和资料元数据(例如昵称、头像、个人简介),以及公开计数器如粉丝数和获赞数(当数据可用时)。
典型使用场景:
- 识别创作者/KOL并构建创作者列表
- 丰富用户记录以用于分析和报告
- 创作者监控(资料和计数器随时间的变化)
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | 此 API 服务的访问令牌。 |
userId | query | string | 是 | 小红书用户的唯一标识符。 |
代码示例
💡 环境说明
默认示例使用 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/get-user/v3?token=YOUR_API_KEY&userId=VALUE"text
我想使用 Just One API 提供的“用户资料 (V3)”接口。
接口地址: https://api.justoneapi.com/api/xiaohongshu/get-user/v3
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/xiaohongshu-apis/user-profile-v3-zh.json
请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- userId (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/get-user/v3?token=YOUR_API_KEY&userId=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/get-user/v3?token=YOUR_API_KEY&userId=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/get-user/v3?token=YOUR_API_KEY&userId=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/get-user/v3?token=YOUR_API_KEY&userId=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/get-user/v3?token=YOUR_API_KEY&userId=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": {
"liked": 65447,
"nickname": "是六金呀~",
"red_club_info": {
"red_club_url": "https://www.xiaohongshu.com/store/mc/landing",
"redclubscore": 0,
"red_club": false,
"red_club_level": 0
},
"show_extra_info_button": false,
"identity_label_migrated": false,
"hula_tabs": {
"all_show_tab_config": [
{
"tab_name": "笔记",
"tab_index_weight": 0,
"tab_id": "note"
}
],
"tab_id_selected": "note"
},
"collected": 15725,
"collected_tags_num": 0,
"collected_book_num": 0,
"desc_at_users": [
{
"id": "55e54f003397db29780ea7ba",
"nickname": "星星泡面"
}
],
"real_name_info": "",
"imageb": "https://sns-avatar-qc.xhscdn.com/avatar/63d36aae9a0594dbc226012e.jpg?imageView2/2/w/540/format/webp",
"images": "https://sns-avatar-qc.xhscdn.com/avatar/63d36aae9a0594dbc226012e.jpg?imageView2/2/w/360/format/webp",
"gender": 1,
"recommend_info_icon": "",
"red_official_verify_type": 0,
"ip_location": "广东",
"zhong_tong_bar_info": {
"conversions": []
},
"collected_brand_num": 0,
"remark_name": "",
"avatar_like_status": false,
"avatar_pendant": {
"current_user_pendant": false,
"current_user_pet": false
},
"follows": 29,
"nboards": 0,
"collected_poi_num": 0,
"userid": "5c2f338a000000000701e1c6",
"community_rule_url": "https://www.xiaohongshu.com/user/community-rule",
"seller_info": {
"tab_goods_api_version": 1,
"tab_code_names": [],
"is_tab_goods_first": true
},
"share_link": "https://www.xiaohongshu.com/user/profile/5c2f338a000000000701e1c6?xsec_token=YBwVNAUpVNP86CtEIG-rI9HfjY8EpMRxv24xns7CuwW80=&xsec_source=app_share",
"red_official_verify_content": "",
"is_recommend_level_illegal": false,
"identity_deeplink": "xhsdiscover://rn/app-settings/official/certification/details?type=2&user_id=5c2f338a000000000701e1c6&is_mcn=false",
"blocking": false,
"user_widget_switch": false,
"sec_account_deeplink": "xhsdiscover://rn/accounts/account-detail?targetId=5c2f338a000000000701e1c6&new_page_exp=1",
"desc": "162/110\nhi看@星星泡面 置顶",
"recommend_info": "",
"collected_movie_num": 0,
"result": {
"code": 0,
"message": "success",
"success": true
},
"ndiscovery": 270,
"red_official_verified": false,
"blocked": false,
"is_login_user_pro_account": false,
"banner_info": {
"image": "http://sns-avatar-qc.rednotecdn.com/user_banner/6499c049-b152-3c0e-8e55-1b9c463df303?imageView2/2/w/540/format/jpg&ap=28&sc=USR_BG&src=A",
"bg_color": "2e3943",
"like_status": false
},
"fans": 21263,
"red_id": "531915550",
"share_info": {
"title": "是六金呀~",
"content": "162/110\nhi看@星星泡面 置顶"
},
"interactions": [
{
"type": "follows",
"name": "关注",
"count": 29,
"is_private": true,
"toast": "该用户已设置关注列表不可见"
},
{
"is_private": true,
"toast": "该用户已设置粉丝列表不可见",
"type": "fans",
"name": "粉丝",
"count": 21263
},
{
"is_private": false,
"toast": "",
"type": "interaction",
"name": "获赞与收藏",
"count": 81172
}
],
"share_info_v2": {
"title": "@是六金呀~的个人主页",
"content": "粉丝: 2.1万\n获赞与收藏: 8.1万"
},
"user_role_type": 0,
"tags": [
{
"icon": "http://ci.xiaohongshu.com/icons/user/gender-female-v1.png",
"name": "28岁",
"tag_type": "info"
}
],
"location_jump": false,
"collected_notes_num": 0,
"collected_product_num": 0,
"note_num_stat": {
"posted": 270,
"liked": 65447,
"collected": 15725
},
"default_collection_tab": "note",
"level": {
"number": 0,
"image_link": ""
},
"location": "",
"tab_visible": {
"note": true,
"collect": false,
"like": false,
"seed": true
},
"red_official_verify_base_info": "",
"real_name_deep_target": 1,
"tab_public": {
"collection": false,
"collection_note": true,
"collection_board": true,
"seed": true
},
"fstatus": "none",
"user_desc_info": {
"desc": "162/110\nhi看@星星泡面 置顶",
"desc_at_users": [
{
"user_id": "55e54f003397db29780ea7ba",
"nickname": "星星泡面"
}
],
"desc_with_placeholder": "162/110\nhi看@星星泡面 置顶",
"desc_keywords_switch": true
}
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
