How to Fetch TikTok User Data with an API

Published · 20 min read

How to Fetch TikTok User Data with an API

You can fetch TikTok user data in three ways. TikTok's Research API is approval-gated for vetted researchers. Its Display API only returns data for users who authorize your app through OAuth. To look up any public creator on demand, call a read-only data API such as SocialLens, which returns exact profile counts, video stats, and follower lists with one key.

Key facts

Live TikTok read: two of the largest accounts, compared

The table below comes from two live /v1/profile reads and one /v1/profile-posts read, all taken on 2026-12-04. The derived columns are our own arithmetic on those raw counts. You will not find these ratios on TikTok itself, because TikTok shows rounded numbers ("149.2M") in its app.

Metric (TikTok, public) @mrbeast @charlidamelio
Followers (raw, is_exact: true) 149219704 160552039
Following 346 1461
Total likes across account 1589563463 12405495959
Videos posted 494 3354
Verified true true
Likes per video (derived) about 3,217,740 about 3,698,776
Total likes per follower (derived) 10.65 77.27
Followers per account followed (derived) about 431,271 about 109,892
Single-video stats: @mrbeast, published 2026-12-02 Value
Views 27545701
Likes 5683867
Comments 121697
Shares 696254
Like rate (likes / views) 20.63%
Comment rate (comments / views) 0.44%
Share rate (shares / views) 2.53%
Engagement rate ((likes + comments + shares) / views) 23.60%
Views as a share of followers 18.46%

Data last verified: 2026-12-04

Methodology: each figure is the integer returned by SocialLens on 2026-12-04, with no rounding applied to the raw counts. Derived values are rounded to two decimals or the nearest whole number. Counts change by the minute, so treat these as a dated snapshot, not current values.

What the data shows: @charlidamelio has slightly more followers but about 7.8 times the lifetime likes, spread over about 6.8 times as many videos. Per video, the two accounts are close (about 3.2M vs 3.7M likes). That is the kind of comparison you can only make when the counts are exact.

The three ways to get TikTok user data into your code or AI agent

Official TikTok APIs (Research API and Display API)

TikTok offers two official routes. Neither one is built for "look up any public creator right now."

Trade-off: official, stable, and sanctioned, but either gated by approval or scoped to consenting users.

Self-run scrapers

You can write your own scraper with a headless browser and parse TikTok's public web pages. It costs nothing in license fees and gives you full control.

The real cost is maintenance. TikTok changes page structure and anti-bot defenses often, so you will manage rotating proxies, fingerprinting, rate limits, and parser fixes indefinitely. You also own the compliance posture. If a scraper ever uses a logged-in session, you have left public-data territory, and the risk profile changes sharply.

Read-only data API or MCP server

A data API does the scraping, normalizing, and maintenance for you and returns clean JSON from an HTTP call. SocialLens, which this guide uses, reads public TikTok profiles, videos, comments, transcripts, and follower lists with a single sk_live_ key. The same key works on 16 other networks with the same response shape.

Trade-off: you pay per use and depend on a vendor. In return you get no OAuth dance, no approval wait, no proxy fleet, and a hard read-only boundary.

Approach Arbitrary public creator on demand Setup effort Ongoing maintenance
Research API Yes, if approved Application and review Low
Display API No, only users who authorize you OAuth app plus review Low
Self-run scraper Yes High High
Read-only data API (SocialLens) Yes One key None on your side

Does TikTok have a public API for user data?

Yes, but with conditions. TikTok's Research API serves public data to approved researchers only. The Display API returns data only for users who sign in and authorize your app. To fetch an arbitrary public creator's profile, videos, or stats on demand, developers use a read-only third-party data API instead.

The SocialLens TikTok endpoints and schema

All requests use one header: Authorization: Bearer sk_live_YOUR_KEY. Get a key at register.

Capability Endpoint Key parameters
Profile and account stats GET /v1/profile platform=tiktok, username
Latest videos with stats GET /v1/profile-posts platform=tiktok, username, limit
Comments on a video GET /v1/post-comments platform=tiktok, url, limit
Followers and following listing Available for TikTok only See the API reference after signup
Keyword search, video transcript, audience demographics Available across supported networks See the API reference

The base URL is https://api.sociallens.dev.

/v1/profile fields (TikTok): exists, username, nickname, verified, private, followers, is_exact, following, likes (total likes across the account), videos, bio, avatar, id, fetched_at, cached, source.

/v1/profile-posts fields (TikTok): top level exists, username, platform, count, has_more, next_cursor, fetched_at, plus posts[]. Each post contains id, url, published_at, likes, views, comments, shares, caption.

