ScavioScavio
ToolsPricing
Sign InsGet Startedg
  1. Home
  2. Tutorials
  3. How to Build a TikTok Influencer Vetting Workflow
Tutorial

How to Build a TikTok Influencer Vetting Workflow

Automate TikTok influencer vetting: username to profile (get sec_uid), then posts and followers for engagement rate and audience quality scoring.

Get Free API KeyAPI Docs

TikTok influencer vetting via API follows a two-step flow: get the creator's sec_uid from their profile, then use that sec_uid to fetch posts for engagement rate and follower sample for audience quality scoring.

Prerequisites

  • Python 3.9+
  • Scavio API key with TikTok access

Walkthrough

Step 1: Step 1: Get sec_uid from username

The profile endpoint takes a username and returns the sec_uid needed for all subsequent requests.

Python
import requests

API_KEY = "your-scavio-api-key"

def get_profile(username: str) -> dict:
    r = requests.post(
        "https://api.scavio.dev/api/v1/tiktok/profile",
        json={"username": username},
        headers={"Authorization": f"Bearer {API_KEY}"},
        timeout=15
    )
    r.raise_for_status()
    return r.json()

profile = get_profile("someinfluencer")
sec_uid = profile.get("sec_uid")
follower_count = profile.get("follower_count")
print(f"sec_uid: {sec_uid}, followers: {follower_count:,}")

Step 2: Step 2: Fetch recent posts using sec_uid

Use sec_uid and max_cursor pagination to get the creator's recent videos.

Python
def get_posts(sec_uid: str, count: int = 30) -> list:
    all_posts = []
    max_cursor = 0
    while len(all_posts) < count:
        r = requests.post(
            "https://api.scavio.dev/api/v1/tiktok/user/posts",
            json={"sec_uid": sec_uid, "count": min(30, count - len(all_posts)), "max_cursor": max_cursor},
            headers={"Authorization": f"Bearer {API_KEY}"},
            timeout=20
        )
        r.raise_for_status()
        data = r.json()
        posts = data.get("videos", [])
        if not posts:
            break
        all_posts.extend(posts)
        if not data.get("has_more"):
            break
        max_cursor = data.get("max_cursor", 0)
    return all_posts[:count]

Step 3: Calculate engagement rate

Engagement rate = (likes + comments + shares) / views, averaged across recent posts.

Python
def calc_engagement_rate(posts: list) -> float:
    if not posts:
        return 0.0
    rates = []
    for p in posts:
        stats = p.get("stats", {})
        views = stats.get("playCount", 0)
        if views == 0:
            continue
        interactions = (
            stats.get("diggCount", 0) +
            stats.get("commentCount", 0) +
            stats.get("shareCount", 0)
        )
        rates.append(interactions / views)
    return round(sum(rates) / len(rates) * 100, 2) if rates else 0.0

Step 4: Generate a vetting score

Combine follower count, engagement rate, and posting frequency into a score.

Python
from datetime import date

def vet_influencer(username: str) -> dict:
    profile = get_profile(username)
    sec_uid = profile.get("sec_uid")
    if not sec_uid:
        return {"username": username, "error": "Profile not found"}

    posts = get_posts(sec_uid, count=30)
    eng_rate = calc_engagement_rate(posts)
    followers = profile.get("follower_count", 0)

    # Simple scoring: engagement rate is the main signal
    if eng_rate >= 5:
        tier = "A"
    elif eng_rate >= 2:
        tier = "B"
    elif eng_rate >= 0.5:
        tier = "C"
    else:
        tier = "D"

    return {
        "username": username,
        "followers": followers,
        "engagement_rate_pct": eng_rate,
        "posts_analyzed": len(posts),
        "tier": tier,
        "vetted_date": str(date.today())
    }

result = vet_influencer("someinfluencer")
print(result)

Python Example

Python
import requests
from datetime import date

API_KEY = "your-scavio-api-key"

