VI | EN
Message us on Messenger
Developer resources

Ad videos of an account — Facebook API

Ad Videos · 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.

Ad Videos

GET/{version}/act_{account_id}/advideosVia 360: GET https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/advideos
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

Thư viện video quảng cáo của tài khoản: id video (dùng khi tạo creative video), tiêu đề, thời lượng, ảnh đại diện, trạng thái xử lý. Dùng để tìm video đã tải, kiểm video đã xử lý xong chưa, lấy id video để chọn ảnh bìa (/{video_id}/thumbnails).

  • Đường dẫn có act_<id> → 360 tự chọn token tài khoản.
  • Ngày giờ ở đây là UTC, khác ảnh (adimages) theo múi giờ tài khoản.
  • Video chỉ dùng được khi status.video_status = ready.

Request

Endpoint

GET https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/advideos

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
account_idpathstringYes5924809560908319Id tài khoản quảng cáo (số, không có act_).
fieldsquerystringNoid,title,length,created_time,updated_time,picture,source,permalink_url,statusTrường cần lấy. Không gửi = chỉ id.
titlequerystringNoLọc theo tên video.
minlength / maxlengthqueryintNo15Lọc theo thời lượng (giây).
minwidth / maxwidth / minheight / maxheightqueryintNoLọc theo kích thước (px).
min_aspect_ratio / max_aspect_ratioqueryfloatNo0.5625Lọc theo tỉ lệ khung (rộng / cao).
limitqueryintNo25Số video mỗi trang.
afterquerystringNoCon trỏ trang kế.

Pagination

Lặp khi có paging.next: thêm after = paging.cursors.after.

Request examples

curl -s "https://partner.quantri360.com/v1/facebook/v25.0/act_5924809560908319/advideos?fields=id%2Ctitle%2Clength%2Ccreated_time%2Cpicture%2Cstatus&limit=25" \
  -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/act_5924809560908319/advideos",
    params={
        "fields": "id,title,length,created_time,picture,status",
        "limit": 25
    },
    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/advideos');
for (const [k, v] of Object.entries({"fields":"id,title,length,created_time,picture,status","limit":25})) 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/act_5924809560908319/advideos' . '?' . http_build_query(['fields' => 'id,title,length,created_time,picture,status', 'limit' => 25]);
$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[]Video, mới tải trước.
idstring482757654744969Id video.
titlestring50.mp4Tên video (thường là tên tệp).
lengthfloat76.544Thời lượng (giây).
created_time / updated_timestring2024-10-08T09:14:11+0000Giờ UTC (`+0000`).
picturestringẢnh đại diện nhỏ (link CDN có hạn).
sourcestringLink tải tệp video (CDN có hạn).
permalink_urlstring/23853297670470253/videos/482757654744969/Đường dẫn tương đối trên facebook.com.
statusobject`video_status` (`ready` = dùng được) + `uploading_phase` / `processing_phase` / `publishing_phase`.
pagingobject`{cursors: {before, after}, next}`.

Response sample

{
  "data": [
    {
      "id": "482757654744969",
      "title": "50 (2).mp4",
      "length": 76.544,
      "created_time": "2024-10-08T09:14:11+0000",
      "updated_time": "2024-10-08T09:17:31+0000",
      "picture": "https://scontent.fsgn13-2.fna.fbcdn.net/v/t15.13418-10/…",
      "permalink_url": "/23853297670470253/videos/482757654744969/?idorvanity=23853297670470253",
      "status": {
        "video_status": "ready",
        "uploading_phase": {
          "status": "complete"
        },
        "processing_phase": {
          "status": "complete"
        },
        "publishing_phase": {
          "status": "complete",
          "publish_status": "published",
          "publish_time": "2024-10-08T09:14:11+0000"
        }
      }
    }
  ],
  "paging": {
    "cursors": {
      "before": "QVFIVG9ib3JP…",
      "after": "QVFIVHIzNkFC…"
    }
  }
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the Quảng cáo (Marketing API) group on the platform page
  3. Create an API key (tick the Facebook channel)
  4. Call it as in the examples above