Giving AI agents public data from TikTok, Instagram, and YouTube

Giving AI agents public data from TikTok, Instagram, and YouTube
The UnifAPI team
The UnifAPI team

A practical guide to wiring TikTok, Instagram, and YouTube public-data into agents — endpoints, unified request shape, pagination, and cost math.

UnifAPI exposes TikTok, Instagram, and YouTube public data through three identical endpoints per platform — search, fetch-by-id, list-by-creator — behind one API key at $0.001 per record. This guide shows the request shape, pagination, and cost math so an agent can wire all three in under an hour.

Most consumer-facing agent use cases — brand monitoring, creator research, product launch analysis, trend detection — bottom out in the same three platforms: TikTok for short video, Instagram for visual social, YouTube for long-form. Building a stable feed from all three has historically meant three vendor contracts and three different envelopes. With UnifAPI it's one key and one shape across the lot.

Which endpoints you actually need

For most agent workflows, three primitives are enough per platform: search by keyword (or hashtag), fetch a single post / video by ID, and list the recent posts from a creator. Anything else — comments, likes counts, related posts — is supporting detail you can fan out to once the primary set is in hand.

On UnifAPI, those map to: TikTok — /v1/tiktok/search, /v1/tiktok/video, /v1/tiktok/user/posts. YouTube — /v1/youtube/search, /v1/youtube/video, /v1/youtube/channel/videos. Instagram — /v1/instagram/search, /v1/instagram/post, /v1/instagram/user/posts. Naming intentionally lines up across platforms so the agent prompt that learned one learned all three.

The unified request shape

Every endpoint accepts the same Authorization: Bearer <key> header and returns the same outer envelope: { data: [...], pagination: { cursor, has_more }, meta }. The fields inside data are platform-specific (a TikTok video has a hashtag list, a YouTube video has a transcript URL), but the shape around it is identical.

That uniformity matters more than it sounds. It means your agent's tool-use loop has one retry policy, one pagination handler, one error envelope — not three. The platform-specific knowledge stays inside the data field, where the model can see it.

Pagination across three platforms

Each upstream paginates differently — TikTok uses a cursor token, YouTube uses pageToken, Instagram uses end_cursor. UnifAPI normalizes all three to a single { cursor, has_more } object. Your agent loop reads the cursor, passes it back as the cursor query parameter on the next call, and stops when has_more flips to false.

Default page size is 20 records on every platform. The cap is 50. For most agent runs, one page is enough — the model rarely needs more than the top 20 hits to make a decision.

Estimating cost per agent run

Cost is records × $0.001. A "monitor TikTok mentions of our brand this week" run that pulls 20 search results, then fans out to fetch 5 individual videos for transcripts, is 25 records — $0.025. A "creator research on this account" run that pulls 50 recent posts and 10 video details is 60 records — $0.06.

A back-of-envelope rule that's served us well: budget $0.05 per agent run for typical research workflows, $0.20 for deep dives. The free tier's 1,000 records / month covers about 20,000 light runs or 5,000 deep ones.

Putting it together

An end-to-end "find what's trending about us this week across all three" agent looks like: parallel-call /v1/tiktok/search, /v1/instagram/search, /v1/youtube/search with the brand keyword; collect the top 10 from each; for the top 3 of each platform, fan out to the per-post endpoint for the full transcript or caption; pass the lot to the model with a summarization prompt.

Total cost: 30 search records + 9 detail records = 39 records, $0.039. Total integration count: one. That's the pitch — go give it a try at unifapi.com/signup with the free tier.