def get_profile(username):
    r = requests.post("https://api.scavio.dev/api/v1/tiktok/profile",
                      json={"username": username},
                      headers={"Authorization": f"Bearer {API_KEY}"}, timeout=15)
    r.raise_for_status()
    return r.json()

def get_posts(sec_uid, count=30):
    posts, cursor = [], 0
    while len(posts) < count:
        r = requests.post("https://api.scavio.dev/api/v1/tiktok/user/posts",
                          json={"sec_uid": sec_uid, "count": min(30, count - len(posts)), "max_cursor": cursor},
                          headers={"Authorization": f"Bearer {API_KEY}"}, timeout=20)
        r.raise_for_status()
        data = r.json()
        batch = data.get("videos", [])
        if not batch: break
        posts.extend(batch)
        if not data.get("has_more"): break
        cursor = data.get("max_cursor", 0)
    return posts[:count]

def engagement_rate(posts):
    rates = []
    for p in posts:
        s = p.get("stats", {})
        v = s.get("playCount", 0)
        if v: rates.append((s.get("diggCount",0) + s.get("commentCount",0) + s.get("shareCount",0)) / v)
    return round(sum(rates)/len(rates)*100, 2) if rates else 0.0

def vet(username):
    profile = get_profile(username)
    sec_uid = profile.get("sec_uid")
    if not sec_uid: return {"username": username, "error": "not found"}
    posts = get_posts(sec_uid, 30)
    er = engagement_rate(posts)
    tier = "A" if er >= 5 else "B" if er >= 2 else "C" if er >= 0.5 else "D"
    return {"username": username, "followers": profile.get("follower_count",0),
            "engagement_rate_pct": er, "posts_analyzed": len(posts), "tier": tier,
            "vetted_date": str(date.today())}

if __name__ == "__main__":
    for creator in ["creator1", "creator2", "creator3"]:
        result = vet(creator)
        print(f"@{result['username']}: {result.get('followers',0):,} followers | {result.get('engagement_rate_pct')}% engagement | Tier {result.get('tier')}")

JavaScript Example

JavaScript
const API_KEY = 'your-scavio-api-key';

async function getProfile(username) {
  const res = await fetch('https://api.scavio.dev/api/v1/tiktok/profile', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` },
    body: JSON.stringify({ username })
  });
  return res.json();
}

async function getPosts(secUid, count = 30) {
  const res = await fetch('https://api.scavio.dev/api/v1/tiktok/user/posts', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}` },
    body: JSON.stringify({ sec_uid: secUid, count, max_cursor: 0 })
  });
  const data = await res.json();
  return data.videos ?? [];
}

const profile = await getProfile('someinfluencer');
const posts = await getPosts(profile.sec_uid);
const er = posts.reduce((acc, p) => {
  const s = p.stats ?? {};
  return s.playCount ? acc + (s.diggCount + s.commentCount + s.shareCount) / s.playCount : acc;
}, 0) / posts.length * 100;
console.log(`@${profile.unique_id}: ${er.toFixed(2)}% engagement`);

Expected Output

JSON
@creator1: 248,000 followers | 6.8% engagement | Tier A
@creator2: 891,000 followers | 1.4% engagement | Tier C
@creator3: 42,000 followers | 8.2% engagement | Tier A

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.

    Python 3.9+. Scavio API key with TikTok access. 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 Influencer Vetting APIs (2026)

    Read more
    Glossary

    TikTok Creator Vetting API Pattern

    Read more
    Best Of

    Best TikTok Influencer Vetting Tools in 2026

    Read more
    Solution

    Automate TikTok Creator Vetting for Brand Partnerships

    Read more
    Workflow

    TikTok Influencer Vetting Daily

    Read more
    Glossary

    TikTok sec_uid

    Read more

    Start Building

    Automate TikTok influencer vetting: username to profile (get sec_uid), then posts and followers for engagement rate and audience quality scoring.

    Get Free API KeyRead the Docs
    ScavioScavio

    One scraper API for every social, search and ecommerce 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