Answers
How do I find TikTok creators in a niche with an API?
Short answer
Search the niche's keywords with TikTok video search ($0.002 per page of about 30 videos), group the videos by creator, then pull each promising creator's followers, total likes and video count with TikTok account profile ($0.002 each). A shortlist built from 10 keywords × 3 pages and 150 profiles costs $0.36.
A home-espresso brand wants 20 micro-creators on TikTok: people with 10,000 to 100,000 followers who already make coffee videos that get liked. Nobody has a directory of them. They show up in search, though, attached to the videos that rank for the words your customers type.
The method
- Write the niche as searches. Ten phrases a buyer would type: home espresso, latte art at home, espresso machine review, and so on. Use the language of the market you target, because search has no country filter.
- Search each one. TikTok video search with
sort=most_liked, three pages each. You get about 30 videos per page with the author's handle. - Group by creator. Count how many of each creator's videos showed up and add up their likes. Someone who shows up for four different phrases probably lives in the niche; a single viral hit shows up once.
- Pull profiles. TikTok account profile for the top 150 handles gives followers, total likes, video count and bio.
- Filter. Keep the follower range you want, drop accounts with few videos, and read the bios for a contact email.
Cost
| Step | Calls | Cost |
|---|---|---|
| 10 phrases × 3 pages | 30 | $0.06 |
| 150 profiles | 150 | $0.30 |
| Whole shortlist | 180 | {{cost:tiktok.videos.search30+tiktok.users.get150}} |
Script
import os, requests
from collections import defaultdict
API = "https://api.okdata.online/v1"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
def get(path, **params):
body = requests.get(f"{API}/{path}", headers=H, params=params, timeout=60).json()
if body["code"] != "ok":
raise RuntimeError(f"{body['code']}: {body['message']}")
return body
phrases = ["home espresso", "latte art at home", "espresso machine review"]
hits = defaultdict(lambda: {"videos": 0, "likes": 0})
for q in phrases:
cursor = None
for _ in range(3):
body = get("tiktok/videos/search", query=q, sort="most_liked", **({"cursor": cursor} if cursor else {}))
for v in body["data"]["items"]:
if not v["author"]["username"]:
continue
h = hits[v["author"]["username"]]
h["videos"] += 1
h["likes"] += v["metrics"]["likes"] or 0
if not body["page"]["has_more"]:
break
cursor = body["page"]["next_cursor"]
top = sorted(hits, key=lambda u: (hits[u]["videos"], hits[u]["likes"]), reverse=True)[:150]
for handle in top:
p = get("tiktok/users/get", username=handle)["data"]["item"]
if 10_000 <= (p["followers"] or 0) <= 100_000:
print(handle, p["followers"], p["likes"], p["posts"], (p["bio"] or "")[:60])
What this will not tell you
- Audience age, gender and country are not public, so they are not here.
- Follower counts inside search results are empty; that is why step 4 exists.
- There is no account search and no profile video list. Creators who never rank for your phrases stay invisible, so widen the phrase list rather than paging deeper.
Alternatives
TikTok's own creator marketplace shows audience demographics and handles outreach, and it is the better choice once you are running paid campaigns with a TikTok ad account. Influencer databases save the search step for a monthly fee. For a first list of twenty names, scrolling the app with a notebook works too. The creator discovery page runs the same method across platforms.
Updated