Introducing the Instagram APIRead more →

Guide · Python · Updated

TikTokApi Alternative: TikTok Data in Python Without Playwright

TikTokApi needs a headless browser, an ms_token from your own TikTok cookies and usually a proxy, and it still breaks when TikTok changes its signatures. Here is the same data from one request.

TikTokApi is the most popular way to read TikTok from Python. It drives a real browser with Playwright to sign each request, so it needs three things to work: Playwright and a browser, an ms_token copied from your own tiktok.com cookies, and in practice a proxy. When TikTok changes how it signs requests, every script that depends on it stops at once.

This guide shows the same calls with SocialTap: a profile, an account's videos, a video's comments and a hashtag's videos, in plain Python, with no browser and no cookies.

Why TikTokApi keeps breaking

TikTok's web app signs its requests, and TikTokApi copies what the browser sends. When TikTok adds a new signature, requests come back empty until the library catches up:

  • Issue #1311, "200 empty body response for user-level queries", open since July 2026: TikTok now expects an X-Gnarly signature the library doesn't send.
  • Issue #1242: EmptyResponseException, "They are detecting you're a bot".
  • Issue #1248: "Can't get Videos in HashTag".

A typical TikTokApi script looks like this, with the token from your browser and a session per request:

Python
from TikTokApi import TikTokApi
import asyncio, os

ms_token = os.environ.get("ms_token")

async def user_videos():
    async with TikTokApi() as api:
        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
        async for video in api.user("therock").videos(count=30):
            print(video.as_dict)

asyncio.run(user_videos())

Each piece of that is something you maintain: the browser install, the token that expires, the proxy, the retries when a session gets flagged.

The same data with one API key

SocialTap reads TikTok for you and returns live data in one schema. We handle the proxies, blocks and platform changes. Install the SDK:

Install
pip install socialtap

Get a key on the signup page, then set it as SOCIALTAP_API_KEY. Every account starts with 100 free credits. This reads one profile:

Python SDK
from socialtap import SocialTap

client = SocialTap()  # api_key defaults to os.environ["SOCIALTAP_API_KEY"]

res = client.tiktok.profile.get(handle="nasa")
print(res.data)
print(res.credits.charged, res.meta.request_id)

The answer has the account's exact follower count when TikTok shows it, the bio, links, verification and video count, under the same field names SocialTap uses for every platform.

Walk an account's videos, page by page

TikTokApi's user.videos() becomes client.tiktok.posts.iterate(). It pages through the account's videos for you, up to 15 a page, and stops at the guard you set, so a loop can't spend more than you meant. It also catches what TikTok can answer about an account: one that doesn't exist, and one that is private.

Python SDK
from socialtap import SocialTap, APIError, NotFoundError, PrivateOrUnavailableError

client = SocialTap()  # api_key defaults to os.environ["SOCIALTAP_API_KEY"]

try:
    # Stops at the end of the list, or at the first guard it reaches.
    items = client.tiktok.posts.iterate(handle="@khaby.lame", max_pages=10, max_credits=100)
    for item in items:
        print(item)
    print(items.pages_fetched, items.credits_charged, items.stop_reason, items.end_reason)
except NotFoundError as err:
    # The item does not exist or was deleted.
    print(err.code, err.remediation)
except PrivateOrUnavailableError as err:
    # The item exists but isn't public: it is private, age- or region-restricted, or needs a login.
    print(err.code, err.remediation)
except APIError as err:
    # Retryable errors reach you only after the SDK's own retries. Failed requests cost no credits.
    print(err.code, err.status, err.retryable, err.remediation, err.request_id)

Each video has its caption, hashtags, publish time, duration, thumbnail and its view, like, comment, share and save counts. TikTok rounds large counts on some pages, and approximate_fields lists which ones were rounded, so you never store a rounded number as exact.

From TikTokApi to SocialTap

TikTokApiSocialTapEndpoint
api.user(name).info()client.tiktok.profile.get()TikTok Profile API
api.user(name).videos()client.tiktok.posts.iterate()TikTok Posts API
api.video(url=...).info()client.tiktok.post.get()TikTok Post API
video.comments()client.tiktok.comments.iterate()TikTok Comments API
api.hashtag(name).videos()client.tiktok.hashtag_posts.iterate()TikTok Hashtag Posts API
video.bytes()client.tiktok.download.get()TikTok Download API

The SDK has no async session pool to manage: each call is one HTTPS request, retried for you when TikTok blocks it. An async client, AsyncSocialTap, has the same methods for asyncio code.

What it costs

You pay per successful request, and a list request returns a whole page:

  • Videos of an account: $0.05–$0.13 per 1,000 posts.
  • Comments: $0.01–$0.04 per 1,000 comments.
  • Profiles: $0.75–$1.97 per 1,000 profiles.

Failed requests and cache hits cost nothing. Plans and packs start small, and credits from a pack never expire.

Frequently asked questions

Is TikTokApi still working in 2026?

Partly. The library is maintained, but user-level queries have returned empty bodies since TikTok added a new request signature (issue #1311), and it still needs a browser, an ms_token and usually a proxy.

Back to contents

Do I need an ms_token or TikTok cookies?

No. SocialTap reads TikTok logged out, with its own sessions and proxies. You send a handle, a link or a search, with your SocialTap API key.

Back to contents

Can I download TikTok videos without the watermark?

Yes. The TikTok Download API returns the video's file links, and the TikTok Posts API returns each video's details. TikTok serves its video files only with a cookie, so the posts list leaves media[].url empty and the download endpoint fetches the files.

Back to contents

Does it work with private accounts?

No. A private account's profile comes back with is_private true, but its videos aren't public, so listing them returns private_or_unavailable. That's the TikTok app's behavior for a logged-out visitor too.

Back to contents

Is there an official TikTok API for this?

Not for most developers. TikTok's Research API is open only to approved non-commercial researchers, and its Display API reads only the users who log in to your app. The TikTok API page compares them.

Back to contents

Replace TikTokApi with one API key.

Get a key, run the code above and see live data in a minute. Failed requests are free.

100free credits
  • No credit card
  • Failed requests are free
  • Works on all 310 endpoints
Start for free Read the docs