Async Insights Report
POST/{version}/act_{account_id}/insightsVia 360: POST https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/insights
Coming soon. This API already runs in production through 360 and pricing is being finalised — you can read the docs and prepare your integration now.
Description
Tạo báo cáo insight BẤT ĐỒNG BỘ cho kỳ dài / nhiều dòng (tránh lỗi quá thời gian của bản đọc trực tiếp GET /act_{account_id}/insights). Trả report_run_id; theo dõi tiến độ bằng GET /{version}/{object_id} (object_id = report_run_id) rồi đọc kết quả bằng GET /{version}/{object_id}/insights. Không thay đổi gì trên tài khoản.
- Đường dẫn có
act_<id>→ 360 tự chọn token tài khoản. Tham số gửi trên query (đã gọi thật). - Theo dõi:
GET /{version}/<report_run_id>trảasync_status(Job Not Started·Job Started·Job Running·Job Completed·Job Failed·Job Skipped) vàasync_percent_completion(0–100). Xong khiJob Completed+ 100. Gọi thật kỳ 30 ngày cấp chiến dịch: xong sau khoảng 4 giây. - Kết quả:
GET /{version}/<report_run_id>/insights— cùng cấu trúcdata/pagingnhư bản GET, kèmdate_start,date_stop. report_run_idhết hạn sau 30 ngày — không lưu lâu dài.Job Skipped= báo cáo đã hết hạn, tạo lại.Job Failed= rà lại tham số (kỳ quá lớn → chia nhỏ kỳ).- Báo cáo lớn có thể chạy tới khoảng một giờ. Bản đồng bộ và bất đồng bộ dùng chung hạn mức tài khoản — vượt thì Meta trả code 4 / 17 / 80004.
Request
Endpoint
POST https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/insights
Authentication & shop
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer q360_live_ab12cd34_… | Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand. |
| platform_shop_id | query | string | act_123456789 hoặc 1234567890 | Tài sản Facebook brand đã nối với 360: tài khoản quảng cáo (act_<id> hoặc <id>), Page id hoặc Pixel id — lấy ở GET /v1/platforms. Có thể bỏ khi đường dẫn đã chứa act_<id> / page id của brand. |
Request parameters
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| version | path | string | Yes | v25.0 | |
| account_id | path | string | Yes | 5924809560908319 | Id tài khoản quảng cáo (số, không có act_). |
| level | query | string | No | campaign | account | campaign | adset | ad. |
| fields | query | string | No | campaign_id,campaign_name,spend,impressions,clicks,actions | Trường insight như bản GET. |
| date_preset | query | string | No | last_30d | Khoảng có sẵn: today · yesterday · last_7d · last_30d · this_month · last_month … |
| time_range | query | string | No | {"since":"2026-01-01","until":"2026-10-29"} | Hoặc khoảng ngày tự chọn (YYYY-MM-DD). |
| time_increment | query | string | No | 1 | 1 = tách theo ngày; monthly = theo tháng. |
| breakdowns | query | string | No | age,gender | Chiều phân rã. |
| filtering | query | string | No | [{"field":"campaign.id","operator":"IN","value":["120250025975490254"]}] | Bộ lọc JSON. |
Request examples
curl -s -X POST "https://partner.quantri360.com/v1/facebook/v25.0/act_5924809560908319/insights?level=campaign&date_preset=last_30d&fields=campaign_id%2Ccampaign_name%2Cspend%2Cimpressions%2Cclicks" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{}'
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.post(
"https://partner.quantri360.com/v1/facebook/v25.0/act_5924809560908319/insights",
params={
"level": "campaign",
"date_preset": "last_30d",
"fields": "campaign_id,campaign_name,spend,impressions,clicks"
},
json={},
headers={"Authorization": f"Bearer {KEY}"},
timeout=60,
)
print(r.status_code)
print(r.json())Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/facebook/v25.0/act_5924809560908319/insights');
for (const [k, v] of Object.entries({"level":"campaign","date_preset":"last_30d","fields":"campaign_id,campaign_name,spend,impressions,clicks"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
method: 'POST',
headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({}),
});
console.log(r.status, await r.json());PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/facebook/v25.0/act_5924809560908319/insights' . '?' . http_build_query(['level' => 'campaign', 'date_preset' => 'last_30d', 'fields' => 'campaign_id,campaign_name,spend,impressions,clicks']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;Response
Response fields (as returned by Facebook)
| Name | Type | Sample | Description |
|---|---|---|---|
| report_run_id | string | 1446432480953387 | Id báo cáo — truyền vào `GET /{version}/{object_id}` và `GET /{version}/{object_id}/insights` (kèm `platform_shop_id=act_<id>`). |
Response sample
{
"report_run_id": "1446432480953387"
}
Get started
- Sign up for Partner
- Enable a data type of the Quảng cáo (Marketing API) group on the platform page
- Create an API key (tick the Facebook channel)
- Call it as in the examples above