VI | EN
Message us on Messenger
Developer resources

Create a lookalike audience — TikTok Business API

Create a lookalike audience · 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.

Create a lookalike audience

POST/dmp/custom_audience/lookalike/create/Via 360: POST https://partner.quantri360.com/v1/tiktok_business/dmp/custom_audience/lookalike/create/
Write endpoint — changes data on TikTok Business. The key must be created with "Allow write API calls" ticked, otherwise you get 403 write_not_allowed. Every call is logged.
Description

Use this endpoint to create a lookalike audience. You need to provide an existing audience under your advertiser account.

>Note

  • Newly created audiences require at most 48 hours to be analyzed and processed before they become active.
  • Use /dmp/custom_audience/get/ to check the current status of an audience. Only available (is_valid) audiences can be operated on.

Comparing v1.2 and v1.3

The following table outlines the differences between v1.2 and v1.3 endpoints.

 |Changes{30%}|v1.2{35%}|v1.3{35%}|
|---|---|---|
|Endpoint path|/v1.2/dmp/custom_audience/lookalike/create/|/v1.3/dmp/custom_audience/lookalike/create/|
|Request parameter name|`system`|`mobile_os`|
|Request parameter data type |`advertiser_id`: number
`source_audience_id`: number
` placements`: string|`advertiser_id`: string
`source_audience_id`: string
` placements`: string[]|
|Request parameter name and data type|`is_contain_source`: number|`include_source`: boolean|
|Response parameter data type |`custom_audience_id`: number|`custom_audience_id`: string|

Request

Endpoint

POST https://partner.quantri360.com/v1/tiktok_business/dmp/custom_audience/lookalike/create/

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
custom_audience_namebodystringYesAudience name. Maximum of 128 characters.
audience_sub_typebodystringNoAudience sub type, indicating the type of ads that the audience can be used. Enum values: NORMAL Normal audience. It can be used in non-R&F ads. REACH_FREQUENCY: Audience for Reach & Frequency. It can only be used in R&F ads. Default: NORMAL.
lookalike_specbodyobjectYes

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/tiktok_business/dmp/custom_audience/lookalike/create/" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"custom_audience_name":"","lookalike_spec":{"source_audience_id":"","include_source":false,"mobile_os":"","placements":[],"location_ids":[],"audience_size":""}}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/tiktok_business/dmp/custom_audience/lookalike/create/",
    params={},
    json={
        "custom_audience_name": "",
        "lookalike_spec": {
            "source_audience_id": "",
            "include_source": False,
            "mobile_os": "",
            "placements": [],
            "location_ids": [],
            "audience_size": ""
        }
    },
    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/dmp/custom_audience/lookalike/create/');
for (const [k, v] of Object.entries({})) 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({"custom_audience_name":"","lookalike_spec":{"source_audience_id":"","include_source":false,"mobile_os":"","placements":[],"location_ids":[],"audience_size":""}}),
});
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/dmp/custom_audience/lookalike/create/' . '?' . http_build_query([]);
$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, '{"custom_audience_name":"","lookalike_spec":{"source_audience_id":"","include_source":false,"mobile_os":"","placements":[],"location_ids":[],"audience_size":""}}');
$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
codenumberResponse code. For the complete list of response codes and descriptions, see Appendix - Return Codes.
messagestringResponse message. For details, see Appendix - Return Codes.
dataobjectReturned Data.
custom_audience_idstringCustom audience ID.
request_idstringThe log id of a request, which uniquely identifies the request.

Response sample

HTTPS/1.1 200 OK
{
    "message": "OK",
    "code": 0,
    "data": {
        "custom_audience_id": "123"
    }
}
(/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