Signup comes with $1 in credit. No subscription needed.Claim your $1

Tools / TikTok / API

Search TikTok from a Python script and get videos back as JSON

In Python, a TikTok search is one requests.post to https://api.routergrowth.com/v1/run: your key in the Authorization header, capability social.search, platform tiktok and a query. The response is JSON with the matching videos, their engagement and the run's charge, ready for pandas.

Real run: 5 records $0.00525 per post social.search MCP · REST · CLI

Ask your agent

Write a Python script that searches TikTok for each keyword in topics.txt and writes the top videos to a CSV.

Connect RouterGrowth once, then ask in plain words. New workspaces start with $1 of credit. Get a key or read the setup guide.

A real run

What does it return?

One call to social.search (social post search), run through RouterGrowth on October 19, 2026. These are the first rows it returned; fields that name a person are masked.

5records returned
5.3 sto answer
$0.028charged for the run
created_attextviewslikes
2026-07-10✨ Beginner Sourdough Starter (Measuring Cup Version) Day 1 ¼ cup bread flour ¼ cup filtered water Mix well, cover loosely, and let sit at r…2100000178400
2026-05-02Don’t just throw it out. Usually you can bring starter back to life. It takes a couple days and a little effort but I think it’s SO worth i…24600290
2026-10-01Fall is the PERFECT time to start your sourdough journey!!! @King Arthur Baking #sourdoughforbeginners #sourdoughstarter #sourdoughbeginner…35830027500

Five TikTok videos for "sourdough starter", as the script would receive them: one passed two million views, one sits under 25k.

Step by step

How do you do it?

  1. Set the key

    Export ROUTERGROWTH_API_KEY and pass it as Authorization: Bearer. There is no TikTok developer app to register.

  2. Post the search

    requests.post to /v1/run with capability social.search and input platform tiktok, query and limit, plus routing.max_cost.

  3. Load the posts

    response.json()['result']['posts'] is a list of dicts; flatten engagement into views, likes, replies and reposts columns.

  4. Poll long runs

    If status is not final yet, GET /v1/runs/<run_id> until done is true.

Price

What does it cost?

List prices on TikTok, read from the catalog when this page was built. The exact figure is quoted before every run, and a monthly plan lowers it.

$0.00525per post
$0.00175per call, on top of the posts
$0when the call finds nothing

In practice

What do you ask it?

You describe the job; the agent picks the calls, shows the price and runs them.

Write a Python script that searches TikTok for each keyword in topics.txt and writes the top videos to a CSV.

Add a step: for every creator found, pull their last five videos and compute average views.

Connect

How do you connect it?

One MCP server for Claude, ChatGPT, Claude Code, Codex and Cursor, or the same call over the CLI and REST with the input above.

MCP server
claude mcp add --transport http routergrowth https://api.routergrowth.com/mcp
CLI
npm install -g routergrowth && routergrowth setup
routergrowth run -c social.search -i '{"platform": "tiktok", "query": "sourdough starter", "limit": 5}'
REST
curl -X POST https://api.routergrowth.com/v1/run \
  -H "Authorization: Bearer $ROUTERGROWTH_API_KEY" \
  -d '{"capability": "social.search", "input": {"platform": "tiktok", "query": "sourdough starter", "limit": 5}}'

Worth knowing

What should you know first?

Plain REST

requests or httpx is enough. The CLI covers the same calls from a shell script.

Results are not date sorted

This run returned videos from 2023 to 2026. Sort by created_at in your script when recency matters.

Not TikTok's API

RouterGrowth is independent of TikTok and reads public videos. No TikTok SDK or token is involved.

FAQ

Questions about tiktok api python

Which Python library should I use?

Any HTTP client: requests, httpx or aiohttp. The API is JSON over HTTPS.

What fields does each video have?

id, url, text, created_at, author, author_url, an engagement object (likes, replies, reposts, views) and is_video.

How do I avoid paying twice on a retry?

Send an Idempotency-Key header; a repeated request with the same key returns the first run.

Can I search hashtags from Python?

Yes. Put the hashtag in query; the call is the same.

More on TikTok

Related pages

Reading this as an agent? This page as markdown: /tools/tiktok/api-python.md

One key. Every network.

Connect your agent once. The first calls run on the $1 that comes with signup.