SDKs
Typed clients for TypeScript and Python.
Both clients are generated from the API's OpenAPI document, so they carry every endpoint, parameter and
response type, and they update with the API. They are thin: one HTTP call per method, no retries or state,
the same credits_charged and balance_remaining fields as the raw API.
TypeScript
npm install tikdataapiimport { tikdataapi } from 'tikdataapi';
const api = tikdataapi({ apiKey: process.env.TIKDATAAPI_KEY! });
const { data: profile } = await api.getUser({ path: { user: 'tiktok' } });
console.log(profile?.data.followers, profile?.credits_charged);
const { data: page } = await api.getUserVideos({ path: { user: 'tiktok' }, query: { count: 16 } });
for (const v of page?.data ?? []) console.log(v.id, v.plays, v.description);
const { data: many } = await api.getUsers({ body: { usernames: ['tiktok', 'nba', 'espn'] } });
console.log(many?.items, many?.errors);
const { data: found } = await api.searchVideos({ query: { query: 'street food', count: 12 } });
for (const v of found?.data ?? []) console.log(v.id, v.author.username, v.plays);
const { data: accounts } = await api.searchUsers({ query: { query: 'cooking', count: 10 } });
for (const u of accounts?.data ?? []) console.log(u.username, u.followers, u.verified);
const { data: followers } = await api.getUserFollowers({ path: { user: 'tiktok' }, query: { count: 30 } });
for (const u of followers?.data ?? []) console.log(u.username, u.followers);
const { data: sound } = await api.getMusic({ path: { id: '6696419263248336898' } });
console.log(sound?.data.title, sound?.data.videos);
const { data: trending } = await api.getTrendingVideos({ query: { count: 16 } });
for (const v of trending?.data ?? []) console.log(v.id, v.author.username, v.plays);
const { data: sounds } = await api.searchMusic({ query: { query: 'lofi', count: 12 } });
for (const m of sounds?.data ?? []) console.log(m.id, m.title, m.author);
const { data: live } = await api.getUserLive({ path: { user: 'tiktok' } });
console.log(live?.data.live, live?.data.title, live?.data.viewers);
const { data: transcript } = await api.getVideoTranscript({ path: { id: '7708543740230536461' } });
console.log(transcript?.data.language, transcript?.data.text);
const { data: tags } = await api.searchHashtags({ query: { query: 'street food', count: 10 } });
for (const t of tags?.data ?? []) console.log(t.name, t.result_videos, t.result_plays);Every call returns { data, error, response }. On a status other than 2xx, data is undefined and error
holds the API error with its code. Node 18+, Bun, Deno, browsers, edge runtimes.
Python
pip install tikdataapiimport os
from tikdataapi import AuthenticatedClient
from tikdataapi.api.music import get_music
from tikdataapi.api.search import search_hashtags, search_music, search_users, search_videos
from tikdataapi.api.users import get_user, get_user_followers, get_user_live, get_user_videos, get_users
from tikdataapi.api.videos import get_trending_videos, get_video_transcript
from tikdataapi.models import (
GetUsersBody,
HashtagSummaryPage,
LiveRoomResponse,
MusicResponse,
MusicSummaryPage,
TranscriptResponse,
UserBatch,
UserPage,
UserResponse,
UserSummaryPage,
VideoPage,
)
client = AuthenticatedClient(
base_url="https://api.tikdataapi.com",
token=os.environ["TIKDATAAPI_KEY"],
prefix="",
auth_header_name="x-api-key",
)
profile = get_user.sync("tiktok", client=client)
if isinstance(profile, UserResponse):
print(profile.data.followers, profile.credits_charged)
page = get_user_videos.sync("tiktok", client=client, count=16)
if isinstance(page, VideoPage):
for v in page.data:
print(v.id, v.plays, v.description)
many = get_users.sync(client=client, body=GetUsersBody(usernames=["tiktok", "nba", "espn"]))
if isinstance(many, UserBatch):
print(many.items, many.errors)
found = search_videos.sync(client=client, query="street food", count=12)
if isinstance(found, VideoPage):
for v in found.data:
print(v.id, v.author.username, v.plays)
accounts = search_users.sync(client=client, query="cooking", count=10)
if isinstance(accounts, UserSummaryPage):
for u in accounts.data:
print(u.username, u.followers, u.verified)
followers = get_user_followers.sync("tiktok", client=client, count=30)
if isinstance(followers, UserPage):
for u in followers.data:
print(u.username, u.followers)
sound = get_music.sync("6696419263248336898", client=client)
if isinstance(sound, MusicResponse):
print(sound.data.title, sound.data.videos)
trending = get_trending_videos.sync(client=client, count=16)
if isinstance(trending, VideoPage):
for v in trending.data:
print(v.id, v.author.username, v.plays)
sounds = search_music.sync(client=client, query="lofi", count=12)
if isinstance(sounds, MusicSummaryPage):
for m in sounds.data:
print(m.id, m.title, m.author)
live = get_user_live.sync("tiktok", client=client)
if isinstance(live, LiveRoomResponse):
print(live.data.live, live.data.title, live.data.viewers)
transcript = get_video_transcript.sync("7708543740230536461", client=client)
if isinstance(transcript, TranscriptResponse):
print(transcript.data.language, transcript.data.text)
tags = search_hashtags.sync(client=client, query="street food", count=10)
if isinstance(tags, HashtagSummaryPage):
for t in tags.data:
print(t.name, t.result_videos, t.result_plays)Every operation has sync, sync_detailed, asyncio and asyncio_detailed forms. The modules are
api.users, api.videos, api.hashtags, api.music, api.playlists, api.search, api.account and
api.billing. get_related_videos, get_trending_videos and get_video_transcript are in api.videos, and get_user_live is in
api.users. sync returns the
model of the answer on a 200 (UserResponse, VideoPage, ...), an Error model on an error status, and
None on a status the API reference does not list. Check the type with isinstance, as above.
Methods
| Method | Endpoint |
|---|---|
getMe / get_me | GET /v1/me |
getUser / get_user | GET /v1/users/{user} |
getUsers / get_users | POST /v1/users/batch |
getUserVideos / get_user_videos | GET /v1/users/{user}/videos |
getUsersVideos / get_users_videos | POST /v1/users/videos/batch |
getUserFollowers / get_user_followers | GET /v1/users/{user}/followers |
getUserFollowing / get_user_following | GET /v1/users/{user}/following |
getUserReposts / get_user_reposts | GET /v1/users/{user}/reposts |
getUserPlaylists / get_user_playlists | GET /v1/users/{user}/playlists |
getUserLive / get_user_live | GET /v1/users/{user}/live |
getVideo / get_video | GET /v1/videos/{id} |
getVideos / get_videos | POST /v1/videos/batch |
getRelatedVideos / get_related_videos | GET /v1/videos/{id}/related |
getTrendingVideos / get_trending_videos | GET /v1/trending/videos |
getVideoTranscript / get_video_transcript | GET /v1/videos/{id}/transcript |
getComments / get_comments | GET /v1/videos/{id}/comments |
getCommentReplies / get_comment_replies | GET /v1/videos/{id}/comments/{comment_id}/replies |
getHashtag / get_hashtag | GET /v1/hashtags/{name} |
getHashtagVideos / get_hashtag_videos | GET /v1/hashtags/{name}/videos |
getMusic / get_music | GET /v1/music/{id} |
getMusicVideos / get_music_videos | GET /v1/music/{id}/videos |
getPlaylistVideos / get_playlist_videos | GET /v1/playlists/{id}/videos |
searchVideos / search_videos | GET /v1/search/videos |
searchUsers / search_users | GET /v1/search/users |
searchMusic / search_music | GET /v1/search/music |
searchLive / search_live | GET /v1/search/live |
searchHashtags / search_hashtags | GET /v1/search/hashtags |
listPacks, createCheckout / list_packs, create_checkout | billing |
Video search, account search and the follower and following lists are new on 2026-12-02. An entry of account
search is a short profile (UserSummary) with a rounded followers. In an entry of a follower or following
list the counts may be rounded. getUser / get_user gives the exact ones.
Sounds, reposts, playlists, related videos and trending videos are new on 2026-12-03. getMusic / get_music
gives a MusicDetail; its videos, the count of videos that use the sound, is rounded by TikTok.
getUserPlaylists / get_user_playlists gives Playlist entries; pass the id of one to getPlaylistVideos /
get_playlist_videos. getRelatedVideos / get_related_videos (one page of up to 16) and getTrendingVideos /
get_trending_videos (up to 50) take no cursor and have no next page.
Sound search, live and transcripts are new on 2026-12-03 too. searchMusic / search_music gives MusicSummary
entries; pass the id of one to getMusic / get_music. searchLive / search_live gives LiveRoom entries, and
getUserLive / get_user_live gives one LiveRoom, with live: false and no room fields when the account is not
live. A LiveRoom has no stream URL. getVideoTranscript / get_video_transcript gives a Transcript: segments
with start and end in seconds, and text. Its lang picks a language; a video with no subtitles is a 404.
Hashtag search is new on 2026-12-03 too. searchHashtags / search_hashtags gives HashtagSummary entries,
most used first in about 24 videos of the general search. Their result_videos and result_plays count those
videos only, not the totals of TikTok: pass the name of an entry to getHashtag / get_hashtag for those. It
takes no cursor and has no next page.
A user is a username, with or without @, or a sec_uid. Pass next_cursor from a page back as cursor.
Other languages: the OpenAPI document works with any generator, and the MCP server covers agents without code.