ScavioScavio
ProductPricingDocs
Sign InGet Started
  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.

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

  • How to Search TikTok Users by Keyword via API
  • How to Get TikTok Hashtag Videos 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. 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 Video Search APIs in 2026

Read more
Use Case

TikTok Video Search for Content Research

Read more
Best Of

Best Budget Search APIs for AI Agents Under $10/mo (2026)

Read more
Use Case

YouTube Search API for Video SEO Research

Read more
Glossary

Exa Semantic Search

Read more
Solution

Migrate from Brave Search API to Scavio for Better Coverage

Read more

Start Building

Search TikTok videos by keyword programmatically. Python and JavaScript examples using Scavio API with cursor-based pagination.

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