Instagram用戶資料 API (V2)
GET
API 端點健康狀態
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-hant.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 |
協作者帳號返回的頭像連結。 |
回應示例
正在載入回應範例…