Guide

TikTok hashtag analytics with Python

Hashtag view counts tell you two things at once: how big a topic already is, and whether it is still growing. This walks through pulling both — the cross-platform top hashtags for a window, and the full performance history for one specific hashtag — with three API calls.

What you get back

GET /v1/hashtags returns usage counts and total views for any hashtag over a date range (max 90 days per request), sorted however you like. GET /v1/hashtags/:hashtag/performance drills into one hashtag's video count, total views, and average views per video for that window. Pass the hashtag without the #.

The cross-platform performance endpoint aggregates TikTok, Instagram, and YouTube together. If you need TikTok on its own, GET /v1/tiktok/hashtags takes the identical parameters and returns TikTok-only results — same shape, same pricing.

The code

import requests
from datetime import date, timedelta

headers = {'Authorization': 'Bearer YOUR_API_KEY'}
end = date.today().isoformat()
start = (date.today() - timedelta(days=30)).isoformat()

# Top hashtags by views ($0.05)
hashtags = requests.get(
    'https://api.virlo.ai/v1/hashtags',
    headers=headers,
    params={'start_date': start, 'end_date': end, 'limit': 20, 'order_by': 'views', 'sort': 'desc'}
).json()['data']

# Drill into a specific hashtag ($0.05)
perf = requests.get(
    f'https://api.virlo.ai/v1/hashtags/fyp/performance',
    headers=headers,
    params={'start_date': start, 'end_date': end}
).json()['data']

print(f"#fyp: {perf['video_count']} videos, {perf['total_views']:,} views, avg {perf['avg_views']:,.0f} views/video")

# TikTok-only hashtags ($0.05 each)
tiktok = requests.get(
    'https://api.virlo.ai/v1/tiktok/hashtags',
    headers=headers,
    params={'start_date': start, 'end_date': end, 'limit': 10, 'order_by': 'views', 'sort': 'desc'}
).json()['data']

Cost

Each of the three calls above is $0.05, billed from your prepaid balance — $0.15 total for this walkthrough. There is no subscription; add funds once and auto top-up keeps a key running.

Full reference

For every parameter, error case, and the platform-specific paths for Instagram and YouTube, see the Hashtags API reference and TikTok Hashtags reference. This same call sequence is also documented as the Hashtag Research recipe.