ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Detect TikTok Product Trends for E-Commerce
Tutorial

How to Detect TikTok Product Trends for E-Commerce

Find trending products on TikTok before they peak using the TikTok API. Detect viral products, track engagement velocity, and validate with search data.

Get Free API KeyAPI Docs

TikTok drives massive e-commerce sales. Products that go viral on TikTok sell out on Amazon within days. Detecting these trends early gives you a sourcing advantage. This tutorial builds a TikTok trend detection pipeline using the Scavio TikTok API endpoints. Search for product-related videos, track engagement velocity (views per hour), and cross-reference with Amazon search data to validate commercial viability. TikTok API calls use the Bearer token auth pattern.

Prerequisites

  • Python 3.9+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • Basic understanding of e-commerce product sourcing

Walkthrough

Step 1: Search TikTok for product-related videos

Use the TikTok search videos endpoint to find product-related content. High view counts and recent upload dates indicate trending products.

Python
import os, requests, time
from datetime import datetime

SCAVIO_KEY = os.environ['SCAVIO_API_KEY']
TT_URL = 'https://api.scavio.dev/api/v1/tiktok'
TT_H = {'Authorization': f'Bearer {SCAVIO_KEY}', 'Content-Type': 'application/json'}
SEARCH_URL = 'https://api.scavio.dev/api/v1/search'
SEARCH_H = {'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'}

def search_tiktok_products(query: str, count: int = 20) -> list:
    """Search TikTok for product-related videos."""
    resp = requests.post(f'{TT_URL}/search/videos', headers=TT_H,
        json={'keyword': query, 'count': count, 'cursor': 0})
    videos = resp.json().get('data', {}).get('videos', [])
    results = []
    for v in videos:
        stats = v.get('stats', {})
        author = v.get('author', {})
        results.append({
            'description': v.get('desc', '')[:100],
            'author': author.get('uniqueId', ''),
            'plays': stats.get('playCount', 0),
            'likes': stats.get('diggCount', 0),
            'comments': stats.get('commentCount', 0),
            'shares': stats.get('shareCount', 0),
            'created': v.get('createTime', 0),
            'video_id': v.get('id', ''),
        })
    # Sort by plays descending
    results.sort(key=lambda x: x['plays'], reverse=True)
    return results

videos = search_tiktok_products('TikTok made me buy it')
print(f'Found {len(videos)} product videos')
for v in videos[:5]:
    print(f'  {v["plays"]:>12,} plays | @{v["author"]:15s} | {v["description"][:40]}')

Step 2: Detect trending product categories

Search multiple product-related hashtags and keywords to identify which categories are trending. Compare engagement rates across categories.

Python
def detect_trending_categories(categories: list) -> list:
    """Search TikTok for each product category and rank by engagement."""
    results = []
    for category in categories:
        videos = search_tiktok_products(category, count=10)
        if not videos:
            continue
        total_plays = sum(v['plays'] for v in videos)
        total_likes = sum(v['likes'] for v in videos)
        avg_engagement = total_likes / total_plays if total_plays else 0
        results.append({
            'category': category,
            'videos': len(videos),
            'total_plays': total_plays,
            'total_likes': total_likes,
            'avg_engagement': avg_engagement,
            'top_video': videos[0] if videos else None,
        })
        time.sleep(0.3)
    results.sort(key=lambda x: x['total_plays'], reverse=True)
    return results

categories = [
    'cleaning gadget review',
    'kitchen organization hack',
    'skincare routine product',
    'desk setup accessory',
    'pet gadget review',
]

trending = detect_trending_categories(categories)
print('TikTok Product Trend Detection')
print('=' * 60)
for t in trending:
    print(f"  {t['category']:30s} | {t['total_plays']:>12,} plays | {t['avg_engagement']:.1%} eng")
    if t['top_video']:
        print(f"    Top: {t['top_video']['description'][:50]}")

Step 3: Track hashtag velocity for trend timing

Use the TikTok hashtag endpoint to check how fast a product hashtag is growing. High view counts on the hashtag indicate peak or pre-peak timing.

Python
def check_hashtag_velocity(hashtag: str) -> dict:
    """Check a hashtag's total views and video volume."""
    # Get hashtag info
    resp = requests.post(f'{TT_URL}/hashtag', headers=TT_H,
        json={'hashtag': hashtag})
    hashtag_data = resp.json().get('data', {})
    time.sleep(0.3)
    # Get recent videos under this hashtag
    resp = requests.post(f'{TT_URL}/hashtag/videos', headers=TT_H,
        json={'hashtag': hashtag, 'count': 20, 'cursor': 0})
    videos = resp.json().get('data', {}).get('videos', [])
    recent_plays = sum(v.get('stats', {}).get('playCount', 0) for v in videos)
    return {
        'hashtag': hashtag,
        'total_views': hashtag_data.get('stats', {}).get('videoCount', 0),
        'recent_videos': len(videos),
        'recent_plays': recent_plays,
        'avg_plays_per_video': recent_plays // len(videos) if videos else 0,
    }

hashtags = ['cleaninghack', 'kitchengadget', 'desksetup', 'skincareproduct']
print('Hashtag Velocity Check')
print('-' * 60)
for tag in hashtags:
    data = check_hashtag_velocity(tag)
    print(f'  #{data["hashtag"]:20s} | {data["recent_plays"]:>10,} recent plays | '
          f'{data["avg_plays_per_video"]:>8,} avg/video')
    time.sleep(0.3)

Step 4: Cross-validate with Amazon search data

A product trending on TikTok only matters for e-commerce if people are actually buying it. Cross-reference TikTok trends with Amazon search to validate commercial viability.

