ScavioScavio
Pricing
Tools
Sign InsGet Startedg
  1. Home
  2. Tutorials
  3. How to Search TikTok Videos by Keyword via API
Tutorial

How to Search TikTok Videos by Keyword via API

Search TikTok videos by keyword programmatically. Python and JavaScript examples using Scavio API with cursor-based pagination. 2 steps, with code you can copy.

Get Free API KeyAPI Docs

Search TikTok videos by keyword via Scavio API at $0.005/request. The search/videos endpoint returns video metadata with engagement stats, creator info, and pagination support for deep result sets.

Prerequisites

  • Scavio API key
  • Python 3.8+ or Node.js 18+
  • Target keyword or phrase

Walkthrough

Step 1: Run a video search

Search TikTok videos by keyword using the search/videos endpoint.

Python
import requests, os

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

resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
    headers=HEADERS,
    json={'keyword': 'productivity tools', 'count': 20, 'cursor': 0})

data = resp.json()['data']
for v in data.get('videos', []):
    print(f"{v['desc'][:50]} | {v['stats']['playCount']:,} plays")

Step 2: Paginate through results

Use cursor from the response for next page.

Python
if data.get('has_more'):
    page2 = requests.post(
        'https://api.scavio.dev/api/v1/tiktok/search/videos',
        headers=HEADERS,
        json={'keyword': 'productivity tools', 'count': 20,
              'cursor': data['cursor']}).json()['data']
    print(f'Page 2: {len(page2.get("videos", []))} results')

Python Example

Python
import requests, os

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

def search_videos(keyword, max_pages=3):
    videos = []
    cursor = 0
    for _ in range(max_pages):
        resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
            headers=HEADERS,
            json={'keyword': keyword, 'count': 20, 'cursor': cursor}).json()['data']
        videos.extend(resp.get('videos', []))
        if not resp.get('has_more'):
            break
        cursor = resp['cursor']
    return videos

results = search_videos('saas tools')
for v in results[:5]:
    print(f"{v['desc'][:40]} - {v['stats']['playCount']:,} plays")

JavaScript Example

JavaScript
const H = {'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json'};
async function searchVideos(keyword, maxPages = 3) {
  const videos = [];
  let cursor = 0;
  for (let i = 0; i < maxPages; i++) {
    const r = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
      method: 'POST', headers: H,
      body: JSON.stringify({keyword, count: 20, cursor})
    }).then(r => r.json());
    videos.push(...(r.data.videos || []));
    if (!r.data.has_more) break;
    cursor = r.data.cursor;
  }
  return videos;
}
searchVideos('saas tools').then(v => console.log(`${v.length} videos found`));

Expected Output

JSON
Array of TikTok videos matching the keyword with engagement metrics, creator info, and video metadata. Paginated with cursor.

Related Tutorials

    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. Python 3.8+ or Node.js 18+. Target keyword or phrase. 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
    Best Of

    Best TikTok Product Research API in 2026

    Read more
    Glossary

    TikTok Unofficial API

    Read more
    Glossary

    TikTok Engagement API Metrics

    Read more
    Comparison

    Brave Search API vs Scavio

    Read more
    Comparison

    Brave Search API vs Scavio

    Read more

    Start Building

    Search TikTok videos by keyword programmatically. Python and JavaScript examples using Scavio API with cursor-based pagination. 2 steps, with code you can copy.

    Get Free API KeyRead the Docs
    ScavioScavio

    One scraper API for every social, search, e-commerce and real estate platform. Built for AI agents.

    Product

    • Features
    • Pricing
    • Dashboard
    • Affiliates

    Developers

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

    Alternatives

    • Tavily Alternative
    • SerpAPI Alternative
    • Firecrawl Alternative
    • Exa Alternative
    • Serper Alternative
    • Tavily vs Scavio
    • SerpAPI vs Scavio
    • All alternatives
    • Compare Scavio vs alternatives

    Search APIs

    • Google Search API
    • Amazon Product API
    • YouTube API
    • Reddit API
    • Walmart Product API
    • TikTok API
    • Instagram API

    Tools

    • All Tools

    © 2026 Scavio. All rights reserved.

    Featured on TAAFT
    Terms of ServicePrivacy Policy