TikTok analytics dashboard
Build the data layer of a TikTok dashboard for accounts you do not own, with account KPIs, a per-video table with engagement rates and a scored comment feed. 30 to 50 credits per refresh.
This recipe gathers everything a TikTok dashboard needs for any public account: headline account numbers, a table of how each recent video performed, and the comments on the strongest video, each scored for sentiment on your side.
Cost per run
30 to 50 credits per refresh: profile (10), one page of profile/videos (10) and one page of post/comments (metered, 10–30). Every refresh is charged, so a dashboard should store the last result and refresh on a schedule rather than on every page load. Refreshing 50 accounts once a day costs at least 45,000 credits a month.
Which calls feed a TikTok dashboard?
A full refresh takes three calls. Start with GET /v1/tiktok/profile for followers and lifetime likes. Then GET /v1/tiktok/profile/videos gives the latest videos with their view, like, comment, share and save counts, and GET /v1/tiktok/post/comments fetches the comments for whichever video URL you pass. The engagement rates are calculated from those counts in your code, with a formula you can show your users.
TikTok's built-in analytics stop at the accounts you log in to. Working from public numbers with one fixed engagement formula lets you chart any account, whether for a creator tool, a client report or a brand team.
What you need
| Endpoint | Returns | Parameters | Credits |
|---|---|---|---|
GET /v1/tiktok/profile | Followers, lifetime likes, bio, verification | handle or user_id | 10 |
GET /v1/tiktok/profile/videos | Recent videos with views, likes, comments, shares and saves | handle; next page with cursor | 10 |
GET /v1/tiktok/post/comments | A page of comments on one video | url; next page with cursor | 10–30 |
Need audience geography? GET /v1/tiktok/user/audience (50 credits, beta) returns the top follower countries and each one's share. Age and gender are not public on TikTok, so no endpoint returns them.
The comment panel scores sentiment with VADER in Python (pip install vaderSentiment) and the sentiment package in Node.js. Both read English only; use a multilingual model if your accounts comment in other languages.
The code
# tiktok_dashboard.py
# One full refresh for a TikTok account you do not own.
# Run with: INSIGHTSOCIAL_API_KEY=isk_live_... python tiktok_dashboard.py
import os
import requests
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
KEY = os.environ["INSIGHTSOCIAL_API_KEY"]
BASE = "https://api.insightsocial.app/v1"
HANDLE = "khaby.lame"
def get(path, **params):
res = requests.get(f"{BASE}/{path}", params=params,
headers={"x-api-key": KEY}, timeout=120)
body = res.json()
if not body["success"]:
raise RuntimeError(f'{body["error"]["type"]}: {body["error"]["message"]}')
return body
def ratio(part, whole):
# None when either side is unknown; a hidden count is null, not 0.
return round(part / whole, 4) if part is not None and whole else None
# Panel 1: account KPIs
profile = get("tiktok/profile", handle=HANDLE)
author = profile["data"]["author"]
followers = author["followers"]
print("followers:", followers, "(rounded)" if author["followers_approximate"] else "")
print("lifetime likes:", author["likes_count"])
# Panel 2: per-video table
videos = get("tiktok/profile/videos", handle=HANDLE)
rows = []
for item in videos["data"]["items"]:
post = item["post"]
e = post["engagement"]
counts = [e["likes"], e["comments"], e["shares"]]
interactions = sum(counts) if None not in counts else None
rows.append({
"caption": (post["content"]["text"] or "")[:40],
"published_at": post["published_at"],
"views": e["views"],
"likes": e["likes"],
"comments": e["comments"],
"shares": e["shares"],
"rate_by_views": ratio(interactions, e["views"]),
"rate_by_followers": ratio(interactions, followers),
"url": post["url"],
})
for r in rows[:10]:
print(r)
# Panel 3: comment feed of the most-viewed video, scored for sentiment
analyzer = SentimentIntensityAnalyzer()
top = max(rows, key=lambda r: r["views"] or 0, default=None)
comments = None
if top:
comments = get("tiktok/post/comments", url=top["url"])
for item in comments["data"]["items"][:5]:
text = item["comment"]["text"] or ""
compound = analyzer.polarity_scores(text)["compound"] # -1 to 1
print(f"[{compound:+.2f}] {text}")
total = profile["credits_used"] + videos["credits_used"] + (comments["credits_used"] if comments else 0)
print("credits used:", total)What you get back
followers: 161000000
lifetime likes: 2500000000
{'caption': '...', 'published_at': '2026-09-30T18:12:44.000Z', 'views': 12400000, 'likes': 2100000, 'comments': 18400, 'shares': 41000, 'rate_by_views': 0.1743, 'rate_by_followers': 0.0134, 'url': 'https://www.tiktok.com/@khaby.lame/video/...'}
{'caption': '...', 'published_at': '2026-09-27T16:40:02.000Z', 'views': 8100000, 'likes': 1400000, 'comments': 12100, 'shares': 22000, 'rate_by_views': 0.1771, 'rate_by_followers': 0.0089, 'url': 'https://www.tiktok.com/@khaby.lame/video/...'}
[+0.64] this man never needs to say a word
[+0.00] which country is this
...
credits used: 30The figures are illustrative. rate_by_views is (likes + comments + shares) / views for each video; rate_by_followers divides the same sum by the account's followers. Both are None when a count is hidden. The profile's like count is lifetime hearts, so it is a KPI on its own, not an input to a rate.
What to change
HANDLE. Any public TikTok account. Run the script over a list of handles and store each refresh keyed by(handle, date), and follower and engagement charts come straight out of the table.- Go past the first page. Send
pagination.next_cursorback ascursor, with the samehandleorurl, to get older videos or more comments. Cursors expire after 24 hours. See Pagination. - Only new videos. Pass the id of the newest video you already hold as
stop_at_id, or a date assince. - Comment order. Add
sort=recentfor newest first orsort=topfor most liked. - Add audience geography. One
GET /v1/tiktok/user/audiencecall adds 50 credits per account.
Related
Creator engagement scoring
Compare one creator's engagement on TikTok, Instagram and YouTube in a single ranked table, calculated with one formula from each platform's recent posts. 60 to 190 credits per creator.
Search then enrich
Find the posts about a topic on TikTok and Instagram, collect the accounts that made them, and fetch each account's full profile into one lead list. From 120 credits per run.