ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. Never Run Out of Posts: Pull Trending Content Ideas From the TikTok API
Tutorial

Never Run Out of Posts: Pull Trending Content Ideas From the TikTok API

Stop guessing what to post. Use the TikTok hashtag and video search API to surface what is actually getting views in your niche. Python and JS code.

Get Free API KeyAPI Docs

The "I never know what to post next" problem is a data problem, not a creativity problem. Founders and creators stare at a blank draft because they are guessing instead of looking at what already works in their niche. The TikTok API fixes the guessing half: pull the top videos for your niche hashtags, sort by play count, and you have a ranked list of formats and hooks that are getting views right now. Scavio's TikTok endpoints return this as structured JSON at 1 credit ($0.005) per request, no scraping, no proxies. This walks through turning a niche into a content-idea queue. The API gives you the signal; the angle is still yours.

Prerequisites

  • A Scavio API key (50 free credits on signup)
  • Python 3.9+ or Node 18+
  • A niche and two or three seed hashtags

Walkthrough

Step 1: Resolve your hashtag to its challenge ID

TikTok endpoints are a two-step lookup: name to ID, then ID to data. Start by resolving your seed hashtag (for example "skincare") to its challenge_id and view stats.

Python
import os, requests

H = {"Authorization": f"Bearer {os.environ['SCAVIO_API_KEY']}", "Content-Type": "application/json"}
tag = requests.post("https://api.scavio.dev/api/v1/tiktok/hashtag",
    headers=H, json={"hashtag": "skincare"}).json()
print(tag["data"])  # challenge_id, view_count, video_count

Step 2: Pull the top videos under that hashtag

Fetch videos for the hashtag and read the statistics block on each: play_count, digg_count (likes), comment_count, share_count. These are your ranking signals, what the niche is actually rewarding.

Python
vids = requests.post("https://api.scavio.dev/api/v1/tiktok/hashtag/videos",
    headers=H, json={"hashtag": "skincare", "count": 30}).json()
top = sorted(vids["data"]["videos"],
    key=lambda v: v["statistics"]["play_count"], reverse=True)[:10]

Step 3: Search for format patterns, not just one hashtag

Hashtags are noisy. Use search/videos with a niche phrase ("morning skincare routine") to catch high-view videos that did not use your exact tag. Combine both lists and dedupe by video ID for a fuller picture of what is working.

Python
search = requests.post("https://api.scavio.dev/api/v1/tiktok/search/videos",
    headers=H, json={"query": "morning skincare routine", "count": 30}).json()

Step 4: Extract the repeatable pattern, then add your angle

Look across the top videos for the shared structure: the hook in the first two seconds, the format (before/after, list, voiceover), the length. That repeatable structure is your content idea. The API hands you the proven format; you bring the niche-specific angle and voice. Re-run weekly, trends decay fast, and last month's winning hook is this month's noise.

Python Example

Python
import os, requests

H = {"Authorization": f"Bearer {os.environ['SCAVIO_API_KEY']}", "Content-Type": "application/json"}

def content_ideas(hashtag, phrase, n=10):
    vids = requests.post("https://api.scavio.dev/api/v1/tiktok/hashtag/videos",
        headers=H, json={"hashtag": hashtag, "count": 30}).json()["data"]["videos"]
    found = requests.post("https://api.scavio.dev/api/v1/tiktok/search/videos",
        headers=H, json={"query": phrase, "count": 30}).json()["data"]["videos"]
    pool = {v["id"]: v for v in vids + found}.values()
    return sorted(pool, key=lambda v: v["statistics"]["play_count"], reverse=True)[:n]

for v in content_ideas("skincare", "morning skincare routine"):
    print(v["statistics"]["play_count"], v["desc"][:80])

JavaScript Example

JavaScript
const H = { Authorization: `Bearer ${process.env.SCAVIO_API_KEY}`, "Content-Type": "application/json" };

async function contentIdeas(hashtag, phrase, n = 10) {
  const post = (path, body) => fetch(`https://api.scavio.dev/api/v1/tiktok/${path}`,
    { method: "POST", headers: H, body: JSON.stringify(body) }).then(r => r.json());
  const a = (await post("hashtag/videos", { hashtag, count: 30 })).data.videos;
  const b = (await post("search/videos", { query: phrase, count: 30 })).data.videos;
  const pool = [...new Map([...a, ...b].map(v => [v.id, v])).values()];
  return pool.sort((x, y) => y.statistics.play_count - x.statistics.play_count).slice(0, n);
}

Expected Output

JSON
A ranked list of the highest-view videos in your niche, each with its play count and description, so the next post is based on what is already winning instead of a blank-page guess.

Related Tutorials

  • Ground an AI Agent With Real Search Data So It Stops Hallucinating

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

A Scavio API key (50 free credits on signup). Python 3.9+ or Node 18+. A niche and two or three seed hashtags. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best TikTok Hashtag Analytics APIs (2026)

Read more
Use Case

TikTok Video Search for Content Research

Read more
Best Of

Best Search API for Content Research in 2026

Read more
Use Case

YouTube Search API for Video SEO Research

Read more
Glossary

TikTok Hashtag Analytics

Read more
Solution

Migrate from Brave Search API to Scavio for Better Coverage

Read more

Start Building

Stop guessing what to post. Use the TikTok hashtag and video search API to surface what is actually getting views in your niche. Python and JS code.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy