How to get a TikTok follower count in Python
Checked on 2026-11-19.
TikTok for Developers documents a follower count in two APIs: the Display API, for accounts whose owners log in to your app, and the Research API, for approved researchers. For any other public account the number comes from the public profile, read by an open-source library on your own computer or by an HTTP API.
1. The Display API: accounts that log in to your app
GET /v2/user/info/ returns follower_count, following_count, likes_count and video_count. It has no parameter for a username: it answers for the TikTok user whose access token you send, a token "that bears the authorization of the TikTok user" in the words of the reference.
import os
import requests
res = requests.get(
"https://open.tiktokapis.com/v2/user/info/",
params={"fields": "display_name,username,follower_count,following_count,likes_count,video_count"},
headers={"Authorization": "Bearer " + os.environ["TIKTOK_USER_ACCESS_TOKEN"]},
timeout=30,
)
user = res.json()["data"]["user"]
print(user["username"], user["follower_count"])The four counts need the user.info.stats scope and username needs user.info.profile. user.info.basic alone returns the ids, the avatar and the display name. Older code asks for the counts with user.info.basic: TikTok's migration notice set 02/29/2024 as the date after which that answers scope_not_authorized with HTTP 401.
Where it stops: at accounts that have not logged in to your app. TikTok's scopes page puts it this way: "applying and being approved for a scope alone does not give you access to a user's data. Each user must also authorize your app for access to specific scopes." The app has to pass TikTok's review first. It is the right route for a product whose users connect their own TikTok accounts, and no route at all for looking up an account that is not yours.
2. The Research API: any public account, for approved researchers
/v2/research/user/info/ takes a username and returns follower_count, following_count, likes_count and video_count with the display name, bio and verified flag. The codebook limits it to public accounts of users aged 18 and over. The FAQ says where the numbers come from: "The User info API only retrieves data for an individual user, so we use online data", unlike the video search, whose statistics can be days behind.
import os
import requests
# The client key and secret of the research client TikTok creates after approval.
token = requests.post(
"https://open.tiktokapis.com/v2/oauth/token/",
data={
"client_key": os.environ["TIKTOK_CLIENT_KEY"],
"client_secret": os.environ["TIKTOK_CLIENT_SECRET"],
"grant_type": "client_credentials",
},
timeout=30,
).json()["access_token"] # valid for 2 hours
res = requests.post(
"https://open.tiktokapis.com/v2/research/user/info/",
params={"fields": "display_name,follower_count,following_count,likes_count,video_count"},
headers={"Authorization": f"Bearer {token}"},
json={"username": "nasa"},
timeout=30,
)
print(res.json()["data"]["follower_count"])Where it stops: at the application. Access is for academic and not-for-profit researchers in the regions TikTok lists, for approved non-commercial projects, with 1000 requests a day. The conditions are in the guide to Research API access.
What oEmbed and yt-dlp leave out
TikTok's oEmbed endpoint accepts a profile link. On 2026-11-19 its answer for https://www.tiktok.com/@nasa held the embed code, the title "NASA's Creator Profile", author_name and author_url, and no numbers. The embedded card that this code loads does show followers, following and likes to a visitor, as TikTok's documentation describes, but the JSON answer has none of them.
yt-dlp treats a profile link as a playlist of the account's videos. Its TikTok extractor sets no follower count, although yt-dlp has a general channel_follower_count field for sites where it can.
3. The TikTokApi library: free, with a browser on your own computer
TikTokApi is an unofficial, open-source wrapper for TikTok's website. It needs Python 3.9 or newer and a Playwright browser. This is the profile call of the user example in its repository:
# pip install TikTokApi
# python -m playwright install
import asyncio
import os
from TikTokApi import TikTokApi
ms_token = os.environ.get("ms_token", None) # from your own cookies on tiktok.com
async def user_example():
async with TikTokApi() as api:
await api.create_sessions(
ms_tokens=[ms_token],
num_sessions=1,
sleep_after=3,
browser=os.getenv("TIKTOK_BROWSER", "chromium"),
)
user_data = await api.user("nasa").info()
print(user_data)
asyncio.run(user_example())info() returns TikTok's raw answer as a dictionary, and the library does not document its keys. Its README says "TikTok changes their structure from time to time so it's worth investigating the structure of the dictionary when you use this package." Print it once and find the follower count in it.
Where it breaks: the README says an EmptyResponseException "means TikTok is blocking the request and detects you're a bot", and that "you may need a proxy". It runs a real browser, which is a lot to carry on a small server.
4. An HTTP API: the exact count of any public account
With Pipefetch a public profile is one HTTPS request with one key. It is not an official TikTok API, and Pipefetch is not affiliated with TikTok: it returns what a public profile shows to a visitor who is not logged in.
import os
import requests
res = requests.get(
"https://pipefetch.com/v1/tiktok/profile",
params={"username": "nasa"},
headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
timeout=90,
)
if res.status_code == 404:
print("No such account") # not charged
else:
res.raise_for_status()
profile = res.json()["data"]
print(profile["username"], profile["followerCount"], profile["likeCount"], profile["videoCount"])The follower, following, like and video counts are the exact numbers, not the rounded ones TikTok displays: for example 2201384 for an account its profile page shows as 2.2M. username accepts a username, a handle with @ or a profile URL. The answer also has the name, the bio and its link, and the verified, private, business-account and TikTok Shop flags. It does not include the account's videos, its followers or the accounts it follows.
A request costs 1 credit, an account that does not exist answers 404 and costs nothing, and a new account has 100 free credits. The reference lists every field.
Which one should you use?
| Situation | Use |
|---|---|
| Your product's users connect their own TikTok accounts | The Display API |
| An approved, non-commercial research project | The Research API |
| A few accounts, free, on your own computer | The TikTokApi library |
| Any public account, from a server, without an app review | An HTTP API such as Pipefetch |
The first two are TikTok's own. The library and Pipefetch read the public profile without TikTok's approval, and TikTok's Terms of Service list among the things users must not do: "extract any data or content from the Platform using any automated system or software that is not provided by TikTok or approved in writing by TikTok". If you need TikTok's permission in writing, use an official route.
Tracking followers over time
Every route above returns the count as it is now, so a growth chart is yours to build: store one reading per account per day and compare. With exact numbers a daily reading shows change even on a large account, where the displayed 2.2M hides changes of tens of thousands. On Pipefetch that is one request and 1 credit per account per day, and an account can send 120 requests a minute.
The video endpoint also carries the creator's follower count, but as TikTok's rounded display value (9M arrives as 9000000), so use the profile endpoint when the number matters. For the numbers of a single video, see how to get a TikTok video's views and likes.
Try it with 100 free credits. No card needed. No scraper to build or maintain. Get an API key or read the docs.
Free tools for this
APIs used in this guide
-
1 credit
TikTok Video API
Plays, likes, comments, shares and saves of one TikTok video, with its caption, hashtags, sound and creator.
GET /v1/tiktok/video -
1 credit
TikTok Profile API
Exact followers, likes and video count of a TikTok account, with its bio, bio link, verified, business and TikTok Shop flags.
GET /v1/tiktok/profile
More TikTok guides
- How to get a TikTok video's views and likes in Python
- How to get the comments of a TikTok video in Python
- TikTok Research API: who can get access, and what to do if you cannot
- How to get TikTok video views, likes and shares in Node.js
- How to get TikTok views, likes and follower counts in Google Sheets
Guides for other sources
Every source
YouTube
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to list a YouTube channel's videos in Python
- How to summarize a YouTube video with an LLM in Python
- How to get YouTube transcripts and video stats in Google Sheets
- How to get YouTube video views and likes in Python
- How to get YouTube transcripts in n8n, Make and Zapier
- LangChain YoutubeLoader fails on a server: why, and a loader that works
- How to get a YouTube channel's subscriber count in Python
- How to give Claude or Cursor access to YouTube (MCP server)
- How to get YouTube comments in Node.js
- How to analyze YouTube comments with an LLM in Python
- How to list a YouTube channel's Shorts in Python
- How to search YouTube from JavaScript
- How to get an Instagram follower count in Python
- Instagram Basic Display API alternatives: what to use after the shutdown
- Instaloader 401 Unauthorized, 429 and "Login required": what to do
- How to calculate an Instagram engagement rate in Python
- How to get an Instagram follower count in Node.js
- How to get Instagram follower counts in Google Sheets
- How to get Instagram Reel views in Python
Websites
- Clearbit Logo API alternatives: get a company logo from its domain
- How to extract email addresses from a website in Python
- How to turn a web page into Markdown in Python
- How to detect what a website is built with, in Python
- How to get the contact emails and phone numbers of websites in Google Sheets
- How to build a LangChain tool that reads web pages and searches Google
- How to turn a web page into Markdown in JavaScript for RAG
- How to extract social media links from a website in Python
- How to get a website's favicon in Python
- How to check robots.txt in Python before you fetch a page
- How to get a Facebook Page's posts without app review
- Is there a Facebook Marketplace API?
- Facebook Groups API alternatives after its removal in 2024
- How to get a Facebook Page's follower count and contact details in Python
- How to get Google search results in Python
- pytrends 429 TooManyRequestsError: what it means and what to do
- How to get Google Trends data in Python
- Why is Wyoming first in Google Trends?
- How to get Google search results in Node.js
- How to get Google search results into Google Sheets
- How to give an LLM live Google results with tool calling
Threads
- How to get LinkedIn company data in Python
- How to search LinkedIn jobs from Python
- How to get a LinkedIn company page's latest posts in Python