Skip to main content
Read public TikTok data as JSON with POST /v1/social/tiktok/{action}. {action} picks what to read. A completed request costs 0.5 credits.

Request

The request waits for the result, up to 290 seconds, and answers 200 with the result in response. A task still running answers 202; poll GET /v1/async/task/{id} or set webhook. See Async tasks.

Actions

For video and comments, videoId and url take a video ID, a video or photo post URL, or a vm.tiktok.com or vt.tiktok.com short link. For creator, username and url take a username, an @username or a profile URL, such as https://www.tiktok.com/@nasa.

Parameters

A request with a parameter of another action, a value outside the ones listed below, or a missing required field is refused when you submit it, with 400 VALIDATION_ERROR naming the field. search:
  • query: Required, up to 500 characters, with at least one letter or digit.
  • limit: Optional integer from 1 to 50, default 10. A search finds videos through Google results, so it returns up to limit videos, fewer when Google lists fewer. It returns one page.
comments:
  • limit: Optional integer from 1 to 500, default 50. It counts comments and replies together.
  • includeReplies: true (default) reads each comment’s replies after it. false returns top-level comments only.
trending:
  • limit: Optional integer from 1 to 50, default 20.
  • regionCode: A two-letter country code, default US.

Response example

Result fields

  • Every response echoes platform and action, and provider names the source the data was read from. Lists carry returnedCount.
  • A video has videoId, url, caption, hashtags (when the caption has any), author (id, handle, displayName, verified, avatarUrl, profileUrl, followerCount), music (id, title, author, original, durationSeconds), coverUrl, durationSeconds, language, region, publishedAt, viewCount, likeCount, commentCount, shareCount and collectCount, the times it was saved. Counts above 1 million are the rounded values TikTok shows.
  • search returns videos, each with its position and source, and hasMore is false with nextCursor null. A result whose page could not be read carries only url, videoId and the author’s handle and profileUrl.
  • video returns the video’s fields at the top level.
  • comments returns videoId, url (null when you sent only videoId), comments, includeReplies, returnedCount, topLevelCount, replyCount and availableTopLevelCount, the comment count TikTok shows for the video.
    • A comment has commentId, videoId, text, author, likeCount, replyCount, publishedAt and parentId, which is null for a top-level comment and the commentId it answers for a reply.
    • A video with no comments, or with comments turned off, ends the task with ENGINE_NO_RESULT.
  • creator returns creatorId, handle, displayName, bio, bioLink, avatarUrl, profileUrl, verified, privateAccount, createdAt, followerCount, followingCount, likeCount and videoCount.
  • trending returns videos and the regionCode it read.
  • A video or creator that does not exist or is private ends the task with PAGE_UNAVAILABLE. Only completed requests are charged.

HTML page

Set include.html to true and the result gains html, a link to the TikTok page the answer was read from, saved as a file you can put in a report. html has status, url and expiresAt, described in HTML pages.
  • include.html works on video and creator.
  • The file is the HTML document TikTok sent for the page, before any script ran. It starts with a note comment, Saved by querying.ai: the page TikTok served for task <id> at <UTC time>, the page as TikTok sent it, before any script ran, the address of the visit and its session ids masked.
  • Values that belong to the visit are replaced with zeros of the same length: cookie values, session, request and device ids, CSRF and other tokens, nonces and the signatures in media addresses. Because those signatures are masked, the image and video links in the file do not load. Content that depends on where the visit came from, such as the regional CDN host names in media addresses, stays as TikTok sent it.
  • The document’s scripts are kept as text. The file is served with a Content-Security-Policy that runs no script and loads no outside resource.
  • TikTok sends its data inside an embedded JSON script, so the opened file shows almost nothing and the data is in the document source.
  • On video, a short link is kept as the page it redirects to.
  • Every other action (search, comments and trending) returns 422 EVIDENCE_UNSUPPORTED when you submit the task, and the message names why.
  • The page costs nothing extra: the request is still 0.5 credits.
  • When the page cannot be kept, the answer is still returned and html is { "status": "failed", "error": "EVIDENCE_FAILED" }. Resubmit the task to try again.