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.

Python
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.

Python
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:

Python
# 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.

Python
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?

SituationUse
Your product's users connect their own TikTok accountsThe Display API
An approved, non-commercial research projectThe Research API
A few accounts, free, on your own computerThe TikTokApi library
Any public account, from a server, without an app reviewAn 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

Every source

YouTube

Instagram

Websites

Facebook

Google

Threads

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides