VI | EN
Message us on Messenger
Developer resources

Query contracts — TikTok Business API

Query contracts · 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.

Query contracts

GET/rf/contract/query/Via 360: GET https://partner.quantri360.com/v1/tiktok_business/rf/contract/query/
Description

Use this endpoint to query contracts. Since commercial contracts are time-sensitive, you will need to specify a date to check the start and end date of valid contracts that cover that date.

Request

Endpoint

GET https://partner.quantri360.com/v1/tiktok_business/rf/contract/query/

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_idquerystring7000000000000000001Tài sản TikTok Business đã kết nối — "Mã tài sản" ở trang Nền tảng hoặc GET /v1/platforms (tài khoản quảng cáo cho Marketing API, tài khoản TikTok cho Organic / Messaging). Có thể bỏ khi chỉ kết nối một tài sản.

Request parameters

NameInTypeRequiredSampleDescription
included_datequerystringYesA certain date within the contract validity, or the start/end time of an ad group. Format: "2020-09-18".
rf_campaign_typequerystringNoUse this field to specify whether you want to query TikTok Pulse contract. Enum values: STANDARD (Reach & Frequency), PULSE(TikTok Pulse). Note: This is an allowlist-only feature. If you would like to access it, please contact your TikTok representative.

Request examples

curl -s "https://partner.quantri360.com/v1/tiktok_business/rf/contract/query/?included_date=" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/tiktok_business/rf/contract/query/",
    params={
        "included_date": ""
    },
    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_business/rf/contract/query/');
for (const [k, v] of Object.entries({"included_date":""})) 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/tiktok_business/rf/contract/query/' . '?' . http_build_query(['included_date' => '']);
$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 TikTok Business)

NameTypeSampleDescription
codenumberReturn code. For the complete list of response codes and descriptions, see Appendix - Return Codes
messagestringReturn messages. For details, see Appendix - Return Codes
request_idstringThe log ID of a request, which uniquely identifies the request.
dataobjectReturned data.
has_valid_contractbooleanWhether valid contracts can be found. Enum values: `True`, `False`. - The correct contract start date and end date will be returned only when `has_valid_contract` = `True`, which means the specified `included_date` falls within the validity period of the Reach and Frequency contract or TikTok Pulse contract. - If `rf_campaign_type` is not set as `PULSE` in the request, `has_valid_contract` is `True`when the specified `included_date` is a date within the Reach and Frequency contract validity period ( `[start_date, end_date]`). - If `rf_campaign_type` is set as `PULSE` in the request, `has_valid_contract` is `True`when the specified `included_date` is a date within the TikTok Pulse contract validity period ( `[pulse_start_date, pulse_end_date]`).
pulse_start_datestringStart date of TikTok Pulse contract. Returned when `rf_campaign_type` is set to `PULSE` in your request. Note: When you use /campaign/create/ to create an R&F campaign and set `rf_campaign_type` to `PULSE`, the schedule delivery time of your ad group (`[schedule_start_time, schedule_end_time]`) must fall on the intersection of `[start_date, end_date]` and `[pulse_start_date, pulse_end_date]` returned in this contract endpoint.
pulse_end_datestringEnd date of TikTok Pulse contract. Returned when `rf_campaign_type` is set to `PULSE` in your request. Note: When you use /campaign/create/ to create an R&F campaign and set `rf_campaign_type` to `PULSE`, the schedule delivery time of your ad group (`[schedule_start_time, schedule_end_time]`) must fall on the intersection of `[start_date, end_date]` and `[pulse_start_date, pulse_end_date]` returned in this contract endpoint.
start_datestringStart date of Reach and Frequency contract.
end_datestringEnd date of Reach and Frequency contract.

Response sample

HTTPS/1.1 200 OK
{    
"message": "OK", 
"code": 0,    "data": 
	{        
		"has_valid_contract": true,        
		"start_date": "2020-10-01",       
		"end_date": "2020-11-30"   
		},   
	"request_id": "1E044AD4"}
(/code);

Get started

  1. Sign up for Partner
  2. Enable a data type of the Ads (Marketing API) group on the platform page
  3. Create an API key (tick the TikTok Business channel)
  4. Call it as in the examples above