VI | EN
Message us on Messenger
Developer resources

Video insights — Facebook API

Video Insights · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

Video Insights

GET/{version}/{video_id}/video_insightsVia 360: GET https://partner.quantri360.com/v1/facebook/{version}/{video_id}/video_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

Số liệu trọn đời của một video / Reels / video live đã lưu: lượt xem, lượt phát, thời gian xem, tỷ lệ giữ chân, phân rã trả phí / tự nhiên, theo độ tuổi – giới tính, vùng. Đo hiệu quả từng video.

  • Bộ metric khác nhau theo loại: hỏi metric của video thường (total_video_views, total_video_avg_time_watched) trên một Reels trả {"data": []} (HTTP 200, không báo lỗi).
  • Đơn vị: post_video_avg_time_watched, post_video_view_time, total_video_view_time_by_* (trừ theo quốc gia) tính bằng MILI GIÂY; total_video_view_time_by_country_id tính bằng PHÚT.
  • Không có phân trang; gọi không metric với video live có thể trả > 20 KB — nên chỉ định metric cần dùng.

Request

Endpoint

GET https://partner.quantri360.com/v1/facebook/{version}/{video_id}/video_insights

Authentication & shop

NameInTypeSampleDescription
AuthorizationheaderheaderBearer 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_idquerystringact_123456789 hoặc 1234567890Tà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

NameInTypeRequiredSampleDescription
versionpathstringYesv25.0
video_idpathstringYes4549970258576884Id video (từ /videos, /video_reels, hoặc video.id của /live_videos).
metricquerystringNofb_reels_total_plays,post_video_avg_time_watchedDanh sách metric cách dấu phẩy. Không gửi = TẤT CẢ metric áp dụng cho loại video đó. Reels: fb_reels_total_plays, blue_reels_play_count, fb_reels_replay_count, post_video_avg_time_watched, post_video_view_time, post_video_retention_graph, post_video_social_actions, post_video_likes_by_reaction_type, post_video_followers. Video thường / live: total_video_views, total_video_views_organic, total_video_views_paid, total_video_play_count, total_video_complete_views, total_video_30s_views, total_video_view_time_by_age_bucket_and_gender, total_video_view_time_by_region_id …
periodquerystringNolifetimeVideo chỉ có lifetime.

Request examples

curl -s "https://partner.quantri360.com/v1/facebook/v25.0/4549970258576884/video_insights?metric=fb_reels_total_plays%2Cpost_video_avg_time_watched" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/facebook/v25.0/4549970258576884/video_insights",
    params={
        "metric": "fb_reels_total_plays,post_video_avg_time_watched"
    },
    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/4549970258576884/video_insights');
for (const [k, v] of Object.entries({"metric":"fb_reels_total_plays,post_video_avg_time_watched"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'GET',
  headers: { Authorization: `Bearer ${KEY}` },
});
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/4549970258576884/video_insights' . '?' . http_build_query(['metric' => 'fb_reels_total_plays,post_video_avg_time_watched']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
$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)

NameTypeSampleDescription
dataobject[]Mỗi phần tử một metric.
namestringfb_reels_total_playsTên metric.
periodstringlifetime
valuesobject[][{"value":116}]`[{value}]` — value là số, hoặc object với metric phân rã (vd `{"shared":13,"page_owned":5368}`, `{"F.25-34":28968645,…}`, đồ thị giữ chân `{"0":1,"1":1,…}`).
title / descriptionstringTên + giải thích metric theo ngôn ngữ của token.
idstring`<video_id>/video_insights/<metric>/lifetime`.

Response sample

{
  "data": [
    {
      "name": "fb_reels_total_plays",
      "period": "lifetime",
      "values": [
        {
          "value": 116
        }
      ],
      "title": "Lượt phát trọn đời",
      "description": "Số lần thước phim bắt đầu phát sau khi hệ thống đã tính lượt hiển thị…",
      "id": "4549970258576884/video_insights/fb_reels_total_plays/lifetime"
    },
    {
      "name": "post_video_avg_time_watched",
      "period": "lifetime",
      "values": [
        {
          "value": 2368
        }
      ],
      "title": "Thời gian xem thước phim trung bình trọn đời",
      "description": "Trọn đời: thời gian phát thước phim trung bình (tính bằng mili giây)…",
      "id": "4549970258576884/video_insights/post_video_avg_time_watched/lifetime"
    }
  ]
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the Trang & Messenger group on the platform page
  3. Create an API key (tick the Facebook channel)
  4. Call it as in the examples above