DEV Community

scrapiq
scrapiq

Posted on • Originally published at scrapiq.in

How to Get TikTok Profile Data via API (With Code Examples)

TikTok's official API is restricted to approved partners and requires a lengthy review process. For most developers, marketers, and builders who just want basic public profile data — follower counts, engagement figures, recent videos — that approval never comes.

The TikTok Data Pro API on RapidAPI solves this. It exposes a clean REST endpoint that returns structured TikTok profile data for any public account. This guide shows you exactly how to use it, with working code examples in cURL, JavaScript, and Python.

What data does the API return?

A single call to /v1/profile returns:

Profile fields:

  • followers, following, totalLikes, totalVideos
  • name, nickname, bio, verified
  • profileUrl, avatar

Recent posts array — each with plays, likes, comments, shares, createdAt, videoUrl

Getting started

Subscribe to the free tier (500 calls, no credit card) at: https://rapidapi.com/bhaumikdhameliya30/api/tiktok-data-pro

Code examples

cURL

curl --request GET \
  --url 'https://tiktok-data-pro.p.rapidapi.com/v1/profile?username=khaby.lame' \
  --header 'x-rapidapi-host: tiktok-data-pro.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_API_KEY'
Enter fullscreen mode Exit fullscreen mode

JavaScript

const response = await fetch(
  'https://tiktok-data-pro.p.rapidapi.com/v1/profile?username=khaby.lame',
  {
    headers: {
      'x-rapidapi-host': 'tiktok-data-pro.p.rapidapi.com',
      'x-rapidapi-key': 'YOUR_API_KEY',
    },
  }
);
const data = await response.json();
console.log(data.data.followers);
console.log(data.posts);
Enter fullscreen mode Exit fullscreen mode

Python

import requests

response = requests.get(
    "https://tiktok-data-pro.p.rapidapi.com/v1/profile",
    params={"username": "khaby.lame"},
    headers={
        "x-rapidapi-host": "tiktok-data-pro.p.rapidapi.com",
        "x-rapidapi-key": "YOUR_API_KEY",
    },
)
data = response.json()
print(data["data"]["followers"])
print(data["data"]["totalLikes"])
Enter fullscreen mode Exit fullscreen mode

Sample response

{
  "success": true,
  "username": "khaby.lame",
  "data": {
    "followers": 160600000,
    "totalLikes": 2600000000,
    "totalVideos": 1314,
    "verified": true
  },
  "posts": [
    {
      "plays": 6100000,
      "likes": 463900,
      "comments": 4696,
      "shares": 14000
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Calculating engagement rate

function engagementRate(posts, followers) {
  const avg = posts.reduce((s, p) => s + p.likes + p.comments + p.shares, 0) / posts.length;
  return ((avg / followers) * 100).toFixed(2);
}
Enter fullscreen mode Exit fullscreen mode

Or use the free calculator (no code needed): https://scrapiq.in/tools/tiktok-engagement-calculator

Get started

500 free API calls, no credit card: https://rapidapi.com/bhaumikdhameliya30/api/tiktok-data-pro

Originally published at scrapiq.in

Top comments (0)