ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Get TikTok Hashtag Videos via API
Tutorial

How to Get TikTok Hashtag Videos via API

Fetch videos from any TikTok hashtag with engagement data. Python and JavaScript examples using Scavio hashtag endpoints.

Get Free API KeyAPI Docs

Fetch videos from any TikTok hashtag via Scavio API at $0.005/request. Two-step process: get hashtag info (including challenge_id), then fetch videos for that hashtag with full engagement metrics.

Prerequisites

  • Scavio API key
  • Target hashtag name
  • Python 3.8+ or Node.js 18+

Walkthrough

Step 1: Get hashtag info

Look up hashtag metadata including challenge_id and view count.

Python
import requests, os

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

info = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag',
    headers=HEADERS, json={'hashtag': 'smallbusiness'}).json()['data']

print(f"Views: {info['stats']['view_count']:,}")
print(f"Videos: {info['stats']['video_count']:,}")
challenge_id = info['challenge_id']

Step 2: Fetch videos for the hashtag

Use the challenge_id to get videos posted under this hashtag.

Python
videos = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
    headers=HEADERS,
    json={'challenge_id': challenge_id, 'count': 20, 'cursor': 0}).json()['data']

for v in videos.get('videos', []):
    print(f"{v['desc'][:40]} | {v['stats']['playCount']:,} plays")

Python Example

Python
import requests, os

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

def hashtag_research(hashtag, video_pages=3):
    info = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag',
        headers=HEADERS, json={'hashtag': hashtag}).json()['data']
    challenge_id = info['challenge_id']
    videos = []
    cursor = 0
    for _ in range(video_pages):
        resp = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
            headers=HEADERS,
            json={'challenge_id': challenge_id, 'count': 20, 'cursor': cursor}).json()['data']
        videos.extend(resp.get('videos', []))
        if not resp.get('has_more'):
            break
        cursor = resp['cursor']
    return {'views': info['stats']['view_count'],
            'video_count': info['stats']['video_count'],
            'sample_videos': len(videos), 'videos': videos}

result = hashtag_research('smallbusiness')
print(f"{result['views']:,} views, {result['sample_videos']} videos sampled")

JavaScript Example

JavaScript
const H = {'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json'};
async function hashtagResearch(hashtag) {
  const info = await fetch('https://api.scavio.dev/api/v1/tiktok/hashtag', {
    method: 'POST', headers: H, body: JSON.stringify({hashtag})
  }).then(r => r.json());
  const cid = info.data.challenge_id;
  const vids = await fetch('https://api.scavio.dev/api/v1/tiktok/hashtag/videos', {
    method: 'POST', headers: H,
    body: JSON.stringify({challenge_id: cid, count: 20, cursor: 0})
  }).then(r => r.json());
  console.log(`${info.data.stats.view_count} views, ${(vids.data.videos||[]).length} sample videos`);
}
hashtagResearch('smallbusiness');

Expected Output

JSON
Hashtag metadata (total views, video count) plus sample videos with engagement metrics for content research.

Related Tutorials

  • How to Search TikTok Videos by Keyword via API
  • How to Track TikTok Hashtag Trends via API

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.

Scavio API key. Target hashtag name. Python 3.8+ or Node.js 18+. 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 Content Optimization via API Data

Read more
Use Case

TikTok UGC Campaign Tracking

Read more
Best Of

Best TikTok Data APIs Without Authentication in 2026

Read more
Glossary

TikTok Hashtag Analytics

Read more
Glossary

TikTok Unofficial API

Read more

Start Building

Fetch videos from any TikTok hashtag with engagement data. Python and JavaScript examples using Scavio hashtag endpoints.

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