Social media5 min readBy Purrkey teamUpdated

How to fetch a TikTok video's stats by URL

Fetch a TikTok video by URL and return its caption, author and engagement counts in one comparison table. Twelve campaign URLs become a ranked snapshot of which format to repeat

On this page

You have 12 TikTok video URLs from a campaign and need each post's caption, author, views, likes, comments, shares and saves in one comparison table, so you can rank the posts by engagement and pick the format to repeat next week

anyapi.tiktok.video handles one video per call, so the job is 12 calls and 12 rows. The worksheet below is the deliverable. No run has been executed for this guide, so the numbers in the placeholder row show the shape of the table, not a result

The 12 URLs and the table they become

Example input, invented for this guide and to be replaced with the campaign URLs:

https://www.tiktok.com/@purrkeydemo/video/7412345678901234567

The finished table has nine columns. Eight of them come straight from the response and the last one you calculate

ColumnComes from
iddata.id, the numeric run at the end of the URL
authorHandledata.authorHandle, without the @ prefix
captiondata.caption
viewsdata.views
likesdata.likes
commentsdata.comments
sharesdata.shares
savesdata.saves
engagement ratecalculated: (likes + comments + shares + saves) / views

Values here are placeholders showing the shape:

idauthorHandlecaptionviewslikescommentssharessavesengagement rate
7412345678901234567purrkeydemo(caption text)(integer)(integer)(integer)(integer)(integer)(decimal)

A video with zero views would break a naive formula, so return an empty rate for that row and keep the counts visible

If the next question is which creators to work with rather than which post performed, the companion guide at https://purrkey.app/blog/research-tiktok-creators follows that thread

What anyapi.tiktok.video takes

The catalog entry is called through POST /v1/runs with toolId anyapi.tiktok.video. Pass url with the full TikTok video URL copied from the app or browser, or pass id with the numeric run at the end of a video URL

requireFields is optional. Omit it and routing is unchanged, with the cheapest source serving. Name fields such as views and the request is served only by a source that returns each one you named, and fields you do not name still come back whenever the serving source has them

That precision carries a price. When the cheapest source cannot return a named field, a dearer source serves and you are charged its price, so reserve requireFields for the counts you plan to compare and leave it off for a quick snapshot

The enum for requireFields is authorFollowers, authorVerified, comments, likes, sdVideoUrl, shares, videoUrl and views. A named field can still be absent on a video that genuinely lacks it, and naming a combination that no single source returns together is refused as invalid input, with no charge

Reading the output fields that drive the ranking

Two fields tell you whether you own a row. found is a boolean and data holds the object or null. When found is false, reason carries the value not_found, which covers a source stating that the target does not exist, or returning nothing for it

A found: false answer is a successful call, not an error, and the contract says costUsd is what it actually cost. That limit lands here, on the fetch step: a 12 URL run where two videos have been removed would still bill 12 calls and leave you 10 rows of numbers, so plan the campaign review as 12 calls rather than as 12 results

Inside data, id, caption, region, views, likes, comments, shares and saves are required. authorFollowers and authorVerified are nullable and arrive as null when the serving source does not report them, so do not rank on follower count unless you named it in requireFields

For the format decision, sort by the calculated rate and keep caption and hashtags beside it. hashtags carries the tags from the caption without the # prefix, and @-mentions are left out, so a tag count per row is a usable column when format is the question

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to fetch TikTok
video stats for the 12 campaign URLs below. Check the current inputs and
price of anyapi.tiktok.video before running anything. Call the tool once
per URL. Return a table with id, authorHandle, caption, views, likes,
comments, shares, saves and engagement rate, where engagement rate is
(likes + comments + shares + saves) / views and is left empty when views
is zero. Leave the number cells empty for a row where found is false and
write not_found in a note column. Do not invent numbers.

https://www.tiktok.com/@purrkeydemo/video/7412345678901234567
(replace with the remaining 11 campaign URLs)

The example URL is invented. Swap in the real campaign URLs before running, because a made-up id comes back as found: false

Estimated tool cost

The unit is max_call: "Maximum per call. Successful runs settle at the actual AnyAPI charge"

StepFormulaUnit pricePlanned quantityTotal
Single video lookupcalls x max price$0.0012 per call1$0.0012
12-video campaign reviewcalls x max price$0.0012 per call12$0.0144

Those totals are ceilings, not settled charges, and model fees for the agent are not counted. A found: false row stays inside the plan, since the call is billed either way

Next step

Open https://purrkey.app/tools/tiktok?q=video, run the first campaign URL on its own, and read the caption and the four counts before you spend the other 11 calls

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with TikTok.
Explore TikTok tools and pricing

FAQ

How do I get a TikTok video's stats from its URL?

Call anyapi.tiktok.video once per video URL and it returns the caption, author handle, views, likes, comments, shares and saves. Twelve campaign URLs mean twelve calls and twelve table rows.

What inputs does anyapi.tiktok.video take?

Pass url with the full TikTok video URL, or pass id with the numeric run at the end of a video URL. The id field is also accepted as videoId, and requireFields is optional.

What does requireFields do on a TikTok video lookup?

It names the output fields the request must be able to return, such as views. When the cheapest source cannot return a named field, a dearer source serves and you are charged its price. Naming a combination that no single source returns together is refused as invalid input, with no charge.

What does found false mean for a TikTok video?

It means the source states the target does not exist, or returned nothing for it, and reason carries the value not_found. A found false answer is a successful call, not an error, and it is billed at the actual call cost.

How much does it cost to check 12 TikTok videos?

At up to $0.0012 per call, 12 calls are at most $0.0144 and a single lookup is at most $0.0012. Those totals are ceilings, and successful runs settle at the actual AnyAPI charge.

Which TikTok video output fields can be null?

authorFollowers and authorVerified come back null when the serving source does not report them. id, caption, region, views, likes, comments, shares and saves are required in the data object.

How is engagement rate calculated in the comparison table?

The tool does not return it. It is calculated from the counts as (likes + comments + shares + saves) / views, and left empty for a row where views is zero.

Next step

Try this with TikTok

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See TikTok tools

Share this article