VI | EN
Message us on Messenger
Developer resources

Ad preview — Facebook API

Ad Previews · 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 Previews

GET/{version}/{ad_id}/previewsVia 360: GET https://partner.quantri360.com/v1/facebook/{version}/{ad_id}/previews
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

Xem trước một quảng cáo ở một vị trí hiển thị (bảng tin Facebook di động / máy tính, Instagram, Reels…): trả đoạn HTML <iframe> để nhúng vào trang của bạn. Dùng để duyệt nội dung quảng cáo trong báo cáo, gửi khách / quản lý xem trước mà không cần vào Trình quản lý quảng cáo.

  • Gọi bằng token tài khoản quảng cáo: gửi platform_shop_id=act_<id> khi brand có nhiều tài sản Facebook.
  • Thiếu ad_format → Meta trả (#100) For field 'previews': The parameter ad_format is required; giá trị lạ → ad_format must be one of the following values: … (liệt kê mọi vị trí hợp lệ).
  • Phản hồi là HTML để nhúng (&amp; đã được mã hóa sẵn) — chèn nguyên body vào trang; link iframe mang mã riêng của lần gọi, không dựng tay.

Request

Endpoint

GET https://partner.quantri360.com/v1/facebook/{version}/{ad_id}/previews

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
ad_idpathstringYes120250637300020254Id quảng cáo.
platform_shop_idquerystringNoact_5924809560908319Tài khoản quảng cáo chứa quảng cáo, dạng act_<id>. BẮT BUỘC khi brand nối nhiều tài sản Facebook.
ad_formatquerystringYesMOBILE_FEED_STANDARDVị trí xem trước: MOBILE_FEED_STANDARD (bảng tin di động) · DESKTOP_FEED_STANDARD (bảng tin máy tính) · INSTAGRAM_STANDARD · FACEBOOK_REELS_MOBILE … Giá trị sai → Meta trả lỗi kèm danh sách đầy đủ.

Request examples

curl -s "https://partner.quantri360.com/v1/facebook/v25.0/120250637300020254/previews?platform_shop_id=act_5924809560908319&ad_format=MOBILE_FEED_STANDARD" \
  -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/120250637300020254/previews",
    params={
        "platform_shop_id": "act_5924809560908319",
        "ad_format": "MOBILE_FEED_STANDARD"
    },
    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/120250637300020254/previews');
for (const [k, v] of Object.entries({"platform_shop_id":"act_5924809560908319","ad_format":"MOBILE_FEED_STANDARD"})) 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/120250637300020254/previews' . '?' . http_build_query(['platform_shop_id' => 'act_5924809560908319', 'ad_format' => 'MOBILE_FEED_STANDARD']);
$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[]Thường 1 phần tử.
bodystring<iframe src="…/ads/api/preview_iframe.php?d=…&amp;t=…" width="335" height="450" …></iframe>HTML iframe xem trước; kích thước theo vị trí (gọi thật: di động 335×450, máy tính 540×690, Instagram 320×525).

Response sample

{
  "data": [
    {
      "body": "<iframe src=\"https://business.facebook.com/ads/api/preview_iframe.php?d=AQLJP9pLHi-3dwz8…&amp;t=AQJ7H6fhxAzlH9a8NVg\" width=\"335\" height=\"450\" scrolling=\"yes\" style=\"border: none;\" allow=\"autoplay\"></iframe>"
    }
  ]
}

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