| noindex | true |
|---|---|
| title | Authentication |
| description | Learn how to authenticate with the TikTool API using API keys and JWT tokens. |
Every request requires an API key. Pass it as a query parameter:
wss://api.tik.tools?uniqueId=streamer&apiKey=YOUR_API_KEY
https://api.tik.tools/webcast/check_alive?apiKey=YOUR_API_KEY&unique_id=streamer
- Sign up at tik.tools
- Go to the Dashboard
- Your free sandbox key is generated automatically
- Upgrade to Basic, Pro, or Ultra for higher limits
For web applications where the frontend needs to connect directly to the WebSocket, use JWT tokens to avoid exposing your API key.
- Server-side: Generate a JWT using your API key via the
/authentication/jwtendpoint - Client-side: Connect to the WebSocket using the JWT token instead of the API key
import requests
res = requests.post('https://api.tik.tools/authentication/jwt',
params={'apiKey': 'YOUR_KEY'},
json={'expire_after': 3600, 'allowed_creators': ['streamer1']})
token = res.json()['data']['token']// Client-side JavaScript — API key never exposed
const ws = new WebSocket(`wss://api.tik.tools?uniqueId=streamer1&jwtKey=${jwtToken}`);
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log(data.event, data.data);
};| Parameter | Type | Required | Description |
|---|---|---|---|
expire_after |
number | No | Seconds until expiry (default: 3600) |
allowed_creators |
string[] | No | Restrict connections to specific TikTok usernames |
max_websockets |
number | No | Maximum concurrent WebSocket connections (default: 1) |
Every API response includes rate limit information in headers:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Maximum requests per window |
X-RateLimit-Remaining |
Remaining requests in current window |
X-RateLimit-Reset |
Unix timestamp when the window resets |
See Rate Limits for tier-specific limits.