🧠 What Is the TikTok Events API?
The TikTok Events API (formerly “Server-to-Server API”) allows businesses to send web, app, or CRM events directly from their server to TikTok. It’s an alternative or complement to TikTok Pixel and is especially helpful when:
- Browser tracking is blocked (e.g., due to ad blockers or iOS14 restrictions)
- You want more reliable data and conversion attribution
- You’re using multiple tracking systems (CRM, eCommerce backend)
The Events API ensures you don’t lose critical tracking data due to browser-based limitations.
🚀 Benefits of Using TikTok Events API
- ✅ Bypasses browser limitations (cookies, ad blockers, privacy settings)
- ✅ Works server-side, allowing more control and better security
- ✅ Improves attribution by supplementing Pixel data
- ✅ Combines with Pixel using Advanced Matching to deduplicate data
- ✅ Tracks full-funnel actions, including offline conversions
⚙️ How Does It Work?
The Events API works by sending structured HTTP POST requests from your server to TikTok’s endpoint. These requests include information like:
- Event type (e.g., Purchase, PageView, AddToCart)
- User identifiers (email, phone, IP, user agent)
- Timestamp
- Event ID (to deduplicate with Pixel)
- Event source
🛠️ TikTok Events API Setup: Step-by-Step
Step 1: Create or Use a TikTok Pixel
Even though this is server-side, a Pixel ID is still required for tracking:
- Go to TikTok Ads Manager
- Navigate to Assets > Events
- Under Web Events, create a new TikTok Pixel
- Take note of your Pixel ID
Step 2: Get Access Token (Business Center)
- Go to TikTok Business Center
- Under Assets > Events API, select your Pixel
- Click Generate Access Token
- Save this token securely – you’ll use it for API authentication
Step 3: Build Server-Side Tracking Endpoint
TikTok Events API accepts POST requests to:
https://business-api.tiktok.com/open_api/v1.3/event/track/
Each request must include:
- HTTP headers:
Content-Type: application/json Access-Token: YOUR_ACCESS_TOKEN
- Body (JSON formatted), example:
{ "pixel_code": "YOUR_PIXEL_ID", "event": "CompletePayment", "timestamp": 1713115432000, "event_id": "ORDER12345", "context": { "ip": "192.0.2.1", "user_agent": "Mozilla/5.0", "page": { "url": "https://yourstore.com/thankyou" } }, "properties": { "value": 129.99, "currency": "USD" }, "user": { "external_id": "hashed_email_or_phone" } }
Step 4: Hash User Data
For privacy, TikTok requires PII (emails/phones) to be hashed using SHA256 before sending:
import hashlib
email = "test@example.com".strip().lower()
hashed_email = hashlib.sha256(email.encode()).hexdigest()
Use the hashed value under "user"
> "external_id"
.
Step 5: Testing Your Events
TikTok provides a Test Event Tool in Ads Manager:
- Go to your Pixel settings
- Use Test Events tab
- Send sample events with
"test_event_code"
field in your payload - Verify events are received in real-time
Example payload for testing:
{
...
"test_event_code": "TEST1234"
}
🔁 Common Event Types
Event | Description |
---|---|
PageView | Viewing a page |
AddToCart | Item added to cart |
CompletePayment | A purchase completed |
Lead | Form filled or lead captured |
InitiateCheckout | User started checkout |
Search | Search made on site |
SignUp | Account creation |
💡 Use consistent
event_id
values to deduplicate when you’re using both Pixel and API.
🧪 Advanced Matching & Deduplication
If you run both TikTok Pixel and Events API, include an event_id
in both. TikTok uses it to deduplicate double-counted actions.
Example:
- Pixel fires with event ID
order_abc_123
- Events API also sends same ID
- TikTok only counts one conversion
🔐 Security Best Practices
- Store your Access Token securely
- Rotate tokens periodically
- Don’t expose API calls to frontend
- Use secure HTTPS endpoints
🧩 Integrations & SDKs
You can integrate Events API with:
- Shopify, WooCommerce (via server-to-server plugins)
- Custom CRM (e.g., Salesforce)
- Backend platforms (Node.js, Python, PHP, etc.)
- Zapier & Make.com (for simple automation)
✅ Conclusion: Should You Use TikTok Events API?
If you’re serious about:
- Optimizing TikTok ad performance
- Tracking conversions more accurately
- Reducing data loss from browser-based tracking
…then yes, TikTok Events API is essential. It complements your Pixel tracking and futureproofs your conversion data in a privacy-first web.