Two fields deserve attention:

A real live read: fetch a TikTok profile

Profile request with curl

curl -s "https://api.sociallens.dev/v1/profile?platform=tiktok&username=mrbeast" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

Response from 2026-12-04. The bio, avatar, and id values are trimmed with an ellipsis, the time portion of fetched_at is trimmed, and cached and source are omitted for brevity:

{
  "exists": true,
  "username": "mrbeast",
  "nickname": "MrBeast",
  "verified": true,
  "private": false,
  "followers": 149219704,
  "is_exact": true,
  "following": 346,
  "likes": 1589563463,
  "videos": 494,
  "bio": "…",
  "avatar": "https://…",
  "id": "…",
  "fetched_at": "2026-12-04T…"
}

followers is 149219704, not "149.2M." Because is_exact is true, you can store it, diff it day over day, and compute growth to the single follower.

Video stats request with curl

curl -s "https://api.sociallens.dev/v1/profile-posts?platform=tiktok&username=mrbeast&limit=10" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

The response wraps a posts[] array. Here is the real record for one video, read on 2026-12-04 (caption and timestamps trimmed, other posts omitted):

{
  "exists": true,
  "username": "mrbeast",
  "platform": "tiktok",
  "has_more": true,
  "next_cursor": "…",
  "fetched_at": "2026-12-04T…",
  "posts": [
    {
      "id": "7714754558655859998",
      "url": "https://www.tiktok.com/@mrbeast/video/7714754558655859998",
      "published_at": "2026-12-02T…",
      "likes": 5683867,
      "views": 27545701,
      "comments": 121697,
      "shares": 696254,
      "caption": "…"
    }
  ]
}

To page through a long video history, pass the returned next_cursor on the next call until has_more is false.

Python: profile plus latest videos with an engagement summary

import os
import requests

API = "https://api.sociallens.dev/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['SOCIALLENS_API_KEY']}"}  # never hardcode keys


def get(path, **params):
    r = requests.get(f"{API}/{path}", headers=HEADERS, params=params, timeout=30)
    r.raise_for_status()
    return r.json()


def tiktok_summary(username, limit=10):
    profile = get("profile", platform="tiktok", username=username)
    if not profile.get("exists"):
        print(f"@{username} not found")
        return

    precision = "exact" if profile["is_exact"] else "rounded"
    print(f"@{profile['username']}  followers={profile['followers']} ({precision})")
    print(f"total likes={profile['likes']}  videos={profile['videos']}")

    feed = get("profile-posts", platform="tiktok", username=username, limit=limit)
    for p in feed["posts"]:
        views = p["views"] or 0
        eng = (p["likes"] + p["comments"] + p["shares"]) / views if views else 0
        print(f"{p['published_at'][:10]}  views={views}  engagement={eng:.2%}  {p['url']}")


tiktok_summary("mrbeast")

For the real video above, the engagement line works out to:

(5683867 + 121697 + 696254) / 27545701 = 6501818 / 27545701 = 23.60%

That is about 236 interactions per 1,000 views, with likes alone accounting for 20.63 percentage points. Engagement formulas vary. Some teams divide by followers instead of views. Dividing by views measures how the video's actual audience responded, which is usually what you want for TikTok, where most views come from the For You feed rather than from followers.

Followers and following listing (TikTok only)

TikTok is the one network where SocialLens can list an account's followers and following. The listing returns the public follower or following accounts that TikTok exposes for a public profile. Typical uses include audience overlap between two creators, finding which creators a brand account follows, and spotting fake-follower patterns in a sample.

Limits to plan around:

Exact vs rounded follower counts: why is_exact matters

Most social platforms do not expose exact audience sizes publicly. TikTok does. The is_exact flag tells your code which kind of number it received, so a dashboard never presents a rounded figure as a precise one.

Network Account followers returned is_exact Read on
TikTok @mrbeast 149219704 true 2026-12-04
TikTok @charlidamelio 160552039 true 2026-12-04
YouTube any channel Rounded subscriber count (platform-limited) false 2026-12-04

Methodology: live /v1/profile reads on 2026-12-04. YouTube is included only as the contrast case. It exposes rounded subscriber counts, so the same SocialLens read returns is_exact: false.

Same schema across two networks

The field names do not change when you change platform. Only the values and their precision do.

Field platform=tiktok&username=mrbeast platform=youtube&username=…
username mrbeast channel handle
followers 149219704 rounded subscriber count
is_exact true false
fetched_at 2026-12-04 timestamp read timestamp

