If you are building analytics dashboards, creator-discovery tools, or audience research - some of the most common TikTok API use cases - the first thing you usually need is reliable TikTok profile data. This guide walks through exactly how to fetch it programmatically with PrimeApi in 2026 - what data is available, how authentication works, a step-by-step request to the userinfo-by-username endpoint, working code in three languages, a field-by-field look at the response, and the credit, rate-limit and error details that trip people up.
What user data can you actually get?
The user endpoints expose the public-facing fields of a TikTok profile. From a single userinfo-by-username call you can typically read the display name, unique handle, the permanent numeric user ID, the security ID (secUid) needed by other endpoints, avatar URLs, the bio/signature text, verification status, and the headline statistics: follower count, following count, total likes (hearts), and video count. Because PrimeApi fetches data in real time without caching, those counts reflect the profile at the moment you call - not a stale snapshot. Freshness is the first thing worth checking in any vendor, which is why it opens our buyer's guide to choosing a TikTok API in 2026.
That single profile call is also the gateway to the rest of the User category. The secUid it returns is the key you pass to user-posts, user-followers, user-following, user-liked-posts and the popular/oldest variants. So the practical pattern is: resolve a handle to a profile once, store the secUid and numeric ID, then page through that user's content.
How does authentication work?
Authentication is a single custom HTTP request header. After you register on primeapi.co and confirm your email, your key appears on the /profile/ page. Send it on every request as X-PrimeAPI-Key. There is no OAuth dance and no account on TikTok's official developer platform required - PrimeApi is an independent service that handles the upstream data collection for you. New accounts include 50 free credits so you can test immediately. The PrimeApi API documentation covers the same quickstart in condensed form if you want the reference version.
Step by step: userinfo-by-username
The endpoint takes one required query parameter, username, which is the public @handle without the @ symbol. The base URL is https://api.primeapi.co/. A complete request looks like https://api.primeapi.co/userinfo-by-username?username=taylorswift with your key in the header. Below are three working versions you can copy directly.
curl
curl -s "https://api.primeapi.co/userinfo-by-username?username=taylorswift" \
-H "X-PrimeAPI-Key: YOUR_API_KEY"
Node.js (Axios)
const axios = require("axios");
async function getUser(username) {
const res = await axios.get(
"https://api.primeapi.co/userinfo-by-username",
{
params: { username },
headers: { "X-PrimeAPI-Key": "YOUR_API_KEY" }
}
);
console.log("Remaining credits:", res.headers["x-primeapi-balance"]);
return res.data;
}
getUser("taylorswift")
.then(data => console.log(JSON.stringify(data, null, 2)))
.catch(err => console.error(err.response ? err.response.data : err.message));
Python (Requests)
import requests
def get_user(username):
resp = requests.get(
"https://api.primeapi.co/userinfo-by-username",
params={"username": username},
headers={"X-PrimeAPI-Key": "YOUR_API_KEY"},
timeout=15,
)
print("Remaining credits:", resp.headers.get("X-PrimeAPI-Balance"))
resp.raise_for_status()
return resp.json()
if __name__ == "__main__":
data = get_user("taylorswift")
print(data)
Understanding the response fields
The response is JSON. The exact shape mirrors TikTok's own structure, but the fields you will reach for most often are easy to map:
- id - the permanent numeric user ID. Use this with
userinfo-by-idfor stable lookups. - uniqueId - the public
@handle. This can change when a user renames their account. - secUid - the opaque security ID required by
user-posts,user-followersand similar endpoints. - nickname - the human-readable display name.
- signature - the bio text.
- verified - boolean verification badge status.
- avatarLarger - a CDN URL for the profile picture.
- followerCount, followingCount, heartCount, videoCount - the headline stats, usually nested under a stats object.
A robust integration reads secUid and id first and persists them, because handles are not a reliable long-term key.
Credits, balance and rate limits
Every call costs exactly 1 credit, regardless of endpoint. The credit is deducted once your key clears validation and the request is forwarded, so a lookup that returns no results still consumes one; requests rejected up front - missing key, invalid key, rate limit exceeded or an empty balance - are not charged. The response includes an X-PrimeAPI-Balance header so you can monitor your remaining quota in real time - the code samples above print it. The default rate limit is 100 requests per minute. For most dashboards and scheduled jobs that is comfortable; if you are backfilling thousands of profiles, spread the work across minute windows or ask support about a higher rate. Paid tiers on the PrimeApi pricing page scale credits from 2,500 (Basic, $9.90) up to 500,000 (Enterprise, $279.00).
Common errors and how to fix them
Most failures are authentication or quota related, and PrimeApi returns a clear JSON message for each - the same list is kept in the API error response reference:
- "Please sign up to primeapi.co" - no
X-PrimeAPI-Keyheader was sent. Add the header. - "PrimeAPI-Key is not available" - the key is wrong or the account is not yet activated. Re-copy it from
/profile/and confirm your email. - "You have exceeded the requests per minute limit..." - you crossed 100 requests in a minute. Throttle and retry on the next window.
- "Your balance has been exhausted..." - you are out of credits. Top up on the pricing page.
Branch on the JSON message body rather than on the HTTP status code alone, since these four cases are reported in the payload. On the data side, a username that does not exist or a private/region-blocked account will not return the usual stats; validate the handle and handle empty results gracefully.
Putting it together
The cleanest workflow is: call userinfo-by-username once, capture id and secUid, then use those identifiers with the other User endpoints to pull posts and audience data. Watch the balance header, stay under 100 requests per minute, and treat handles as mutable. With those habits, fetching TikTok user data becomes a predictable, one-credit operation you can build on. If your pipeline also needs the media files themselves, the companion walkthrough on downloading TikTok videos without a watermark picks up where this one stops.
Frequently asked questions
Do I need a TikTok developer account to use this API?
No. PrimeApi is an independent, unofficial service and is not affiliated with or endorsed by TikTok or ByteDance. You only need a PrimeApi account and your API key from the /profile/ page.
How many credits does one user lookup cost?
Each request to userinfo-by-username (or any endpoint) costs 1 credit, whether or not it comes back with data. Only requests rejected before they reach the data layer - missing key, invalid key, rate limit exceeded or an empty balance - are not charged. New accounts start with 50 free credits, and your remaining balance is returned in the X-PrimeAPI-Balance response header.
What is the difference between userinfo-by-username and userinfo-by-id?
userinfo-by-username takes a public @handle, which is convenient but can change if the user renames their account. userinfo-by-id takes the numeric, permanent user ID, which is more stable for long-running data collection.
Why am I getting a 'PrimeAPI-Key is not available' message?
That JSON error means the X-PrimeAPI-Key header was sent but does not match an active key. Copy the key exactly from /profile/, confirm your account is activated via the confirmation email, and ensure no extra spaces are included.
Is the user data cached or real-time?
Responses are fetched in real time without caching, so figures such as follower counts reflect the profile at request time. Average response time is around one second.
What is the rate limit for the user endpoints?
The default limit is 100 requests per minute. If you exceed it you receive a JSON message about the per-minute limit; wait for the next minute window or contact support for a higher rate.