Get a TikTok profile and its country with Python
Updated 2026-10-03
Two endpoints cover most account lookups: profile returns the name,
bio and follower counts, and current_region returns the account's country. This guide
uses both from Python.
What you need
- Python 3.8 or newer
- An API key (see the plans)
- The
omarthinglibrary:pip install omarthing
1. Get the profile
Call profile with a username. Add format="clean" to get a short object
instead of TikTok's full raw data.
from omarthing import Client
api = Client("YOUR_API_KEY")
profile = api.profile(username="tiktok", format="clean")
print(profile["nickname"], profile["followers"], profile["following"], profile["hearts"])
Output:
TikTok 96041744 1 464964256
The clean object also has bio, avatar, user_id,
sec_uid and private. All fields are listed on the
profile endpoint page.
2. Get the country
Call current_region. You get a two-letter code in region and the country
name in region_name.
from omarthing import Client
api = Client("YOUR_API_KEY")
print(api.current_region(username="bbcnews"))
Output:
{'region': 'GB', 'region_name': 'United Kingdom', 'username': 'bbcnews'}
Both in one script
Put the two calls in a small function and loop over any list of accounts:
from omarthing import Client
api = Client("YOUR_API_KEY")
def lookup(username):
profile = api.profile(username=username, format="clean")
region = api.current_region(username=username)
return f"{profile['nickname']} (@{username}): {profile['followers']:,} followers, {region['region_name']}"
for name in ["bbcnews", "realmadrid", "tiktokjapan"]:
print(lookup(name))
Example output (the numbers change):
BBC News (@bbcnews): 16,422,758 followers, United Kingdom
Real Madrid C.F. (@realmadrid): 77,293,077 followers, Spain
TikTok Japan (@tiktokjapan): 2,052,198 followers, Japan
Handle errors
If a lookup fails, the library raises OmarThingError with the HTTP status and a
code. For example, 424 FETCH_FAILED means the region could not be fetched, which also
happens for a username that does not exist, and 400 MISSING_IDENTIFIER means you passed
no username.
from omarthing import Client, OmarThingError
api = Client("YOUR_API_KEY")
try:
print(api.current_region(username="no_such_user_zz9"))
except OmarThingError as e:
print(e.status_code, e.code)
For a username that does not exist this prints:
424 FETCH_FAILED
curl and JavaScript
curl "https://dev.omar-thing.site/api/v1/current_region?username=bbcnews" -H "X-API-Key: YOUR_API_KEY"
With npm install omarthing:
import { Client } from 'omarthing';
const api = new Client('YOUR_API_KEY');
const profile = await api.profile({ username: 'bbcnews', format: 'clean' });
const { region_name } = await api.currentRegion({ username: 'bbcnews' });
console.log(profile.nickname, profile.followers, region_name);
Questions
What is the difference between profile and current_region?
profile describes the account: name, bio, followers. current_region returns
only the country TikTok has for it. The country field in the profile can be empty, so use
current_region when you need the country.
Is the region where the person lives?
Not necessarily. It is the region TikTok currently assigns to the account, which can differ from where its owner is based.
Is this an official TikTok API?
No. This is an unofficial API that returns public TikTok data. It is not affiliated with, endorsed by, or sponsored by TikTok or ByteDance.
Next steps
- Endpoint reference: profile and current_region
- Followers and following lists
- Posts and comments
- Trending searches by country in Python
- More scripts: tiktok-api-examples on GitHub