Skip to main content

Track TikTok Videos Programmatically

This guide shows you how to track TikTok video performance using the ContentStats.io API. Get hourly snapshots of views, likes, comments, shares, and saves.
No TikTok API approval required. Start tracking in minutes with just an API key.

Prerequisites

Before you start, you’ll need:
  • ContentStats.io account (sign up free)
  • API key from your dashboard
  • At least 0.015inyourbalance(youget0.015 in your balance (you get 5 free)
  • URL of a public TikTok video

Step 1: Get Your API Key

1

Access Dashboard

Log in to contentstats.io
2

Navigate to API Keys

Go to Settings → API Keys
3

Create New Key

Click “Create New Key” and copy it
API keys are shown only once. Store it securely in environment variables.

Step 2: Start Tracking a TikTok Video

Send a POST request to /api/v1/videos/track:
curl -X POST https://contentstats.io/api/v1/videos/track \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cs_live_YOUR_KEY" \
  -d '{
    "video_link": "https://www.tiktok.com/@charlidamelio/video/7234567890",
    "duration_days": 7
  }'

Request Parameters

ParameterTypeRequiredDescription
video_linkstringFull TikTok video URL
duration_daysintegerDays to track (1-30)

Response

{
  "id": "cm5abc123def",
  "job_id": "job_xyz789",
  "video_link": "https://www.tiktok.com/@charlidamelio/video/7234567890",
  "platform": "tiktok",
  "status": "monitoring",
  "monitoring_duration_days": 7,
  "days_remaining": 7,
  "estimated_cost": 2.52,
  "created_at": "2024-01-29T10:00:00.000Z"
}
Save the id field — you’ll need it to retrieve snapshots later.

Step 3: Get Snapshots

After the first hour, retrieve snapshot data:
curl https://contentstats.io/api/v1/videos/cm5abc123def \
  -H "X-API-Key: cs_live_YOUR_KEY"

Response with Snapshots

{
  "id": "cm5abc123def",
  "video_link": "https://www.tiktok.com/@charlidamelio/video/7234567890",
  "platform": "tiktok",
  "status": "monitoring",
  "snapshots": [
    {
      "id": "snap_001",
      "snapshot_time": "2024-01-29T10:00:00.000Z",
      "views": "1250000",
      "likes": "185000",
      "comments": "4200",
      "shares": "12500",
      "saves": "8900"
    },
    {
      "id": "snap_002",
      "snapshot_time": "2024-01-29T11:00:00.000Z",
      "views": "1298000",
      "likes": "189000",
      "comments": "4350",
      "shares": "12800",
      "saves": "9100"
    }
  ]
}

Step 4: List All Tracked TikTok Videos

Get all your tracked videos:
curl "https://contentstats.io/api/v1/videos?platform=tiktok&status=monitoring" \
  -H "X-API-Key: cs_live_YOUR_KEY"

Query Parameters

ParameterValuesDescription
platformtiktok, youtube, instagram, twitterFilter by platform
statusmonitoring, completed, paused, errorFilter by status
limit1-100Number of results (default: 50)

Step 5: Stop Tracking Early (Optional)

To stop tracking before the duration ends:
curl -X POST https://contentstats.io/api/v1/videos/cm5abc123def/stop \
  -H "X-API-Key: cs_live_YOUR_KEY"
You’ll only pay for snapshots already collected. Future snapshots won’t be charged.

Supported TikTok URL Formats

We accept all TikTok video URL formats:
✅ https://www.tiktok.com/@username/video/1234567890
✅ https://vm.tiktok.com/abc123/
✅ https://www.tiktok.com/t/abc123/
✅ https://m.tiktok.com/v/1234567890.html
Only public videos can be tracked. Private or age-restricted videos will return an error.

Cost Breakdown

Tracking cost calculation:
Hourly snapshots = Duration (days) × 24
Cost per video = Hourly snapshots × $0.015

Example for 7 days:
7 days × 24 hours = 168 snapshots
168 × $0.015 = $2.52

Advanced: Batch Tracking

Track multiple TikTok videos at once:
const videos = [
  'https://www.tiktok.com/@user1/video/123',
  'https://www.tiktok.com/@user2/video/456',
  'https://www.tiktok.com/@user3/video/789'
];

const results = await Promise.all(
  videos.map(video_link =>
    fetch('https://contentstats.io/api/v1/videos/track', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': process.env.CONTENTSTATS_API_KEY
      },
      body: JSON.stringify({ video_link, duration_days: 7 })
    }).then(r => r.json())
  )
);

console.log(`Started tracking ${results.length} videos`);

Webhook Notifications (Coming Soon)

Get notified when:
  • First snapshot is collected
  • Tracking completes
  • Video gets deleted

Troubleshooting

Cause: Invalid URL or video is private/deletedFix: Verify the URL is public and accessible without login
Cause: Not enough credit for estimated costFix: Add credits to your account
Cause: First snapshot takes up to 1 hourFix: Wait 60 minutes and check again
Cause: Same video tracked multiple timesFix: List videos first to check if already tracking:
curl "https://contentstats.io/api/v1/videos?platform=tiktok" \
  -H "X-API-Key: YOUR_KEY"

Best Practices

Never hardcode API keys:
# .env
CONTENTSTATS_API_KEY=cs_live_YOUR_KEY
Verify sufficient balance:
curl https://contentstats.io/api/v1/usage \
  -H "X-API-Key: YOUR_KEY"
Focus on videos that matter:
  • Sponsored content
  • Competitor analysis
  • Viral trend research
  • Campaign performance
If you get the data you need early, stop tracking to save credits

Next Steps