Batch reads
Up to 100 profiles or videos, or the newest videos of up to 20 accounts, in one request.
Three endpoints take a list instead of one username or id. They cost the same per object as the single endpoints, answer in one round trip, and never charge for an input that returned nothing.
| Endpoint | Input | Max | Credits |
|---|---|---|---|
POST /v1/users/batch | usernames | 100 | 1 per profile found |
POST /v1/videos/batch | ids (video ids) | 100 | 1 per video found |
POST /v1/users/videos/batch | users (usernames or sec_uids), count | 20 | 1 per video returned |
All three also accept GET with a comma list: /v1/users/batch?usernames=tiktok,nba,espn,
/v1/videos/batch?ids=7106594312292453675, /v1/users/videos/batch?users=tiktok,nba&count=3.
Request
curl -X POST https://api.tikdataapi.com/v1/users/batch \
-H "x-api-key: $KEY" -H "content-type: application/json" \
-d '{"usernames": ["tiktok", "nba", "nobody_here_12345"]}'{
"data": [
{ "id": "107955", "username": "tiktok", "followers": 92400000, "...": "..." },
{ "username": "nba", "...": "..." }
],
"errors": [
{ "input": "nobody_here_12345", "code": "not_found", "message": "no such account", "reason": "nonexistent" }
],
"items": 2,
"credits_charged": 2,
"balance_remaining": 997,
"cache": "miss",
"cache_hits": 0,
"request_id": "3d4f3d1c-..."
}Rules
dataholds the objects that were found, in input order. Every input that returned nothing is inerrorswith acode:not_found,no_credits,access_denied,upstream_rate_limited,upstream_error,request_rejected,bad_requestorbusy.- A banned account is a
not_foundwith"reason": "banned". An account that was deleted or never existed is anot_foundwith"reason": "nonexistent": TikTok does not tell those two apart. A private account is found, withprivate: true. In the videos batch, a deleted, private or removed video is inerrorswith itsreason. Thenot_foundsection has eachreason. - Duplicates are folded, with no regard to case and to a leading
@.@TikTokandtiktokare the same username. - The cache is shared with the single endpoints. An object read in the last 10 minutes (profiles) or 5 minutes
(videos) is served from cache at half price;
cache_hitssays how many, andcacheismixedwhen a batch has both. - When the balance covers only part of the list, the API fetches what it can pay for and returns the rest as
no_credits. Send those again after a top-up. - When nothing is found and every failure is transient, the answer is
503withretry-after, and nothing is charged. fresh=truereads TikTok again for the whole list. An item that has a cached copy costs 2x; an item with no cached copy costs the normal price.
Latest videos of many accounts
POST /v1/users/videos/batch gives the newest videos of up to 20 accounts in one call, by username or sec_uid.
count is the number of videos for each account, 1 to 16, default 3. The videos are the same as from
/v1/users/{user}/videos: pinned videos first, then newest first.
curl -X POST https://api.tikdataapi.com/v1/users/videos/batch \
-H "x-api-key: $KEY" -H "content-type: application/json" \
-d '{"users": ["tiktok", "nba"], "count": 3}'{
"data": [
{ "user": "tiktok", "videos": [{ "id": "...", "description": "..." }, "..."], "next_cursor": "MTczMjk4NjEz..." },
{ "user": "nba", "videos": [{ "id": "...", "description": "..." }, "..."], "next_cursor": "MTczMjk1MDc4..." }
],
"errors": [],
"items": 6,
"credits_charged": 6,
"balance_remaining": 991,
"cache": "miss",
"cache_hits": 0,
"request_id": "3d4f3d1c-..."
}datahas one entry for each account that was read, in input order.useris the username (without@, in lower case) or the sec_uid from the request.itemsis the number of videos for all accounts together, and that is the number of credits.- An account with no public videos, or a private one, is an entry with an empty
videoslist. It costs nothing. To know which, read the profile with/v1/users/batch. - An account that could not be read is in
errorswith acode. Send it again. - To read more videos of one account, send the
next_cursorof the entry to/v1/users/{user}/videosascursor. - The cache is shared with
/v1/users/{user}/videos: a list read in the last 2 minutes is served at half price.cache_hitsis the number of accounts served from cache. - The wallet limit counts
countvideos for each account. Accounts that the balance does not cover come back asno_credits. - Pinned videos come first. An account with pinned videos needs a
countabove the number of its pinned videos to show its newest video that is not pinned. - For thousands of accounts, send the calls one after the other, 20 accounts in each.