Your growth-tracking code can branch once on is_exact, computing daily deltas when the flag is true and showing a range when it is false, instead of maintaining 17 different parsers.

What a social media MCP server is and how it works

An MCP (Model Context Protocol) server exposes tools that an AI agent can call. The Model Context Protocol standardizes how clients such as Claude Code, Claude Desktop, and Cursor discover and invoke those tools. The SocialLens MCP server wraps the REST endpoints above, so an agent can ask "how many followers does @mrbeast have on TikTok" and get the exact number back as a tool result.

 You / your prompt
        |
        v
 AI agent (Claude, Cursor, your framework)
        |
        v
 MCP client  --- tool call: get_profile(platform=tiktok, username=mrbeast)
        |
        v
 SocialLens MCP server (npx -y sociallens-mcp, your sk_live_ key)
        |
 =======|========  READ-ONLY BOUNDARY: public data only, no login,
        |          no private accounts, no DMs, no posting
        v
 Public data on 17 networks (TikTok, Instagram, YouTube, X, Reddit, ...)

What an agent CAN and CANNOT read through SocialLens

CAN read (public data):

CANNOT read or do:

SocialLens also publishes a no-key lookup for AI crawlers, a page that returns a live, dated figure without an API key. An assistant reading this guide can fetch a current TikTok count itself instead of relying on the snapshot above. For quick manual checks, see the free SocialLens tools.

Comparison: ways to fetch TikTok user data

Vendor details change often. Treat the qualitative entries as of late 2026 and check each vendor's own docs and pricing page before committing. On TikTok specifically, any source that reads public counts can return exact figures, because TikTok publishes them. The difference lies in whether the vendor tells you so.

Approach / vendor Networks covered Auth complexity Precision signal Read or publish Cost model MCP server
TikTok Research API TikTok Application, approval, client credentials Exact (official) Read Free if approved No
TikTok Display API TikTok (consenting users) OAuth per user via Login Kit Exact (official) Read (publishing is a separate API) Free No
Self-run scraper Whatever you build Proxies and anti-bot handling Whatever you parse Read Infrastructure plus your time You build it
Apify Very broad (large actor marketplace, many TikTok actors) API token Varies by actor Mostly read Usage-based compute plus actor pricing Yes, check their docs
Bright Data Very broad, plus prebuilt datasets API key, proxy setup for some products Varies by product Read Per-record or per-request, volume tiers Yes, check their docs
EnsembleData Several major networks, strong TikTok focus API token Raw platform values Read Unit-based plans Check vendor
HikerAPI Instagram-focused API key Raw platform values Read Per-request Check vendor
Phyllo Creator platforms via creator consent OAuth per creator Official, consented Read (some write) Subscription / contract Check vendor
RapidAPI Marketplace of many third-party TikTok APIs RapidAPI key Varies by listing Varies Per-request tiers per listing Varies
Modash Influencer discovery (TikTok, Instagram, YouTube) API key on higher plans Often rounded for display Read Subscription plus API credits Check vendor
HypeAuditor Influencer analytics across major networks API key, typically sales-led Analytics estimates plus counts Read Subscription / contract Check vendor
Data365 Several major networks API key Raw platform values Read Subscription with request limits Check vendor
SocialLens 17 networks, one schema One sk_live_ key Explicit is_exact flag per read Read only Simple published pricing Yes, open source (npx -y sociallens-mcp)

Where SocialLens is not the best pick:

Where SocialLens wins:

For a deeper vendor-by-vendor look at MCP options, read best social media MCP server.

Connect SocialLens to your AI agent

The MCP server is one package: npx -y sociallens-mcp. It needs Node.js installed and your API key in the environment. The key's environment variable name is documented in the package README. The configs below use SOCIALLENS_API_KEY as the example, so match whatever the README specifies.

Claude Code

  1. Get a key at register.
  2. Export it in your shell: export SOCIALLENS_API_KEY=sk_live_YOUR_KEY.
  3. Add the server:
    claude mcp add sociallens -- npx -y sociallens-mcp
    
  4. Run claude mcp list to confirm it is connected, then ask: "Get the TikTok profile for mrbeast and tell me if the follower count is exact."

See the official Claude Code MCP docs for scopes and environment handling.

Claude Desktop

  1. Open claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\).
  2. Add:
    {
      "mcpServers": {
        "sociallens": {
          "command": "npx",
          "args": ["-y", "sociallens-mcp"],
          "env": { "SOCIALLENS_API_KEY": "sk_live_YOUR_KEY" }
        }
      }
    }
    
  3. Fully quit Claude Desktop (not just close the window) and reopen it.
  4. Check that the SocialLens tools appear in the tools menu.

