Instagram用户资料 API (V2)
GET
接口健康状态
24h 健康值
24h 平均耗时
最近检查时间
健康 可用 少量可用 基本不可用 暂无数据
健康
正在加载健康状态…
24 小时趋势
30 天趋势
通过用户名获取 Instagram 用户资料。使用该接口在进行创作者研究、品牌监测或相关帖子分析之前审查已知账号。
请求参数
| 参数名 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
token | query | string | 是 | - | API服务的访问令牌。 |
username | query | string | 是 | - | 要检索个人资料详情的Instagram用户名。 |
代码示例
bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE'text
我想使用 JustOneAPI 提供的“用户资料 (V2)”接口。
接入地址: https://api.justoneapi.com。
接口路径: /api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE
接口地址: BASE_URL + /api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE
HTTP 方法: GET
身份验证: 在 URL 中传入 token 查询参数。
OpenAPI 定义: https://docs.justoneapi.com/openapi/instagram/user-profile-v2-zh.json
请求参数说明:
- token (query): API服务的访问令牌。 (必填)
- username (query): 要检索个人资料详情的Instagram用户名。 (必填)
返回格式: 请根据实际 Content-Type 安全处理 JSON 或文本响应。
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为 120 秒;如果 120 秒偏长,请至少设置为 60 秒,但可能会有少量请求因超时而未接收到结果。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 账户余额不足
- 602: TOKEN 限额超限
4. code 601 表示账户共享余额不足。code 602 表示当前 API TOKEN 自身的累计消费上限已达到。TOKEN 限额不是资金划拨,多个 TOKEN 仍共享同一个账户余额。
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
import requests
BASE_URL = "https://api.justoneapi.com" # 由 OpenAPI servers 提供
url = BASE_URL + "/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")js
const BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
const url = BASE_URL + "/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
final String url = BASE_URL + "/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}go
package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // 由 OpenAPI servers 提供
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // 由 OpenAPI servers 提供
$url = $BASE_URL . '/api/instagram/get-user-detail/v2?token=YOUR_API_KEY&username=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}返回字段
业务成功时(code = 0)的主要返回字段。
查询状态与账号5 个字段
data
Instagram 个人资料查询数据。通过 status 判断本次是否返回了个人资料。
| 字段 | 类型 | 说明 |
|---|---|---|
status | boolean | data 内的资料查询状态。接口调用成功时,如果没有返回个人资料,该值也可能是 false。 |
errorMessage | string | 无法返回个人资料时提供的消息。 |
id | string | Instagram 个人资料标识,以文本返回。 |
username | string | Instagram 个人资料的用户名。 |
full_name | string | Instagram 个人资料展示的名称。 |
简介、头像与链接12 个字段
data
| 字段 | 类型 | 说明 |
|---|---|---|
biography | string | 个人资料展示的简介文本。 |
biography_with_entities | object | 简介文本及其关联的文本实体信息。 |
biography_with_entities.raw_text | string | 简介数据中返回的原始文本。 |
biography_with_entities.entities | array | 与简介文本关联的实体列表,数组可能为空。 |
bio_links | array | 个人资料简介中列出的链接。 |
bio_links[] | object | 简介中列出的一条链接。 |
bio_links[].title | string | 简介链接的展示标题。 |
bio_links[].url | string | 简介链接列出的目标地址。 |
bio_links[].link_type | string | Instagram 返回的链接类型标签。 |
external_url | string | 个人资料中列出的外部网站链接。 |
profile_pic_url | string | 个人资料主头像链接。 |
profile_pic_url_hd | string | 个人资料较高分辨率的头像链接。 |
关注统计与账号标记14 个字段
data
| 字段 | 类型 | 说明 |
|---|---|---|
is_private | boolean | 个人资料是否标记为私密。 |
is_verified | boolean | 该用户资料是否带有认证标记。 |
is_embeds_disabled | boolean | 个人资料是否标记为关闭外部嵌入。 |
edge_followed_by | object | 个人资料的粉丝数数据。 |
edge_followed_by.count | integer | 个人资料返回的粉丝数。 |
edge_follow | object | 个人资料的关注数数据。 |
edge_follow.count | integer | 该个人资料关注的账号数。 |
highlight_reel_count | integer | 个人资料返回的快拍精选数量。 |
pinned_channels_list_count | integer | 个人资料返回的置顶频道数量。 |
has_clips | boolean | 个人资料是否标记为包含 Reels 内容。 |
has_guides | boolean | 个人资料是否标记为包含指南。 |
has_channel | boolean | 个人资料是否标记为包含频道。 |
has_ar_effects | boolean | 个人资料是否标记为包含 AR 特效。 |
hide_like_and_view_counts | boolean | 个人资料是否标记为隐藏点赞数和观看数。 |
账号类别与商业资料6 个字段
data
| 字段 | 类型 | 说明 |
|---|---|---|
is_business_account | boolean | 个人资料是否标记为商业账号。 |
is_professional_account | boolean | 个人资料是否标记为专业账号。 |
category_name | string | null | Instagram 返回的个人资料分类标签,无数据时返回 null。 |
should_show_category | boolean | 个人资料分类是否标记为展示。 |
business_contact_method | string | null | 商业联系方法的标签,以文本或 null 返回。 |
business_address_json | string | null | JSON 编码的商业地址信息,以文本或 null 返回。编码对象中的分项可能为 null。 |
内嵌时间线12 个字段
data
| 字段 | 类型 | 说明 |
|---|---|---|
edge_owner_to_timeline_media | object | 可选的内嵌时间线数据。带公开帖子的账号也可能返回空列表。较早的真实响应曾返回媒体条目。 |
edge_owner_to_timeline_media.count | integer | 此内嵌时间线返回的数量,活跃账号也可能返回 0。 |
edge_owner_to_timeline_media.page_info | object | 内嵌时间线的分页信息。 |
edge_owner_to_timeline_media.page_info.has_next_page | boolean | 内嵌数据是否标记还有下一页。 |
edge_owner_to_timeline_media.edges | array | 内嵌时间线返回的媒体条目,数组可能为空。 |
edge_owner_to_timeline_media.edges[] | object | 一项内嵌时间线媒体条目。 |
edge_owner_to_timeline_media.edges[].node | object | 一条内嵌时间线媒体。有该媒体条目时才会返回其字段。 |
edge_felix_video_timeline | object | 内嵌视频时间线信息,有数据时返回。 |
edge_felix_video_timeline.count | integer | 此内嵌视频时间线返回的数量。 |
edge_felix_video_timeline.page_info | object | 内嵌视频时间线的分页信息。 |
edge_felix_video_timeline.page_info.has_next_page | boolean | 内嵌数据是否标记还有下一页。 |
edge_felix_video_timeline.edges | array | 内嵌数据中的视频条目,数组可能为空。 |
时间线媒体与缩略图26 个字段
data.edge_owner_to_timeline_media.edges[].node
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | Instagram 媒体 ID,以文本返回。 |
shortcode | string | Instagram 媒体的短码。 |
taken_at_timestamp | integer | 媒体返回的发布时间,以 Unix 秒级时间戳表示。 |
owner | object | 媒体返回的所有者账号信息。 |
owner.id | string | Instagram 账号标识,以文本返回。 |
owner.username | string | Instagram 账号用户名。 |
product_type | string | 媒体返回的产品类型标签。 |
is_video | boolean | 媒体条目是否标记为视频。 |
has_audio | boolean | 媒体条目是否标记为带有音频。 |
video_url | string | 媒体的视频链接,有数据时返回。 |
display_url | string | 媒体展示图片的链接。 |
dimensions | object | 媒体返回的尺寸。 |
dimensions.width | integer | 媒体返回的宽度。 |
dimensions.height | integer | 媒体返回的高度。 |
thumbnail_src | string | 媒体返回的缩略图链接。 |
thumbnail_tall_src | string | 竖版缩略图链接。 |
thumbnail_resources | array | 可用的缩略图资源及其尺寸。 |
thumbnail_resources[] | object | 一项缩略图资源。 |
thumbnail_resources[].src | string | 该缩略图资源的链接。 |
thumbnail_resources[].config_width | integer | 缩略图规格返回的宽度。 |
thumbnail_resources[].config_height | integer | 缩略图规格返回的高度。 |
tall_profile_grid_crop | object | null | 个人主页竖版网格的裁剪坐标,以对象或 null 返回。 |
tall_profile_grid_crop.crop_top | number | 个人主页网格返回的上边裁剪坐标。 |
tall_profile_grid_crop.crop_bottom | number | 个人主页网格返回的下边裁剪坐标。 |
tall_profile_grid_crop.crop_left | number | 个人主页网格返回的左边裁剪坐标。 |
tall_profile_grid_crop.crop_right | number | 个人主页网格返回的右边裁剪坐标。 |
时间线互动、配文与音乐19 个字段
data.edge_owner_to_timeline_media.edges[].node
| 字段 | 类型 | 说明 |
|---|---|---|
video_view_count | integer | 媒体返回的视频观看次数。 |
comments_disabled | boolean | 媒体条目是否标记为关闭评论。 |
like_and_view_counts_disabled | boolean | 媒体条目是否标记为隐藏点赞数和观看数。 |
edge_liked_by | object | 媒体返回的点赞统计。 |
edge_liked_by.count | integer | 返回的点赞数。 |
edge_media_preview_like | object | 媒体预览返回的点赞统计。 |
edge_media_preview_like.count | integer | 预览返回的点赞数。 |
edge_media_to_comment | object | 媒体返回的评论统计。 |
edge_media_to_comment.count | integer | 返回的评论数。 |
edge_media_to_caption | object | 媒体返回的配文数据。 |
edge_media_to_caption.edges | array | 媒体响应中包含的配文条目。 |
edge_media_to_caption.edges[] | object | 一项配文条目。 |
edge_media_to_caption.edges[].node | object | 该条目内的配文记录。 |
edge_media_to_caption.edges[].node.text | string | 媒体配文文本。 |
clips_music_attribution_info | object | 视频展示的音乐归属信息,有数据时返回。 |
clips_music_attribution_info.artist_name | string | 音乐归属信息中的艺人名称。 |
clips_music_attribution_info.song_name | string | 音乐归属信息中的曲目名称。 |
clips_music_attribution_info.audio_id | string | 音乐归属信息中的音频标识。 |
clips_music_attribution_info.uses_original_audio | boolean | 视频是否标记为使用原声。 |
时间线账号标签与协作者18 个字段
data.edge_owner_to_timeline_media.edges[].node
| 字段 | 类型 | 说明 |
|---|---|---|
edge_media_to_tagged_user | object | 媒体返回的账号标记信息。 |
edge_media_to_tagged_user.edges | array | 媒体响应包含的账号标记条目。 |
edge_media_to_tagged_user.edges[] | object | 一项账号标记条目。 |
edge_media_to_tagged_user.edges[].node | object | 一项媒体账号标记及其位置数据。 |
edge_media_to_tagged_user.edges[].node.user | object | 媒体标签提及的公开账号。 |
edge_media_to_tagged_user.edges[].node.user.id | string | Instagram 账号标识,以文本返回。 |
edge_media_to_tagged_user.edges[].node.user.username | string | Instagram 账号用户名。 |
edge_media_to_tagged_user.edges[].node.user.full_name | string | 被标记账号返回的展示名称。 |
edge_media_to_tagged_user.edges[].node.user.is_verified | boolean | 被标记账号是否标记为已验证。 |
edge_media_to_tagged_user.edges[].node.user.profile_pic_url | string | 被标记账号返回的头像链接。 |
edge_media_to_tagged_user.edges[].node.x | number | 标签返回的水平位置值。 |
edge_media_to_tagged_user.edges[].node.y | number | 标签返回的垂直位置值。 |
coauthor_producers | array | 媒体条目列出的协作者账号。 |
coauthor_producers[] | object | 一项媒体协作者账号信息。 |
coauthor_producers[].id | string | Instagram 账号标识,以文本返回。 |
coauthor_producers[].username | string | Instagram 账号用户名。 |
coauthor_producers[].is_verified | boolean | 协作者账号是否标记为已验证。 |
coauthor_producers[].profile_pic_url | string | 协作者账号返回的头像链接。 |
响应示例
正在加载响应示例…