TikTokApi alternative: when to switch to a hosted API
David Teather’s TikTokApi is the go-to Python library for public TikTok data. It runs a real browser to do it. Here is what it does well, where it gets hard on a server, and when a hosted API is the simpler choice.
Short answer. TikTokApi is a free, MIT-licensed, unofficial Python wrapper for TikTok’s web API, actively maintained (7.3.6 shipped on 28 November 2026). It reads public data: profiles, videos, comments, trending, hashtags, sounds and search. To do that it drives a headless browser through Playwright and works best with an ms_token from your TikTok cookies. When TikTok spots automation you get EmptyResponseException, and the README suggests proxies.
For scripts and research, keep TikTokApi. For a product that needs answers every time, a hosted API removes the browser, tokens and proxies: HandleHaul returns TikTok and Instagram data as JSON at $1.40 to $0.80 per 1,000 calls.
Facts checked 2 December 2026. Prices change: follow the links before you decide.
TikTokApi 7.3.6 (28 November 2026) · MIT licence · about 6.8k GitHub stars (December 2026) · by David Teather and contributors · Python 3.9+, async. Sources: GitHub · PyPI · docs, read 2026-12-02.
What TikTokApi does well
- Trending and discovery.
api.trending.videos()reads the trending feed, and there are hashtag, sound and search helpers. HandleHaul has hashtags, sounds and search but no trending feed, so for “what is trending right now” TikTokApi does more. - Video bytes.
video.bytes()downloads the video file itself. HandleHaul returns aplay_urland a cover URL; you fetch the file. - Free, open and well known. MIT licence, around since 2019, a Discord server and an examples folder. The README is upfront that it cannot post and has no logged-in routes: if you cannot see it logged out on tiktok.com, it cannot either.
- Raw data. Every object keeps TikTok’s full dictionary in
.as_dict, so you can reach any field TikTok sends.
Where TikTokApi hurts in production
- A browser in production. Install means
pip install TikTokApiandpython -m playwright install. Each session is a headless Chromium, so servers need the browser, its memory and its CPU, and Docker images built on Playwright’s base. - ms_token housekeeping. The examples read an
ms_tokenfrom your tiktok.com cookies. Without one the library tries to pick one up and logs a warning if it fails. Tokens are something to refresh and rotate. - Bot detection. The README’s first common issue is
EmptyResponseException, meaning TikTok is blocking the request as a bot. The suggested fix is a proxy, and the author notes that old issues come back because TikTok changes things. - Shapes that move. The README says TikTok changes its structure from time to time and advises checking the dictionary you get. Your parsing code owns that risk.
- No follower lists. The user object reads info, videos, playlists and liked videos; there is no followers or following method. HandleHaul returns both lists, about 30 accounts per page.
TikTokApi vs a hosted API
| Requirement | TikTokApi | HandleHaul |
|---|---|---|
| TikTok login needed | No (logged-out data only) | No, an API key only |
| Browser or tokens | Playwright Chromium; ms_token recommended | None |
| Proxies | Often needed against bot detection | Not needed |
| Rate limits | Whatever TikTok tolerates from your IPs | 10 to 30 requests per second by tier |
| Private accounts | No | No, public only (the call is free) |
| Posting | No | No |
| Trending feed | Yes | No |
| Followers and following lists | No | Yes, about 30 per page |
| Transcripts | No | Yes, from auto-captions |
| Instagram too | No (TikTok only) | Yes, same key |
| Cost | Free licence; you pay for servers, proxies, upkeep | $1.40 to $0.80 per 1,000 calls |
| Output | Async Python objects + raw dicts | Stable JSON fields, any language |
Same job, both ways
A profile and its latest 30 videos, for @nasa. TikTokApi opens a browser session; HandleHaul is two plain HTTP calls.
import asyncio, os
from TikTokApi import TikTokApi
ms_token = os.environ.get("ms_token") # from your tiktok.com cookies
async def main():
async with TikTokApi() as api:
await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3)
user = api.user("nasa")
info = await user.info()
async for video in user.videos(count=30):
print(video.id, video.stats)
asyncio.run(main())
import os, requests
url = "https://api.handlehaul.com/v1/tiktok/users/nasa/posts"
headers = {"X-Api-Key": os.environ["HANDLEHAUL_API_KEY"]}
params, rows = {}, []
for _ in range(2):
body = requests.get(url, headers=headers, params=params, timeout=60).json()
rows += body["data"]
if not body["pagination"]["has_more"]:
break
params["cursor"] = body["pagination"]["next_cursor"]
print(len(rows), "rows")
# pip install handlehaul
from handlehaul import HandleHaul
hh = HandleHaul() # reads HANDLEHAUL_API_KEY
res = hh.tiktok.posts("nasa")
print(res.data, res.meta["credits_charged"])
# first page; repeat with ?cursor=<pagination.next_cursor>
curl "https://api.handlehaul.com/v1/tiktok/users/nasa/posts" \
-H "X-Api-Key: $HANDLEHAUL_API_KEY"
For the profile itself, /v1/tiktok/users/nasa returns exact counts and the sec_uid to send to every list endpoint. See the TikTok video API and profile API.
Running it yourself vs paying per call
TikTokApi is free to install. A production setup has costs that depend on volume and on how hard TikTok pushes back that month:
- Servers sized for headless Chromium sessions rather than plain HTTP calls.
- Proxies, often residential, once datacenter IPs start returning empty responses.
- Token refresh, retries and monitoring so a blocked session does not become an outage.
- Engineer time when TikTok changes its web app and the library or your parser needs an update.
We will not guess those numbers for you. HandleHaul’s side is plain arithmetic:
| Job | Calls | HandleHaul cost |
|---|---|---|
| One profile | 1 | $0.00080 to $0.00140 |
| 30 latest videos (about 16 per page) | 2 | $0.00160 to $0.00280 |
| 1,000 followers (about 30 per page) | 34 | $0.027 to $0.048 |
| 1,000 comments (about 20 per page) | 50 | $0.040 to $0.070 |
1 credit per successful call; failed calls, private accounts and cache hits are free. Page sizes are approximate, so treat list counts as estimates. Naming an account by a handle we have not looked up in the last 7 days adds 1 lookup credit; send the numeric id from any result to skip it. See pricing.
When to keep using TikTokApi
- You need the trending feed or the video files themselves.
- It is a notebook, a one-off study or a hobby project where an empty response means trying again later.
- You already run browsers and proxies for other scrapers.
- You want every raw field TikTok sends and are happy to track its changes.
Mixing is fine: TikTokApi for trending discovery, an API for the profile, video, comment and follower data your app reads every day.
Migrating from TikTokApi: field map
TikTokApi hands you TikTok’s own dictionaries (keys may change). Below, u = info["userInfo"]["user"] from info = await user.info(), and where the common keys land in the /v1/tiktok/users/{user} and /v1/tiktok/posts/{post} responses.
| TikTokApi | HandleHaul | Note |
|---|---|---|
u["id"] | data.id | profile |
u["secUid"] | data.sec_uid | profile |
u["uniqueId"] | data.handle | profile |
u["nickname"] | data.nickname | profile |
u["signature"] | data.bio | profile |
u["verified"] | data.is_verified | profile |
video.id | data.id | post |
video.as_dict["desc"] | data.caption | post |
video.create_time | data.created_at | ISO 8601 string, not datetime |
video.stats["playCount"] | data.counts.views | post |
video.stats["diggCount"] | data.counts.likes | post |
video.stats["commentCount"] | data.counts.comments | post |
video.stats["shareCount"] | data.counts.shares | post |
video.hashtags | data.hashtags | plain strings |
video.sound | data.music | object with title, artist |
video.author | data.author | object with counts |
Profile counts (data.counts.followers, following, likes, videos) are exact on the profile call; the copies inside post lists are rounded by TikTok on big accounts. raw=true returns TikTok’s own JSON at the same price if you depend on a field we do not map.
Full fields and errors: TikTok profile API docs, TikTok post API docs, TikTok posts API docs.
TikTokApi alternative: questions
Is TikTokApi official?
How do I fix EmptyResponseException in TikTokApi?
Does TikTokApi need a TikTok account?
Can I get TikTok followers with Python?
/v1/tiktok/users/{user}/followers from Python (pip install handlehaul or requests): about 30 accounts per page with a cursor.Do I need Playwright with HandleHaul?
Which is better for a TikTok scraper in Python?
Public Instagram and TikTok data, one API key
No accounts, proxies or browsers to run. $1.40 to $0.80 per 1,000 calls.
Want to test first? Sandbox keys are free and unlimited, with sample data in the live schema.