tiktok.affiliate_partner.202405.campaigns
POST/affiliate_partner/202405/campaignsVia 360: POST https://partner.quantri360.com/v1/tiktok/affiliate_partner/202405/campaigns
Write endpoint — changes data on TikTok Shop. The key must be created with "Allow write API calls" ticked, otherwise you get 403 write_not_allowed. Every call is logged.
Description
DÀNH CHO ĐỐI TÁC AFFILIATE: Tạo chiến dịch affiliate cho gian hàng cụ thể hoặc loại người bán đủ điều kiện, gồm thời gian, hoa hồng và liên hệ. Trả campaign_id đồng bộ; phải gọi API công bố để người bán thấy chiến dịch.
- HIỆN CHƯA GỌI ĐƯỢC QUA 360: API này dùng kết nối của creator / đối tác, kết nối gian hàng trả code 36009005. Cần dùng → liên hệ 360.
- API GHI: thay đổi dữ liệu thật trên TikTok Shop; cần key có quyền ghi (can_write) và gói mở module affiliate. Tạo chiến dịch affiliate cho gian hàng cụ thể hoặc loại người bán đủ điều kiện, gồm thời gian, hoa hồng và liên hệ. Trả campaign_id đồng bộ; phải gọi API công bố để người bán thấy chiến dịch.
- HTTP 200 vẫn có thể có lỗi nghiệp vụ; kiểm code trước khi dùng kết quả.
Request
Endpoint
POST https://partner.quantri360.com/v1/tiktok/affiliate_partner/202405/campaigns
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 | 100001 | Gian hàng (lấy ở GET /v1/platforms → shops[].platform_shop_id). BẮT BUỘC khi brand có > 1 gian hàng trên nền tảng; 360 bỏ tham số này trước khi chuyển tiếp. |
Request parameters
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| category_asset_cipher | query | string | Yes | CATEGORY_ASSET_DEMO | Mã tài sản danh mục đã ủy quyền cho đối tác; dùng đúng mã của kết nối đối tác. |
| name | body | string | Yes | Chiến dịch minh họa | Tên chiến dịch, 1–50 ký tự; không bắt đầu bằng khoảng trắng. |
| description | body | string | Yes | Nội dung minh họa | Mô tả chiến dịch, 1–1000 ký tự; không bắt đầu bằng khoảng trắng. |
| campaign_start_time | body | int | Yes | 1893456000 | Thời điểm bắt đầu chiến dịch, Unix giây; không sớm hơn hiện tại. Chỉ đổi được khi READY hoặc UPCOMING. |
| campaign_end_time | body | int | Yes | 1894320000 | Thời điểm kết thúc chiến dịch, Unix giây; sau campaign_start_time, thời lượng 1–360 ngày. Không đổi được khi CLOSED. |
| registration_start_time | body | int | Yes | 1893456000 | Thời điểm mở đăng ký sản phẩm, Unix giây; bằng campaign_start_time. Chỉ đổi được khi READY hoặc UPCOMING. |
| registration_end_time | body | int | Yes | 1893888000 | Thời điểm đóng đăng ký, Unix giây; sau registration_start_time ít nhất 1 ngày, không quá campaign_end_time. Không đổi được khi CLOSED. |
| commission_rate | body | int | Yes | 1000 | Tỷ lệ hoa hồng, đơn vị 0,01%; từ 100 đến 8000, tính cả hai đầu. 3587 tương ứng 35,87%. |
| contact_info | body | object | Yes | Thông tin liên hệ của đối tác. | |
| contact_info.whatsapp | body | string | No | +84900000000 | Số WhatsApp theo E.164; khi tạo chiến dịch, bắt buộc tại MY, SG, GB, ID; tùy chọn tại US; không áp dụng vùng khác. |
| contact_info.email | body | string | Yes | affiliate@example.com | Email liên hệ của đối tác. |
| contact_info.phone | body | string | No | +84900000000 | Số điện thoại liên hệ quốc tế theo E.164. |
| contact_info.zalo | body | string | No | +84900000000 | Số Zalo theo E.164; khi tạo chiến dịch, bắt buộc tại VN, không áp dụng vùng khác. |
| contact_info.viber | body | string | No | +84900000000 | Số Viber theo E.164; khi tạo chiến dịch, bắt buộc tại PH, không áp dụng vùng khác. |
| contact_info.line | body | string | No | +84900000000 | Số LINE theo E.164; khi tạo chiến dịch, bắt buộc tại TH, không áp dụng vùng khác. |
| target_shop_codes | body | []string | No | ["SHOP_DEMO_001"] | Các mã gian hàng được đăng ký chiến dịch, ít hơn 100 phần tử; chọn một trong target_shop_codes và target_seller_types. |
| target_seller_types | body | []string | No | ["LOCAL"] | Loại người bán được đăng ký: LOCAL hoặc CROSS_BORDER; chọn một trong target_seller_types và target_shop_codes. |
Request examples
curl -s -X POST "https://partner.quantri360.com/v1/tiktok/affiliate_partner/202405/campaigns?category_asset_cipher=CATEGORY_ASSET_DEMO" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Chiến dịch minh họa","description":"Nội dung minh họa","campaign_start_time":1893456000,"campaign_end_time":1894320000,"registration_start_time":1893456000,"registration_end_time":1893888000,"commission_rate":1000,"contact_info":{"whatsapp":"+84900000000","email":"affiliate@example.com","phone":"+84900000000","zalo":"+84900000000","viber":"+84900000000","line":"+84900000000"},"target_seller_types":["LOCAL"]}'
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.post(
"https://partner.quantri360.com/v1/tiktok/affiliate_partner/202405/campaigns",
params={
"category_asset_cipher": "CATEGORY_ASSET_DEMO"
},
json={
"name": "Chiến dịch minh họa",
"description": "Nội dung minh họa",
"campaign_start_time": 1893456000,
"campaign_end_time": 1894320000,
"registration_start_time": 1893456000,
"registration_end_time": 1893888000,
"commission_rate": 1000,
"contact_info": {
"whatsapp": "+84900000000",
"email": "affiliate@example.com",
"phone": "+84900000000",
"zalo": "+84900000000",
"viber": "+84900000000",
"line": "+84900000000"
},
"target_seller_types": [
"LOCAL"
]
},
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/tiktok/affiliate_partner/202405/campaigns');
for (const [k, v] of Object.entries({"category_asset_cipher":"CATEGORY_ASSET_DEMO"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
method: 'POST',
headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"name":"Chiến dịch minh họa","description":"Nội dung minh họa","campaign_start_time":1893456000,"campaign_end_time":1894320000,"registration_start_time":1893456000,"registration_end_time":1893888000,"commission_rate":1000,"contact_info":{"whatsapp":"+84900000000","email":"affiliate@example.com","phone":"+84900000000","zalo":"+84900000000","viber":"+84900000000","line":"+84900000000"},"target_seller_types":["LOCAL"]}),
});
console.log(r.status, await r.json());PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/tiktok/affiliate_partner/202405/campaigns' . '?' . http_build_query(['category_asset_cipher' => 'CATEGORY_ASSET_DEMO']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name":"Chiến dịch minh họa","description":"Nội dung minh họa","campaign_start_time":1893456000,"campaign_end_time":1894320000,"registration_start_time":1893456000,"registration_end_time":1893888000,"commission_rate":1000,"contact_info":{"whatsapp":"+84900000000","email":"affiliate@example.com","phone":"+84900000000","zalo":"+84900000000","viber":"+84900000000","line":"+84900000000"},"target_seller_types":["LOCAL"]}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;Response
Response fields (as returned by TikTok Shop)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | int | 0 | Mã kết quả; 0 là thành công. |
| message | string | Success | Thông báo kết quả. |
| request_id | string | DEMO_AFFILIATE_REQUEST | Mã truy vết yêu cầu. |
| data | object | Dữ liệu phản hồi. | |
| campaign_id | string | 100000000000000101 | Mã chiến dịch. |
Response sample
{
"code": 0,
"message": "Success",
"request_id": "DEMO_AFFILIATE_REQUEST",
"data": {
"campaign_id": "100000000000000101"
}
}
Get started
- Sign up for Partner
- Enable a data type of the Affiliate group on the platform page
- Create an API key (tick the TikTok Shop channel)
- Call it as in the examples above