Python
def validate_trend_commercially(product: str) -> dict:
    """Cross-validate a TikTok trend with Amazon data."""
    # TikTok data
    tt_videos = search_tiktok_products(product, count=10)
    tt_plays = sum(v['plays'] for v in tt_videos)
    time.sleep(0.3)
    # Amazon data
    resp = requests.post(SEARCH_URL, headers=SEARCH_H,
        json={'query': f'site:amazon.com {product}',
              'country_code': 'us', 'num_results': 5})
    amazon_results = resp.json().get('organic_results', [])
    # Scoring
    tiktok_score = min(tt_plays / 100000, 10)  # Normalize to 0-10
    amazon_score = len(amazon_results) * 2  # 0-10
    combined = (tiktok_score + amazon_score) / 2
    return {
        'product': product,
        'tiktok_videos': len(tt_videos),
        'tiktok_plays': tt_plays,
        'amazon_listings': len(amazon_results),
        'tiktok_score': round(tiktok_score, 1),
        'amazon_score': round(amazon_score, 1),
        'combined_score': round(combined, 1),
        'verdict': 'HOT' if combined > 6 else 'WARM' if combined > 3 else 'COLD',
        'cost': 0.010,  # 1 TikTok + 1 Amazon search
    }

products = ['LED sunset lamp', 'portable blender', 'cloud slides shoes']
print('\nTrend Validation Report')
print('=' * 65)
for p in products:
    result = validate_trend_commercially(p)
    print(f"[{result['verdict']:4s}] {result['product']:25s} | "
          f"TT: {result['tiktok_score']}/10 AMZ: {result['amazon_score']}/10 | "
          f"Combined: {result['combined_score']}/10")
    time.sleep(0.5)
total_cost = len(products) * 0.010
print(f'\nTotal cost: ${total_cost:.3f}')

Python Example

Python
import os, requests, time

SCAVIO_KEY = os.environ['SCAVIO_API_KEY']
TT_H = {'Authorization': f'Bearer {SCAVIO_KEY}', 'Content-Type': 'application/json'}
S_H = {'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'}

def detect_trend(product):
    # TikTok search
    resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos', headers=TT_H,
        json={'keyword': product, 'count': 10, 'cursor': 0})
    videos = resp.json().get('data', {}).get('videos', [])
    plays = sum(v.get('stats', {}).get('playCount', 0) for v in videos)
    time.sleep(0.3)
    # Amazon cross-check
    resp2 = requests.post('https://api.scavio.dev/api/v1/search', headers=S_H,
        json={'query': f'site:amazon.com {product}', 'country_code': 'us', 'num_results': 5})
    amazon = len(resp2.json().get('organic_results', []))
    verdict = 'HOT' if plays > 500000 and amazon >= 3 else 'WARM' if plays > 100000 else 'COLD'
    print(f'[{verdict}] {product}: {plays:,} TT plays, {amazon} AMZ listings')

for p in ['LED sunset lamp', 'portable blender', 'cloud slides']:
    detect_trend(p)
    time.sleep(0.3)

JavaScript Example

JavaScript
const SCAVIO_KEY = process.env.SCAVIO_API_KEY;

async function detectTrend(product) {
  const tt = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
    method: 'POST',
    headers: { Authorization: `Bearer ${SCAVIO_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ keyword: product, count: 10, cursor: 0 })
  }).then(r => r.json());
  const plays = (tt.data?.videos || []).reduce((s, v) => s + (v.stats?.playCount || 0), 0);
  const amz = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query: `site:amazon.com ${product}`, country_code: 'us', num_results: 5 })
  }).then(r => r.json());
  const listings = (amz.organic_results || []).length;
  const verdict = plays > 500000 && listings >= 3 ? 'HOT' : plays > 100000 ? 'WARM' : 'COLD';
  console.log(`[${verdict}] ${product}: ${plays.toLocaleString()} TT plays, ${listings} AMZ listings`);
}

(async () => { for (const p of ['LED sunset lamp', 'portable blender']) await detectTrend(p); })();

Expected Output

JSON
Found 20 product videos
  1,234,567 plays | @cleanqueen       | This cleaning gadget changed my life
    892,345 plays | @organizewithme   | Kitchen organization haul from Amazon

TikTok Product Trend Detection
============================================================
  skincare routine product        |   4,523,000 plays | 8.2% eng
  cleaning gadget review          |   3,891,000 plays | 6.5% eng
  kitchen organization hack       |   2,156,000 plays | 7.1% eng

Trend Validation Report
=================================================================
[HOT ] LED sunset lamp             | TT: 7.2/10 AMZ: 8.0/10 | Combined: 7.6/10
[WARM] portable blender            | TT: 4.5/10 AMZ: 6.0/10 | Combined: 5.3/10
[HOT ] cloud slides shoes          | TT: 8.1/10 AMZ: 10.0/10 | Combined: 9.1/10

Total cost: $0.030

Related Tutorials

  • How to Vet TikTok Creators for Brand Partnerships
  • How to Track a TikTok Hashtag Campaign via API
  • How to Validate Amazon Product Profitability with Live Search Data
  • How to Build a Trend Detection Agent Using YouTube and Google

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.

Python 3.9+ installed. requests library installed. A Scavio API key from scavio.dev. Basic understanding of e-commerce product sourcing. 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

Use Case

TikTok Product Trend Detection for E-commerce

Read more
Best Of

Best TikTok Product Trend Detection Tools (May 2026)

Read more
Use Case

Dropship Product Research via API

Read more
Solution

Detect Trending Products on TikTok Before They Peak

Read more
Solution

Detect Trending TikTok Products Before They Go Viral

Read more
Best Of

Best TikTok Product Research API in 2026

Read more

Start Building

Find trending products on TikTok before they peak using the TikTok API. Detect viral products, track engagement velocity, and validate with search data.

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