Cursor

  1. Create ~/.cursor/mcp.json for all projects, or .cursor/mcp.json in a repo for one project.
  2. Paste the same mcpServers block shown for Claude Desktop.
  3. Open Cursor Settings, find MCP, and confirm the server shows as enabled with its tools listed.

ChatGPT

ChatGPT connects to remote MCP servers over HTTPS, not to local stdio commands. You have two options:

  1. Run sociallens-mcp behind an stdio-to-HTTP bridge on a host you control and register that HTTPS URL as a connector.
  2. Skip MCP and define a custom action or function that calls GET /v1/profile and /v1/profile-posts directly with your bearer key.

Agent frameworks and the Claude API

Every SocialLens capability is a plain HTTPS GET, so any function-calling model can use it. Define a tool, and when the model calls it, run the request from the Python example above and return the JSON. A minimal Claude API definition:

import anthropic

client = anthropic.Anthropic()
tools = [{
    "name": "get_tiktok_profile",
    "description": "Read a public TikTok profile via SocialLens. Returns exact follower counts with is_exact.",
    "input_schema": {
        "type": "object",
        "properties": {"username": {"type": "string"}},
        "required": ["username"],
    },
}]

resp = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=4096,
    thinking={"type": "adaptive"},
    tools=tools,
    messages=[{"role": "user", "content": "Compare @mrbeast and @charlidamelio on TikTok."}],
)
# When resp contains a tool_use block, call /v1/profile and send back a tool_result.

For the full agent loop, including tool results and multi-network prompts, follow the Instagram scraper for Claude guide. The same pattern works for TikTok by changing platform. For the broader architecture, see the hub on social media data for AI agents.

What data you can pull across 17 networks

The networks are TikTok, Instagram, YouTube, Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram, Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, and Spotify.

Capability What it returns Network notes
Profile Counts, bio, verified, avatar, is_exact, fetched_at All 17 networks
Profile posts Recent posts with likes, views, comments, shares Where the network exposes posts
Post by URL One post's stats and metadata Paste any public post URL
Post comments Public comments on a post Where comments are public
Followers / following listing Public account lists TikTok only
Keyword search Public posts or accounts matching a term Supported networks
Video transcript Spoken text of a video Video networks such as TikTok and YouTube
Audience demographics Audience breakdown where available Supported networks

For a TikTok workflow, a common combination is profile (size), profile posts (recent performance), transcript (what the videos say), and comments (how the audience reacts). All four use the same key.

What it costs and how pricing models differ

Vendors price TikTok data in five main ways. Knowing the model matters more than the sticker price, because it determines what a retry, an empty result, or a pagination call costs you.

Model How it works Watch out for
Pay-per-use You pay for each successful read Low commitment. Check whether failed or empty reads are billed
Units Each endpoint costs a set number of units from a monthly pool Heavy endpoints (comments, follower lists) can burn units fast
Credits Prepaid credits, often weighted by data volume Credit expiry and weighting rules
Per-request (marketplace) Each listing sets its own tier and quota Pricing and quality vary listing by listing
Subscription / contract Flat monthly or annual fee, often with seats Paying for unused capacity, and sales-led onboarding

The official TikTok APIs carry no license fee, but the Research API costs you an application and approval cycle, and the Display API costs you an OAuth integration and app review. A self-run scraper has no license fee either, but proxies, compute, and engineering time are real costs. They tend to rise whenever TikTok changes its defenses.

As of late 2026, competitor prices change frequently and differ by plan, so check each vendor's pricing page rather than trusting any figure quoted secondhand, including on review sites. SocialLens uses simple published pricing for one key across all 17 networks. See current plans when you create an account. At very high volume, a bulk dataset vendor may be cheaper per record. At typical agent and dashboard volumes, one key with no proxy or maintenance overhead is usually the lower total cost.

Reading publicly available data is generally on stronger legal ground than accessing anything behind a login, but it is not risk-free.

This is not legal advice. Talk to counsel about your specific use case and jurisdiction.

Troubleshooting

The MCP server does not appear at all. The config file is almost always invalid JSON. A trailing comma, a missing brace, or smart quotes pasted from a document will silently break it. Run the file through a JSON validator before restarting.

npx not found, or the server exits immediately. GUI apps such as Claude Desktop often do not inherit your shell PATH, especially with Node version managers. Replace "command": "npx" with the absolute path from which npx (macOS/Linux) or where npx (Windows). On Windows, if npx still fails, use "command": "cmd" with "args": ["/c", "npx", "-y", "sociallens-mcp"].

