小红书 API - 用户资料 (V4)
此接口已过期
此接口已过时,可能会在未来的版本中被移除。请尽快迁移到新版本。
prod-global
GET
/api/xiaohongshu/get-user/v4
获取小红书用户资料数据,包括用户标识符和资料元数据(例如昵称、头像、个人简介),以及公开计数器如粉丝数和获赞数(当数据可用时)。
典型使用场景:
- 识别创作者/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/v4?token=YOUR_API_KEY&userId=VALUE"text
我想使用 Just One API 提供的“用户资料 (V4)”接口。
接口地址: https://api.justoneapi.com/api/xiaohongshu/get-user/v4
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/xiaohongshu-apis/user-profile-v4-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/v4?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/v4?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/v4?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/v4?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/v4?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": {
"red_official_verified": false,
"tags": [
{
"icon": "http://ci.xiaohongshu.com/icons/user/gender-female-v1.png",
"tag_type": "info"
},
{
"name": "广东东莞",
"tag_type": "location"
},
{
"name": "家居博主",
"tag_type": "profession"
},
{
"name": "母婴博主",
"tag_type": "profession"
}
],
"banner_info": {
"image": "http://sns-avatar-qc.rednotecdn.com/user_banner/1040g2k031t8993lslm1g4a1nb69m5jhjfqpbd5g?imageView2/2/w/540/format/jpg&ap=28&sc=USR_BG&src=A",
"bg_color": "927d69",
"like_status": false
},
"follows": 265,
"fstatus": "none",
"collected_brand_num": 0,
"default_collection_tab": "note",
"collected_product_num": 0,
"red_official_verify_type": 0,
"interactions": [
{
"type": "follows",
"name": "关注",
"count": 265,
"is_private": false,
"toast": ""
},
{
"type": "fans",
"name": "粉丝",
"count": 8456,
"is_private": false,
"toast": ""
},
{
"type": "interaction",
"name": "获赞与收藏",
"count": 75707,
"is_private": false,
"toast": ""
}
],
"blocking": false,
"collected": 26386,
"share_link": "https://www.xiaohongshu.com/user/profile/5a901362e8ac2b36c99bce33?xsec_token=YB9xJDlvo14NLtpZy7E8xH3MtMC3QTjxPTP8Kz3t-EYBY=&xsec_source=app_share",
"desc_at_users": [],
"share_info_v2": {
"title": "@小顾小小家的个人主页",
"content": "粉丝: 8456\n获赞与收藏: 7.6万",
"ecom_title": "小顾小小家的橱窗",
"ecom_content": "小顾小小家为你推荐了44件宝藏好物!已有78人买过了!",
"ecom_share_link": "https://www.xiaohongshu.com/user/profile/5a901362e8ac2b36c99bce33?tab=buyer&channelType=share_outside"
},
"user_widget_switch": false,
"real_name_info": "",
"is_recommend_level_illegal": false,
"hula_tabs": {
"all_show_tab_config": [
{
"tab_id": "note",
"tab_name": "笔记",
"tab_index_weight": 0
},
{
"tab_id": "buyer",
"tab_name": "选品",
"tab_index_weight": 1
}
],
"tab_id_selected": "note"
},
"user_desc_info": {
"desc": "🧡一个117平横厅🏠\n🐰一个2岁的儿子米兜兜\n🌈一位美术老师的有趣生活\n🌻guting1008_",
"desc_at_users": [],
"desc_with_placeholder": "🧡一个117平横厅🏠\n🐰一个2岁的儿子米兜兜\n🌈一位美术老师的有趣生活\n🌻guting1008_",
"desc_keywords_switch": true
},
"real_name_deep_target": 1,
"is_login_user_pro_account": false,
"ndiscovery": 276,
"tab_visible": {
"collect": false,
"like": false,
"seed": true,
"buyer": true,
"note": true
},
"blocked": false,
"sec_account_deeplink": "xhsdiscover://rn/accounts/account-detail?targetId=5a901362e8ac2b36c99bce33&new_page_exp=1",
"nboards": 0,
"collected_poi_num": 0,
"nickname": "小顾小小家",
"share_info": {
"title": "小顾小小家",
"content": "🧡一个117平横厅🏠\n🐰一个2岁的儿子米兜兜\n🌈一位美术老师的有趣生活\n🌻guting1008_"
},
"red_official_verify_base_info": "",
"identity_label_migrated": false,
"gender": 1,
"level": {
"image_link": "",
"number": 0
},
"location": "中国 广东 东莞",
"recommend_info": "",
"recommend_info_icon": "",
"brand_account_info": {
"conversions": [
{
"id": "11",
"name": "群聊",
"icon": "https://picasso-static.xiaohongshu.com/fe-platform/c17fa18d287ca13418e1a6ae86270895a10c9d78.png",
"link": "xhsdiscover://message/userPublicGroupList?user_id=5a901362e8ac2b36c99bce33&username=TA",
"is_shop": false,
"is_red_shop": false,
"sub_title": "查看详情"
}
]
},
"avatar_pendant": {
"current_user_pendant": false,
"current_user_pet": false
},
"collected_movie_num": 0,
"userid": "5a901362e8ac2b36c99bce33",
"note_num_stat": {
"posted": 276,
"liked": 49321,
"collected": 26386
},
"zhong_tong_bar_info": {
"conversions": [
{
"icon": "https://picasso-static.xiaohongshu.com/fe-platform/c17fa18d287ca13418e1a6ae86270895a10c9d78.png",
"link": "xhsdiscover://message/userPublicGroupList?user_id=5a901362e8ac2b36c99bce33&username=TA",
"sub_title": "查看详情",
"id": "11",
"name": "群聊"
},
{
"sub_title": "1个评价",
"id": "34",
"name": "评价",
"icon": "https://fe-video-qc.xhscdn.com/fe-platform/5d104f03c28936f28480c1225414c979ce9e96d1.png",
"link": "xhsdiscover://rn/declare/my-evaluation?userid=5a901362e8ac2b36c99bce33&activeTabName=poi&activeTabId=0"
}
]
},
"avatar_like_status": false,
"buyer_info": {
"tab_name": "选品",
"choice_id": "137155093883637391",
"extra_map": {
"curationGoodsSearch": "true"
}
},
"images": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31gjkvenfjs004a1nb69m5jhjrrsug08?imageView2/2/w/360/format/webp",
"collected_book_num": 0,
"red_id": "guting1008",
"red_club_info": {
"red_club": false,
"red_club_level": 0,
"red_club_url": "https://www.xiaohongshu.com/store/mc/landing",
"redclubscore": 0
},
"show_extra_info_button": false,
"tab_public": {
"collection": false,
"collection_note": true,
"collection_board": true,
"seed": true
},
"red_official_verify_content": "",
"liked": 49321,
"collected_notes_num": 0,
"desc": "🧡一个117平横厅🏠\n🐰一个2岁的儿子米兜兜\n🌈一位美术老师的有趣生活\n🌻guting1008_",
"ip_location": "广东",
"result": {
"success": true,
"code": 0,
"message": "success"
},
"imageb": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo31gjkvenfjs004a1nb69m5jhjrrsug08?imageView2/2/w/540/format/webp",
"fans": 8456,
"identity_deeplink": "xhsdiscover://rn/app-settings/official/certification/details?type=2&user_id=5a901362e8ac2b36c99bce33&is_mcn=false",
"remark_name": "",
"user_role_type": 6,
"location_jump": true,
"collected_tags_num": 0,
"community_rule_url": "https://www.xiaohongshu.com/user/community-rule"
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
