curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03
const API_KEY = "API_KEY";
const date = "2023-12-03";
fetch(`https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=${date}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03', headers=headers)
print(r.json())
<?php
// URL và thông tin xác thực
$url = 'https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03';
$apiKey = 'API_KEY'; // Thay thế 'API_KEY' bằng khóa API thực tế của bạn
// Khởi tạo một phiên cURL
$curl = curl_init();
// Thiết lập các tùy chọn cURL
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Thực thi phiên cURL và nhận phản hồi
$response = curl_exec($curl);
// Kiểm tra xem có lỗi nào xảy ra không
if(curl_errno($curl)){
echo 'Curl error: ' . curl_error($curl);
} else {
// Giải mã và mã hóa lại phản hồi JSON để in đẹp
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
// Đóng phiên cURL
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace InstagramFollowerCountGETRequest_csharp
{
class InstagramFollowerCount
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"onlineFollowersByHour": {
"0": 120, // 12 AM
"1": 113, // 1 AM
"2": 117, // 2 AM
"3": 110, // 3 AM
"4": 129, // 4 AM
"5": 170, // 5 AM
"6": 166, // 6 AM
"7": 173, // 7 AM
"8": 177, // 8 AM
"9": 168, // 9 AM
"10": 178, // 10 AM
"11": 160, // 11 AM
"12": 154, // 12 PM
"13": 153, // 1 PM
"14": 131, // 2 PM
"15": 118, // 3 PM
"16": 109, // 4 PM
"17": 128, // 5 PM
"18": 129, // 6 PM
"19": 134, // 7 PM
"20": 123, // 8 PM
"21": 111, // 9 PM
"22": 102, // 10 PM
"23": 98 // 11 PM
},
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": [
{
"start": "2024-03-29T07:00:00.000Z",
"end": "2024-03-29T07:59:59.999Z",
"onlineFollowers": 33
},
{
"start": "2024-03-29T08:00:00.000Z",
"end": "2024-03-29T08:59:59.999Z",
"onlineFollowers": 90
},
{
"start": "2024-03-29T09:00:00.000Z",
"end": "2024-03-29T09:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T10:00:00.000Z",
"end": "2024-03-29T10:59:59.999Z",
"onlineFollowers": 109
},
{
"start": "2024-03-29T11:00:00.000Z",
"end": "2024-03-29T11:59:59.999Z",
"onlineFollowers": 99
},
{
"start": "2024-03-29T12:00:00.000Z",
"end": "2024-03-29T12:59:59.999Z",
"onlineFollowers": 10
},
{
"start": "2024-03-29T13:00:00.000Z",
"end": "2024-03-29T13:59:59.999Z",
"onlineFollowers": 82
},
{
"start": "2024-03-29T14:00:00.000Z",
"end": "2024-03-29T14:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T15:00:00.000Z",
"end": "2024-03-29T15:59:59.999Z",
"onlineFollowers": 91
},
{
"start": "2024-03-29T16:00:00.000Z",
"end": "2024-03-29T16:59:59.999Z",
"onlineFollowers": 12
},
{
"start": "2024-03-29T17:00:00.000Z",
"end": "2024-03-29T17:59:59.999Z",
"onlineFollowers": 93
},
{
"start": "2024-03-29T18:00:00.000Z",
"end": "2024-03-29T18:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T19:00:00.000Z",
"end": "2024-03-29T19:59:59.999Z",
"onlineFollowers": 95
},
{
"start": "2024-03-29T20:00:00.000Z",
"end": "2024-03-29T20:59:59.999Z",
"onlineFollowers": 97
},
{
"start": "2024-03-29T21:00:00.000Z",
"end": "2024-03-29T21:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T22:00:00.000Z",
"end": "2024-03-29T22:59:59.999Z",
"onlineFollowers": 74
},
{
"start": "2024-03-29T23:00:00.000Z",
"end": "2024-03-29T23:59:59.999Z",
"onlineFollowers": 61
},
{
"start": "2024-03-30T00:00:00.000Z",
"end": "2024-03-30T00:59:59.999Z",
"onlineFollowers": 31
},
{
"start": "2024-03-30T01:00:00.000Z",
"end": "2024-03-30T01:59:59.999Z",
"onlineFollowers": 28
},
{
"start": "2024-03-30T02:00:00.000Z",
"end": "2024-03-30T02:59:59.999Z",
"onlineFollowers": 19
},
{
"start": "2024-03-30T03:00:00.000Z",
"end": "2024-03-30T03:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-30T04:00:00.000Z",
"end": "2024-03-30T04:59:59.999Z",
"onlineFollowers": 23
},
{
"start": "2024-03-30T05:00:00.000Z",
"end": "2024-03-30T05:59:59.999Z",
"onlineFollowers": 92
},
{
"start": "2024-03-30T06:00:00.000Z",
"end": "2024-03-30T06:59:59.999Z",
"onlineFollowers": 32
}
],
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": {}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
Analytics
Số lượng Người theo dõi Instagram đang Trực tuyến
Truy xuất tổng số lịch sử người theo dõi Instagram của bạn
GET
/
analytics
/
getInstagramOnlineFollowers
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03
const API_KEY = "API_KEY";
const date = "2023-12-03";
fetch(`https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=${date}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03', headers=headers)
print(r.json())
<?php
// URL và thông tin xác thực
$url = 'https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03';
$apiKey = 'API_KEY'; // Thay thế 'API_KEY' bằng khóa API thực tế của bạn
// Khởi tạo một phiên cURL
$curl = curl_init();
// Thiết lập các tùy chọn cURL
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Thực thi phiên cURL và nhận phản hồi
$response = curl_exec($curl);
// Kiểm tra xem có lỗi nào xảy ra không
if(curl_errno($curl)){
echo 'Curl error: ' . curl_error($curl);
} else {
// Giải mã và mã hóa lại phản hồi JSON để in đẹp
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
// Đóng phiên cURL
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace InstagramFollowerCountGETRequest_csharp
{
class InstagramFollowerCount
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"onlineFollowersByHour": {
"0": 120, // 12 AM
"1": 113, // 1 AM
"2": 117, // 2 AM
"3": 110, // 3 AM
"4": 129, // 4 AM
"5": 170, // 5 AM
"6": 166, // 6 AM
"7": 173, // 7 AM
"8": 177, // 8 AM
"9": 168, // 9 AM
"10": 178, // 10 AM
"11": 160, // 11 AM
"12": 154, // 12 PM
"13": 153, // 1 PM
"14": 131, // 2 PM
"15": 118, // 3 PM
"16": 109, // 4 PM
"17": 128, // 5 PM
"18": 129, // 6 PM
"19": 134, // 7 PM
"20": 123, // 8 PM
"21": 111, // 9 PM
"22": 102, // 10 PM
"23": 98 // 11 PM
},
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": [
{
"start": "2024-03-29T07:00:00.000Z",
"end": "2024-03-29T07:59:59.999Z",
"onlineFollowers": 33
},
{
"start": "2024-03-29T08:00:00.000Z",
"end": "2024-03-29T08:59:59.999Z",
"onlineFollowers": 90
},
{
"start": "2024-03-29T09:00:00.000Z",
"end": "2024-03-29T09:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T10:00:00.000Z",
"end": "2024-03-29T10:59:59.999Z",
"onlineFollowers": 109
},
{
"start": "2024-03-29T11:00:00.000Z",
"end": "2024-03-29T11:59:59.999Z",
"onlineFollowers": 99
},
{
"start": "2024-03-29T12:00:00.000Z",
"end": "2024-03-29T12:59:59.999Z",
"onlineFollowers": 10
},
{
"start": "2024-03-29T13:00:00.000Z",
"end": "2024-03-29T13:59:59.999Z",
"onlineFollowers": 82
},
{
"start": "2024-03-29T14:00:00.000Z",
"end": "2024-03-29T14:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T15:00:00.000Z",
"end": "2024-03-29T15:59:59.999Z",
"onlineFollowers": 91
},
{
"start": "2024-03-29T16:00:00.000Z",
"end": "2024-03-29T16:59:59.999Z",
"onlineFollowers": 12
},
{
"start": "2024-03-29T17:00:00.000Z",
"end": "2024-03-29T17:59:59.999Z",
"onlineFollowers": 93
},
{
"start": "2024-03-29T18:00:00.000Z",
"end": "2024-03-29T18:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T19:00:00.000Z",
"end": "2024-03-29T19:59:59.999Z",
"onlineFollowers": 95
},
{
"start": "2024-03-29T20:00:00.000Z",
"end": "2024-03-29T20:59:59.999Z",
"onlineFollowers": 97
},
{
"start": "2024-03-29T21:00:00.000Z",
"end": "2024-03-29T21:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T22:00:00.000Z",
"end": "2024-03-29T22:59:59.999Z",
"onlineFollowers": 74
},
{
"start": "2024-03-29T23:00:00.000Z",
"end": "2024-03-29T23:59:59.999Z",
"onlineFollowers": 61
},
{
"start": "2024-03-30T00:00:00.000Z",
"end": "2024-03-30T00:59:59.999Z",
"onlineFollowers": 31
},
{
"start": "2024-03-30T01:00:00.000Z",
"end": "2024-03-30T01:59:59.999Z",
"onlineFollowers": 28
},
{
"start": "2024-03-30T02:00:00.000Z",
"end": "2024-03-30T02:59:59.999Z",
"onlineFollowers": 19
},
{
"start": "2024-03-30T03:00:00.000Z",
"end": "2024-03-30T03:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-30T04:00:00.000Z",
"end": "2024-03-30T04:59:59.999Z",
"onlineFollowers": 23
},
{
"start": "2024-03-30T05:00:00.000Z",
"end": "2024-03-30T05:59:59.999Z",
"onlineFollowers": 92
},
{
"start": "2024-03-30T06:00:00.000Z",
"end": "2024-03-30T06:59:59.999Z",
"onlineFollowers": 32
}
],
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": {}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
Truy xuất tổng số lịch sử người theo dõi Instagram của bạn đang trực tuyến theo từng giờ, cho phép bạn tối ưu hóa thời điểm đăng bài để đạt được mức tương tác tối đa.
- Không khả dụng đối với những người dùng Instagram có ít hơn 100 người theo dõi.
- Dữ liệu phân tích chỉ khả dụng cho 30 ngày gần nhất.
- Khoảng thời gian cho một ngày được yêu cầu là từ ngày trước đó lúc T07:00:00.000Z đến ngày hiện tại
lúc T06:59:59.999Z theo UTC.Ví dụ: sử dụng định dạng
YYYY-MM-DDThh:mm:ssZvà gửi dưới dạng2026-07-08T12:30:00Z. Vui lòng xem utctime để biết thêm ví dụ.
Tham số Header
Tham số Query
Một ngày với định dạng:
YYYY-MM-DD.Ví dụ: sử dụng định dạng YYYY-MM-DDThh:mm:ssZ và gửi dưới dạng 2026-07-08T12:30:00Z.
Vui lòng xem utctime để biết thêm ví dụ.Định dạng kết quả đầu ra với ngày bắt đầu và ngày kết thúc theo UTC.
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03
const API_KEY = "API_KEY";
const date = "2023-12-03";
fetch(`https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=${date}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03', headers=headers)
print(r.json())
<?php
// URL và thông tin xác thực
$url = 'https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03';
$apiKey = 'API_KEY'; // Thay thế 'API_KEY' bằng khóa API thực tế của bạn
// Khởi tạo một phiên cURL
$curl = curl_init();
// Thiết lập các tùy chọn cURL
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Thực thi phiên cURL và nhận phản hồi
$response = curl_exec($curl);
// Kiểm tra xem có lỗi nào xảy ra không
if(curl_errno($curl)){
echo 'Curl error: ' . curl_error($curl);
} else {
// Giải mã và mã hóa lại phản hồi JSON để in đẹp
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
// Đóng phiên cURL
curl_close($curl);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace InstagramFollowerCountGETRequest_csharp
{
class InstagramFollowerCount
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03";
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"onlineFollowersByHour": {
"0": 120, // 12 AM
"1": 113, // 1 AM
"2": 117, // 2 AM
"3": 110, // 3 AM
"4": 129, // 4 AM
"5": 170, // 5 AM
"6": 166, // 6 AM
"7": 173, // 7 AM
"8": 177, // 8 AM
"9": 168, // 9 AM
"10": 178, // 10 AM
"11": 160, // 11 AM
"12": 154, // 12 PM
"13": 153, // 1 PM
"14": 131, // 2 PM
"15": 118, // 3 PM
"16": 109, // 4 PM
"17": 128, // 5 PM
"18": 129, // 6 PM
"19": 134, // 7 PM
"20": 123, // 8 PM
"21": 111, // 9 PM
"22": 102, // 10 PM
"23": 98 // 11 PM
},
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": [
{
"start": "2024-03-29T07:00:00.000Z",
"end": "2024-03-29T07:59:59.999Z",
"onlineFollowers": 33
},
{
"start": "2024-03-29T08:00:00.000Z",
"end": "2024-03-29T08:59:59.999Z",
"onlineFollowers": 90
},
{
"start": "2024-03-29T09:00:00.000Z",
"end": "2024-03-29T09:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T10:00:00.000Z",
"end": "2024-03-29T10:59:59.999Z",
"onlineFollowers": 109
},
{
"start": "2024-03-29T11:00:00.000Z",
"end": "2024-03-29T11:59:59.999Z",
"onlineFollowers": 99
},
{
"start": "2024-03-29T12:00:00.000Z",
"end": "2024-03-29T12:59:59.999Z",
"onlineFollowers": 10
},
{
"start": "2024-03-29T13:00:00.000Z",
"end": "2024-03-29T13:59:59.999Z",
"onlineFollowers": 82
},
{
"start": "2024-03-29T14:00:00.000Z",
"end": "2024-03-29T14:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T15:00:00.000Z",
"end": "2024-03-29T15:59:59.999Z",
"onlineFollowers": 91
},
{
"start": "2024-03-29T16:00:00.000Z",
"end": "2024-03-29T16:59:59.999Z",
"onlineFollowers": 12
},
{
"start": "2024-03-29T17:00:00.000Z",
"end": "2024-03-29T17:59:59.999Z",
"onlineFollowers": 93
},
{
"start": "2024-03-29T18:00:00.000Z",
"end": "2024-03-29T18:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-29T19:00:00.000Z",
"end": "2024-03-29T19:59:59.999Z",
"onlineFollowers": 95
},
{
"start": "2024-03-29T20:00:00.000Z",
"end": "2024-03-29T20:59:59.999Z",
"onlineFollowers": 97
},
{
"start": "2024-03-29T21:00:00.000Z",
"end": "2024-03-29T21:59:59.999Z",
"onlineFollowers": 101
},
{
"start": "2024-03-29T22:00:00.000Z",
"end": "2024-03-29T22:59:59.999Z",
"onlineFollowers": 74
},
{
"start": "2024-03-29T23:00:00.000Z",
"end": "2024-03-29T23:59:59.999Z",
"onlineFollowers": 61
},
{
"start": "2024-03-30T00:00:00.000Z",
"end": "2024-03-30T00:59:59.999Z",
"onlineFollowers": 31
},
{
"start": "2024-03-30T01:00:00.000Z",
"end": "2024-03-30T01:59:59.999Z",
"onlineFollowers": 28
},
{
"start": "2024-03-30T02:00:00.000Z",
"end": "2024-03-30T02:59:59.999Z",
"onlineFollowers": 19
},
{
"start": "2024-03-30T03:00:00.000Z",
"end": "2024-03-30T03:59:59.999Z",
"onlineFollowers": 21
},
{
"start": "2024-03-30T04:00:00.000Z",
"end": "2024-03-30T04:59:59.999Z",
"onlineFollowers": 23
},
{
"start": "2024-03-30T05:00:00.000Z",
"end": "2024-03-30T05:59:59.999Z",
"onlineFollowers": 92
},
{
"start": "2024-03-30T06:00:00.000Z",
"end": "2024-03-30T06:59:59.999Z",
"onlineFollowers": 32
}
],
"startTime": "2024-03-29T07:00:00.000Z",
"endTime": "2024-03-30T07:00:00.000Z"
}
{
"status": "success",
"onlineFollowersByHour": {}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
}
⌘I
