IntegrationsAdvertisingTikTok Events API

TikTok Events API

Datafly Signal delivers events to TikTok server-to-server using the TikTok Events API. This enables accurate conversion tracking and audience optimisation without relying on the TikTok Pixel client-side script.

API Endpoint

POST https://business-api.tiktok.com/open_api/v1.3/event/track/

Events are sent as JSON with authentication via the Access-Token request header.

Configuration

FieldRequiredDescription
pixel_codeYesYour TikTok Pixel code (e.g. CXXXXXXXXXXXXXXXXX). Found in TikTok Ads Manager > Events > Web Events.
access_tokenYesEvents API access token. Generate in TikTok Ads Manager > Events > Settings > Generate Access Token.

Management UI Setup

  1. Go to Integrations > Add Integration > TikTok Events API.
  2. Enter your pixel_code and access_token.
  3. Select consent categories (typically advertising).
  4. Click Save.

Management API Setup

curl -X POST http://localhost:8084/v1/admin/integrations \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source_id": "src_abc123",
    "vendor": "tiktok",
    "name": "TikTok Events API",
    "enabled": true,
    "config": {
      "pixel_code": "CXXXXXXXXXXXXXXXXX",
      "access_token": "your_access_token"
    },
    "consent_categories": ["advertising"]
  }'

Identity Signals

SignalFieldDescription
ttpuser.ttpTikTok browser ID. Datafly Signal self-generates this as a UUID and stores it as a first-party cookie (_ttp).
ttcliduser.ttclidTikTok click ID. Automatically extracted from the ttclid URL parameter when a user clicks a TikTok ad.
external_iduser.external_idSet to the hashed Datafly anonymous_id.
ipuser.ipVisitor’s IP address, forwarded from the original request.
user_agentuser.user_agentVisitor’s User-Agent string, forwarded from the original request.

User-Provided Signals (Hashed)

When user data is available via _df.identify(), the following fields are SHA-256 hashed before sending to TikTok:

SignalHashingDescription
emailSHA-256, lowercase, trimmedUser’s email address
phoneSHA-256, E.164 formatUser’s phone number (e.g. +15551234567)

All PII hashing is performed server-side by the Delivery Worker. Raw PII never leaves your infrastructure.

Event Mapping

Datafly EventTikTok EventNotes
page (page view)PageViewSent for every page view
Product AddedAddToCartIncludes content parameters
Order Completed / Product PurchasedCompletePaymentRequires value, currency
Checkout StartedInitiateCheckoutIncludes value, currency
Product ViewedViewContentIncludes content parameters
Products SearchedSearchIncludes query parameter
Product Added to WishlistAddToWishlistIncludes content parameters
Signed UpCompleteRegistrationUser registration
Lead GeneratedSubmitFormLead form submission
Custom eventsPassed throughSent as custom event name

Example: Purchase Event

Datafly.js call:

_df.track("Order Completed", {
  order_id: "ORD-001",
  total: 129.99,
  currency: "USD",
  products: [
    { product_id: "SKU-A", name: "Widget", price: 49.99, quantity: 2 },
    { product_id: "SKU-B", name: "Gadget", price: 30.01, quantity: 1 }
  ]
});

TikTok Events API payload sent by Datafly:

{
  "pixel_code": "CXXXXXXXXXXXXXXXXX",
  "event": "CompletePayment",
  "event_id": "evt_abc123def456",
  "timestamp": "2026-01-29T14:30:00Z",
  "context": {
    "page": {
      "url": "https://example.com/checkout/confirmation",
      "referrer": "https://example.com/checkout"
    },
    "ip": "203.0.113.50",
    "user_agent": "Mozilla/5.0 ..."
  },
  "user": {
    "ttp": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "ttclid": "E.C.P.abc123def456",
    "external_id": "a1b2c3d4e5f6..."
  },
  "properties": {
    "currency": "USD",
    "value": 129.99,
    "order_id": "ORD-001",
    "contents": [
      {
        "content_id": "SKU-A",
        "content_name": "Widget",
        "content_type": "product",
        "price": 49.99,
        "quantity": 2
      },
      {
        "content_id": "SKU-B",
        "content_name": "Gadget",
        "content_type": "product",
        "price": 30.01,
        "quantity": 1
      }
    ]
  }
}

Example: Page View

{
  "pixel_code": "CXXXXXXXXXXXXXXXXX",
  "event": "PageView",
  "event_id": "evt_789ghi012jkl",
  "timestamp": "2026-01-29T14:29:00Z",
  "context": {
    "page": {
      "url": "https://example.com/products/widgets",
      "referrer": "https://www.tiktok.com/"
    },
    "ip": "203.0.113.50",
    "user_agent": "Mozilla/5.0 ..."
  },
  "user": {
    "ttp": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "ttclid": "E.C.P.abc123def456"
  }
}

Content Parameters

For e-commerce events, TikTok expects detailed content information:

ParameterTypeDescription
content_idstringProduct SKU or identifier
content_typestringType of content (product or product_group)
content_namestringProduct name
valuenumberTotal monetary value of the event
currencystringISO 4217 currency code (e.g. USD, EUR)
pricenumberUnit price of the item
quantityintegerNumber of items
⚠️

The currency and value fields are required for CompletePayment events. Without them, TikTok cannot attribute revenue to your conversions.

API Response

A successful response from TikTok:

{
  "code": 0,
  "message": "OK",
  "request_id": "2026012914300012345678901234567890"
}

An error response:

{
  "code": 40001,
  "message": "Invalid access token",
  "request_id": "2026012914300012345678901234567891"
}

Common error codes:

CodeMeaning
0Success
40001Invalid access token
40002Invalid pixel code
40003Invalid event
40100Rate limit exceeded

Rate Limits

SettingDefault
rate_limit_rps100
rate_limit_burst200

TikTok’s Events API allows up to 500 events per batch request. Datafly Signal batches events automatically when throughput is high.