VI | EN
Message us on Messenger
Developer resources

Create a pixel — TikTok Business API

Create a pixel · 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 pixel

POST/pixel/create/Via 360: POST https://partner.quantri360.com/v1/tiktok_business/pixel/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 Pixel and install it on your website. Please refer to Installing Pixel for help.

> Important

> By using Events API endpoints, you agree to the TikTok Business Products (Data) Terms and that you will not share sensitive data with TikTok.

Preconditions:

  • You must own a business website.
  • You must have permission to edit the website's code.

Note:

  • It is recommended that the pixel name corresponds with your website or domain name. The length cannot exceed 40 characters and should not be duplicated.
  • We recommended using one pixel per website.

Request

Endpoint

POST https://partner.quantri360.com/v1/tiktok_business/pixel/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
pixel_namebodystringYesPixel name. Length limit: 40 characters and cannot contain emojis. Note: Duplicate pixel names are not supported.
pixel_categorybodystringNoPixel data connection event category. Note: This field no longer determines the pixel events that the Pixel can measure, even if it is passed. We recommend not including this field for new Pixels. Note that this field will be deprecated in the next API version.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/tiktok_business/pixel/create/" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"pixel_name":""}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/tiktok_business/pixel/create/",
    params={},
    json={
        "pixel_name": ""
    },
    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/pixel/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({"pixel_name":""}),
});
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/pixel/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, '{"pixel_name":""}');
$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, see Appendix-Return codes.
messagestringReturn message, see Appendix-Return information.
request_idstringUnique ID of the request
dataobjectReturn data
pixel_codestringPixel Code, the ID you see on the event manager's platform.
pixel_idstringPixel ID.
pixel_namestringPixel name.
pixel_categorystringThe Pixel data connection event category for the Pixel. Enum values: - `ONLINE_STORE`: E-commerce events. - `FILLING_FORM`: Form. - `CONTACTS`: Consultation events. - `LANDING_PAGE`: APK download events. - `CUSTOMIZE_EVENTS`: Custom events. If this field is not passed in the request, this field will default to `CUSTOMIZE_EVENTS`. Note: This field no longer determines the pixel events that the Pixel can measure and will be deprecated in the next API version.
partner_namestringName of the merchant partner.
advanced_matching_fieldsobjectManual Advanced Matching settings for the pixel.
phone_numberbooleanWhether phone number is enabled for Manual Advanced Matching. Default value: `true`.
emailbooleanWhether email is enabled for Manual Advanced Matching. Default value: `true`.
automatic_advanced_matching_fieldsobjectAutomatic Advanced Matching settings for the pixel. Automatic Advanced Matching automatically uses customer information collected through your TikTok Pixel, like email, name, and phone number, to improve match rates, conversion tracking, and retargeting.
phone_numberbooleanWhether phone number is enabled for Automatic Advanced Matching. Default value: `false`.
emailbooleanWhether email is enabled for Automatic Advanced Matching. Default value: `false`.
namebooleanWhether name is enabled for Automatic Advanced Matching. Default value: `false`.
addressbooleanWhether address is enabled for Automatic Advanced Matching. Default value: `false`.
external_idbooleanWhether external ID is enabled for Automatic Advanced Matching. Default value: `false`.
enable_first_party_cookiesbooleanWhether to allow first-party cookies. Allowing first-party cookies will allow the system to share data from your website's first-party cookies with TikTok to improve measurement and help reach more users. Learn more about using cookies with TikTok Pixel. Default value: `true`.
enable_expanded_data_sharingbooleanWhether to enable expanded data sharing. Enabling expanded data sharing allows this pixel to collect more information from your website, including page content (such as meta tags, and product details), visitor actions (such as clicks, button interactions, and time spent), and website performance (such as page load speed and responsiveness). This data may be used to improve ad delivery and campaign performance on TikTok. You can view all collected data in TikTok Pixel Helper. Learn more about Expanded Data Sharing with the TikTok Pixel. Default value: `true`.

Response sample

HTTPS/1.1 200 OK
{
    "code": 0,
    "message": "OK",
    "request_id": "{{request_id}}",
    "data": {
        "advanced_matching_fields": {
            "email": true,
            "phone_number": true
        },
        "automatic_advanced_matching_fields": {
            "address": false,
            "email": false,
            "external_id": false,
            "name": false,
            "phone_number": false
        },
        "enable_expanded_data_sharing": true,
        "enable_first_party_cookies": true,
        "pixel_category": "CUSTOMIZE_EVENTS",
        "pixel_code": "{{pixel_code}}",
        "pixel_id": "{{pixel_id}}",
        "pixel_name": "{{pixel_name}}"
    }
}
(/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