Ad Rules
GET/{version}/act_{account_id}/adrules_libraryVia 360: GET https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/adrules_library
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
Luật tự động của tài khoản (ví dụ "tắt quảng cáo khi chi > 30.000đ mà chưa có tin nhắn"): điều kiện đánh giá, hành động, lịch chạy, trạng thái. Dùng để rà luật đang bật, đối chiếu khi chiến dịch bị tắt tự động.
- Đường dẫn có
act_<id>→ 360 tự chọn token tài khoản. - Giá trị tiền trong
filterscùng đơn vị ngân sách (VND = đồng), dạng chuỗi. - Bộ lọc
adset.id INcó thể chứa hàng trăm id (gọi thật: luật mẫu trỏ ~700 nhóm) — phản hồi rất dài, giữlimitnhỏ. - Có tên người tạo — xử lý như dữ liệu cá nhân.
Request
Endpoint
GET https://partner.quantri360.com/v1/facebook/{version}/act_{account_id}/adrules_library
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_). |
| fields | query | string | No | id,name,status,evaluation_spec,execution_spec,schedule_spec,created_time,updated_time,created_by | Trường cần lấy. Không gửi = chỉ id, name. |
| limit | query | int | No | 25 | |
| after | query | string | No | Con 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/adrules_library?fields=id%2Cname%2Cstatus%2Cevaluation_spec%2Cexecution_spec%2Cschedule_spec%2Cupdated_time&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/adrules_library",
params={
"fields": "id,name,status,evaluation_spec,execution_spec,schedule_spec,updated_time",
"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/adrules_library');
for (const [k, v] of Object.entries({"fields":"id,name,status,evaluation_spec,execution_spec,schedule_spec,updated_time","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/adrules_library' . '?' . http_build_query(['fields' => 'id,name,status,evaluation_spec,execution_spec,schedule_spec,updated_time', '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)
| Name | Type | Sample | Description |
|---|---|---|---|
| data | object[] | Luật. | |
| id | string | 23854305460760253 | Id luật — đọc lịch sử chạy ở `GET /{version}/{rule_id}/history`. |
| name | string | off ads | |
| status | string | ENABLED | `ENABLED` · `DISABLED` · `HAS_ISSUES` (luật lỗi, ví dụ trỏ tới đối tượng đã xóa). |
| evaluation_spec | object | `evaluation_type` (`SCHEDULE` theo lịch | `TRIGGER` khi số liệu đổi) + `filters[{field, operator, value}]` — ví dụ `spent GREATER_THAN 30000`, `adset.id IN [...]`, `time_preset`, `entity_type`. | |
| execution_spec | object | `execution_type` (`PAUSE` · `UNPAUSE` · `CHANGE_BUDGET` · `NOTIFICATION` …) + `execution_options` (người nhận thông báo, mức tăng giảm ngân sách…). | |
| schedule_spec | object | `schedule_type`: `SEMI_HOURLY` (30 phút) · `HOURLY` · `DAILY` · `CUSTOM`. | |
| created_time / updated_time | string | 2023-05-17T00:47:28+0700 | Theo múi giờ tài khoản. |
| created_by | object | `{id, name}` người tạo — dữ liệu cá nhân. | |
| paging | object | `{cursors: {before, after}}`. |
Response sample
{
"data": [
{
"id": "23854305460760253",
"name": "off ads",
"status": "ENABLED",
"evaluation_spec": {
"evaluation_type": "SCHEDULE",
"filters": [
{
"field": "spent",
"value": "23000",
"operator": "GREATER_THAN"
},
{
"field": "result",
"value": "1",
"operator": "LESS_THAN"
},
{
"field": "adset.id",
"value": [
"23854305418270253",
"23854305418300253"
],
"operator": "IN"
},
{
"field": "entity_type",
"value": "ADSET",
"operator": "EQUAL"
},
{
"field": "time_preset",
"value": "MAXIMUM",
"operator": "EQUAL"
}
]
},
"execution_spec": {
"execution_type": "PAUSE",
"execution_options": [
{
"field": "user_ids",
"value": [
"100000000000001"
],
"operator": "EQUAL"
},
{
"field": "alert_preferences",
"value": {
"instant": {
"trigger": "CHANGE"
}
},
"operator": "EQUAL"
}
]
},
"schedule_spec": {
"schedule_type": "SEMI_HOURLY"
},
"created_time": "2023-05-17T00:47:28+0700",
"updated_time": "2023-12-06T03:24:19+0700",
"created_by": {
"name": "Nguyễn Văn A",
"id": "100000000000001"
}
}
],
"paging": {
"cursors": {
"before": "MTIwMjAyMDk2NjY5NzMwMjU0",
"after": "MjM4NTQzMDU0NjA3NjAyNTMZD"
}
}
}
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