tiktoksocial-graphapi

TikTok Social Graph: Mapping Followers and Followings via API

Map TikTok creator networks through follower and following endpoints. Measure audience overlap, find connector accounts, and discover niche communities.

6 min read

Scavio exposes TikTok follower and following lists via two paginated endpoints at 1 credit per page. Map creator networks, find audience overlap between influencers, and identify micro-influencer clusters without scraping.

Pagination Model

TikTok follower/following endpoints use a token-based pagination system different from the cursor-based pagination used by other TikTok endpoints. Each response returns a next_page_token and a min_time value. Pass both to the next request. Stop when has_more is false.

Exporting Followers

Python
import requests, os

API_KEY = os.environ["SCAVIO_API_KEY"]
BASE = "https://api.scavio.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}",
           "Content-Type": "application/json"}

def get_followers(sec_user_id, max_pages=10):
    all_followers = []
    params = {"sec_user_id": sec_user_id, "count": 20}
    for _ in range(max_pages):
        resp = requests.post(f"{BASE}/api/v1/tiktok/user/followers",
            headers=HEADERS, json=params)
        data = resp.json()["data"]
        for f in data.get("followers", []):
            all_followers.append({
                "username": f["unique_id"],
                "nickname": f["nickname"],
                "followers": f["follower_count"],
                "videos": f["aweme_count"],
                "sec_uid": f["sec_uid"],
            })
        if not data.get("has_more"):
            break
        params["page_token"] = data["next_page_token"]
        params["min_time"] = data["min_time"]
    return all_followers

Finding High-Value Followers

Python
def find_influencer_followers(username, min_followers=10000):
    # First get the sec_user_id
    resp = requests.post(f"{BASE}/api/v1/tiktok/profile",
        headers=HEADERS, json={"username": username})
    sec_uid = resp.json()["data"]["user"]["sec_uid"]

    followers = get_followers(sec_uid, max_pages=20)
    influencers = [f for f in followers if f["followers"] >= min_followers]
    influencers.sort(key=lambda x: x["followers"], reverse=True)
    return influencers

# Find influencers who follow a competitor
big_followers = find_influencer_followers("competitor_brand", min_followers=50000)
for f in big_followers[:10]:
    print(f"@{f['username']} ({f['followers']:,} followers)")

Audience Overlap Analysis

Python
def audience_overlap(username_a, username_b, pages=20):
    # Get followers for both creators
    profile_a = requests.post(f"{BASE}/api/v1/tiktok/profile",
        headers=HEADERS, json={"username": username_a}).json()
    profile_b = requests.post(f"{BASE}/api/v1/tiktok/profile",
        headers=HEADERS, json={"username": username_b}).json()

    followers_a = get_followers(profile_a["data"]["user"]["sec_uid"], pages)
    followers_b = get_followers(profile_b["data"]["user"]["sec_uid"], pages)

    set_a = {f["username"] for f in followers_a}
    set_b = {f["username"] for f in followers_b}

    overlap = set_a & set_b
    return {
        "creator_a": username_a,
        "creator_b": username_b,
        "sampled_a": len(set_a),
        "sampled_b": len(set_b),
        "overlap_count": len(overlap),
        "overlap_pct": len(overlap) / min(len(set_a), len(set_b)) * 100
            if min(len(set_a), len(set_b)) > 0 else 0,
    }

Followings: What Creators Watch

Python
def get_followings(sec_user_id, max_pages=5):
    all_followings = []
    params = {"sec_user_id": sec_user_id, "count": 20}
    for _ in range(max_pages):
        resp = requests.post(f"{BASE}/api/v1/tiktok/user/followings",
            headers=HEADERS, json=params)
        data = resp.json()["data"]
        for f in data.get("followings", []):
            all_followings.append({
                "username": f["unique_id"],
                "followers": f["follower_count"],
            })
        if not data.get("has_more"):
            break
        params["page_token"] = data["next_page_token"]
        params["min_time"] = data["min_time"]
    return all_followings

Cost and Limits

Each page of 20 followers costs 1 credit ($0.005). Exporting 1,000 followers costs $0.25. Audience overlap for two creators with 1,000 sampled followers each costs roughly $0.52 (profile lookups + follower pages). TikTok does not expose full follower lists for very large accounts; the API returns what TikTok allows, which is typically the most recent followers.