Skip to Content
tikdataapi.com

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.

EndpointInputMaxCredits
POST /v1/users/batchusernames1001 per profile found
POST /v1/videos/batchids (video ids)1001 per video found
POST /v1/users/videos/batchusers (usernames or sec_uids), count201 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

  • data holds the objects that were found, in input order. Every input that returned nothing is in errors with a code: not_found, no_credits, access_denied, upstream_rate_limited, upstream_error, request_rejected, bad_request or busy.
  • A banned account is a not_found with "reason": "banned". An account that was deleted or never existed is a not_found with "reason": "nonexistent": TikTok does not tell those two apart. A private account is found, with private: true. In the videos batch, a deleted, private or removed video is in errors with its reason. The not_found section has each reason.
  • Duplicates are folded, with no regard to case and to a leading @. @TikTok and tiktok are 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_hits says how many, and cache is mixed when 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 503 with retry-after, and nothing is charged.
  • fresh=true reads 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-..."
}
  • data has one entry for each account that was read, in input order. user is the username (without @, in lower case) or the sec_uid from the request. items is 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 videos list. It costs nothing. To know which, read the profile with /v1/users/batch.
  • An account that could not be read is in errors with a code. Send it again.
  • To read more videos of one account, send the next_cursor of the entry to /v1/users/{user}/videos as cursor.
  • The cache is shared with /v1/users/{user}/videos: a list read in the last 2 minutes is served at half price. cache_hits is the number of accounts served from cache.
  • The wallet limit counts count videos for each account. Accounts that the balance does not cover come back as no_credits.
  • Pinned videos come first. An account with pinned videos needs a count above 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.