VI | EN
Message us on Messenger
Developer resources

Custom audiences of an account — Facebook API

Custom Audiences · 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.

Custom Audiences

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

Đối tượng tùy chỉnh của tài khoản (tương tác Trang, khách truy cập web, danh sách khách hàng, đối tượng tương tự…): loại, quy mô ước tính, còn dùng được để chạy không, số ngày giữ. Dùng để rà tệp đối tượng, phát hiện tệp quá nhỏ / lỗi trước khi gắn vào nhóm quảng cáo.

  • Đường dẫn có act_<id> → 360 tự chọn token tài khoản.
  • description trong delivery_status / operation_status theo ngôn ngữ người ủy quyền — dùng code để xử lý tự động.
  • Thời gian ở đây là unix giây, khác phần lớn API quảng cáo (ISO 8601).

Request

Endpoint

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

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,name,subtype,description,approximate_count_lower_bound,approximate_count_upper_bound,delivery_status,operation_status,retention_days,time_created,time_updated,data_sourceTrường cần lấy. Không gửi = chỉ id.
filteringquerystringNo[{"field":"subtype","operator":"EQUAL","value":"LOOKALIKE"}]Mảng JSON bộ lọc {field, operator, value}.
pixel_idquerystringNoChỉ lấy đối tượng tạo từ pixel này.
limitqueryintNo50Số đối tượng 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/customaudiences?fields=id%2Cname%2Csubtype%2Capproximate_count_lower_bound%2Capproximate_count_upper_bound%2Cdelivery_status%2Coperation_status%2Cretention_days%2Ctime_created&limit=50" \
  -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/customaudiences",
    params={
        "fields": "id,name,subtype,approximate_count_lower_bound,approximate_count_upper_bound,delivery_status,operation_status,retention_days,time_created",
        "limit": 50
    },
    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/customaudiences');
for (const [k, v] of Object.entries({"fields":"id,name,subtype,approximate_count_lower_bound,approximate_count_upper_bound,delivery_status,operation_status,retention_days,time_created","limit":50})) 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/customaudiences' . '?' . http_build_query(['fields' => 'id,name,subtype,approximate_count_lower_bound,approximate_count_upper_bound,delivery_status,operation_status,retention_days,time_created', 'limit' => 50]);
$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[]Đối tượng, mới tạo trước.
idstring120250043666960623Id đối tượng — dùng trong `targeting.custom_audiences`.
namestring
subtypestringENGAGEMENTLoại: `ENGAGEMENT` (tương tác) · `WEBSITE` · `CUSTOM` (danh sách khách) · `LOOKALIKE` (tương tự) · `VIDEO` …
approximate_count_lower_bound / approximate_count_upper_boundint5600 / 6600Quy mô ước tính (khoảng). `-1` = chưa ước tính được (đối tượng tương tự, tệp lỗi) — KHÔNG có nghĩa là rỗng.
delivery_statusobject`{code, description}` — `200` dùng được; `300` quá nhỏ, không chạy được.
operation_statusobject`{code, description}` — `200` bình thường; `433` tạo đối tượng tương tự thất bại; `450` lâu không dùng nên ngừng cập nhật…
retention_daysint60Số ngày giữ người trong tệp (0 = không áp dụng).
time_created / time_updatedint1783398932Unix giây.
data_sourceobject`{type, sub_type, creation_params}` — nguồn dữ liệu tạo tệp.
pagingobject`{cursors: {before, after}, next}`.

Response sample

{
  "data": [
    {
      "id": "120250043666960623",
      "name": "ib 60day 2 page",
      "subtype": "ENGAGEMENT",
      "description": "",
      "approximate_count_lower_bound": 5600,
      "approximate_count_upper_bound": 6600,
      "delivery_status": {
        "code": 200,
        "description": "Đối tượng này đã được sử dụng."
      },
      "operation_status": {
        "code": 450,
        "description": "Đối tượng này không được dùng cho quảng cáo trong 30 ngày qua…"
      },
      "retention_days": 60,
      "time_created": 1783398932,
      "time_updated": 1783398932,
      "data_source": {
        "type": "EVENT_BASED",
        "sub_type": "ENGAGEMENT_EVENTS",
        "creation_params": "{\"prefill\":\"true\"}"
      }
    },
    {
      "id": "120217037932160041",
      "name": "Đối tượng tương tự (VN, 2%)",
      "subtype": "LOOKALIKE",
      "approximate_count_lower_bound": -1,
      "approximate_count_upper_bound": -1,
      "delivery_status": {
        "code": 300,
        "description": "Quy mô đối tượng quá nhỏ nên không dùng để tạo chiến dịch được."
      },
      "operation_status": {
        "code": 433,
        "description": "Chúng tôi không thể tạo đối tượng tương tự của bạn…"
      },
      "retention_days": 0,
      "time_created": 1741677635,
      "time_updated": 1741677635,
      "data_source": {
        "type": "SEED_BASED",
        "sub_type": "PLATFORM_USERS",
        "creation_params": "[]"
      }
    }
  ],
  "paging": {
    "cursors": {
      "before": "QVFIVGdjWDBX…",
      "after": "QVFIVFZAKbFpH…"
    }
  }
}

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