Relative paths break. Clients launch servers from their own working directory, not your project folder. Any path in the config (a script, a .env file) must be absolute.

Changes do not take effect. Claude Desktop reads its config only at launch. Closing the window is not enough, so fully quit the app and reopen it. In Cursor, toggle the server off and on in MCP settings, or reload the window.

401 Unauthorized. The key is missing, mistyped, or not reaching the server. Confirm the header reads exactly Authorization: Bearer sk_live_... with one space, and that the environment variable name in your config matches the README. For remote MCP setups, a 401 often means the client never completed the OAuth or authorization step. Reconnect the connector and finish the sign-in flow.

403 Forbidden. The request was understood but refused. On a remote MCP bridge, this usually means the token lacks the required scope or the bridge is blocking the origin. Check the bridge's auth settings before assuming the API key is bad.

ChatGPT or a web client will not accept the server. Those clients need a remote HTTPS MCP URL. npx -y sociallens-mcp runs over stdio locally, so put it behind an stdio-to-HTTP bridge, or call the REST endpoints directly as a custom action.

Cursor uses the wrong config. Cursor reads both the global ~/.cursor/mcp.json and the project .cursor/mcp.json. If both define a server named sociallens with different keys, you can end up debugging the wrong one. Define it in one place, or give the two entries different names.

exists: false for a real creator. Check the username. Use the handle without @, not the display name. The account may also have been renamed, banned, or set to private.

Counts look stale. Look at fetched_at and cached. If you need the freshest possible number for a time-sensitive report, compare fetched_at to your deadline before publishing.

FAQ

How do I fetch TikTok user data without the Research API?

Call a read-only data API. With SocialLens, send GET /v1/profile?platform=tiktok&username=USERNAME with a bearer key. It returns followers, following, total likes, video count, and verified status for any public account, with no approval process or user OAuth.

Does TikTok show exact follower counts through an API?

Yes. TikTok exposes exact counts, and SocialLens returns them with is_exact: true. On 2026-12-04, @mrbeast returned exactly 149219704 followers, compared with the rounded "149.2M" shown in the app.

Can I get a TikTok user's follower list?

Yes, for public accounts. TikTok is the only one of SocialLens's 17 networks where it lists followers and following. It returns public accounts only. Private accounts and hidden lists are not accessible, and large lists are paginated.

How do I get views, likes, comments, and shares for TikTok videos?

Use GET /v1/profile-posts?platform=tiktok&username=USERNAME&limit=N. Each item in posts[] includes views, likes, comments, shares, caption, url, and published_at. For a single video, use its URL with the post-by-URL or comments endpoints.

How do I calculate TikTok engagement rate from API data?

Divide likes plus comments plus shares by views. For a real @mrbeast video: (5683867 + 121697 + 696254) / 27545701 = 23.60%. Some teams divide by followers instead, so state which formula you used.

Can SocialLens access private TikTok accounts or DMs?

No. SocialLens is read-only and reads public data only. It never logs in, never uses a session, and cannot read private accounts, DMs, drafts, or creator-only analytics. It also cannot post, like, or follow.

Can Claude or Cursor fetch TikTok data directly?

Yes, through MCP. Add the server with npx -y sociallens-mcp and your key, and the agent can call profile, posts, and comments tools. Claude Code uses claude mcp add sociallens -- npx -y sociallens-mcp.

Is the TikTok Display API enough for creator research?

Usually not. The Display API returns data only for users who sign in and authorize your app. It works for your own connected users but cannot look up arbitrary public creators for discovery, benchmarking, or competitor tracking.

Is fetching public TikTok data legal?

Reading public data is generally lower risk than logged-in access, per hiQ v. LinkedIn, but terms-of-service, GDPR, and CCPA obligations can still apply to how you store and use it. This is not legal advice.

Does one key work for other networks too?

Yes. One sk_live_ key covers 17 networks, including Instagram, YouTube, X, Reddit, and LinkedIn, with the same JSON schema. Only the platform parameter changes. Precision varies: YouTube returns is_exact: false because it exposes rounded counts.

How fresh is the data?

Each response includes fetched_at and a cached flag, so you can see exactly when the number was read. SocialLens also offers a no-key lookup that returns a live, dated figure, which lets AI assistants fetch a current count themselves.

Run these requests yourself

Every example on this page is a real call to the SocialLens API. A new account starts with 250 free reads, no card needed, and a read that fails is never charged.

Keep reading