Skip to main content

TokConnect CLI

TikTok data in your terminal, or in your AI agent's shell: TikTok Shop sales estimates in 17 markets, what people search on TikTok, and public videos, comments, transcripts, creators, hashtags, sounds, LIVEs and ads. It wraps the TokConnect REST API: one command per API route, 137 in all.

pip install tokconnect                    # or: pipx install tokconnect
tokconnect login                          # paste your API key once
tokconnect products top --keyword "lip oil" --region US --limit 5

Needs Python 3.9 or newer. No other dependencies. Also on npm: npx tokconnect.

In Python

from tokconnect import Client, TokConnectError

tc = Client()  # key from TOKCONNECT_API_KEY or `tokconnect login`; or Client(api_key="...")
best = tc.products.top(keyword="lip oil", region="US", limit=5)
for p in best["data"]["items"]:
    print(p["product_title"], p["revenue"])

tc.videos.transcript("https://www.tiktok.com/@creator/video/7691522530129022221")
tc.creators.shop_sales("tokconnect", start="2026-10-01")   # two-word commands use underscores
tc.run("searches list", keyword="glass skin")              # or the CLI command as a string
tc.request("GET", "/v1/markets")                            # any route by path

Each method returns the API's JSON (data, next_cursor, meta). Errors raise TokConnectError with .status, .type and .body. A 429 or 503 is retried twice, after the Retry-After wait.

API key

The REST API is on every paid TokConnect plan. Get a key at app.tokconnect.com/api-key, then either:

  • run tokconnect login (saved to ~/.config/tokconnect/config.json, readable only by you),
  • set TOKCONNECT_API_KEY, or
  • pass --key on any command.

Most commands cost 1 credit. Failed calls are free.

Examples

# What sells on TikTok Shop
tokconnect products top --category Skincare --launched-within-days 30
tokconnect shops top --region GB --limit 10
tokconnect products sales 1729384756 --start 2026-10-01 --end 2026-10-31

# What people search on TikTok
tokconnect searches list --keyword "glass skin"
tokconnect searches trending

# Videos, creators and comments (ids or full TikTok links)
tokconnect videos transcript https://www.tiktok.com/@creator/video/7691522530129022221
tokconnect videos comments 7691522530129022221 --limit 50
tokconnect creators get tokconnect

# Every page of a list, merged (each page costs credits)
tokconnect products top --keyword "phone case" --all --max-pages 5

Find your way around

tokconnect --help                     # usage and the command groups
tokconnect commands                   # every command
tokconnect commands products --json   # machine-readable, for agents
tokconnect describe products top      # options, credits and an example
tokconnect call GET /v1/products/top --keyword mug   # any route by path
tokconnect sync                       # pick up new API routes without updating the CLI

Options follow the API's parameter names. --max-rows and --max_rows both work. List options can be repeated or comma-separated.

Output and exit codes

The output is the API's JSON response: data, next_cursor and meta (credits charged and left). It is pretty-printed in a terminal and compact when piped. Use --pretty or --compact to choose. Pipe it into jq:

tokconnect products top --keyword "lip oil" | jq '.data.items[] | {product_title, revenue}'

Errors go to stderr as the API's error JSON. Exit codes:

Code Meaning
0 success
1 API or network error
2 bad usage or a bad request
3 no API key, or the key is not allowed
4 out of credits
5 rate limited

On a 429 or 503 the CLI waits the Retry-After seconds and retries up to twice. Use --no-retry to turn this off.

For AI agents

  • One-line call: tokconnect <group> <command> ... --compact gives your agent TikTok data.
  • Discover commands: tokconnect commands --json and tokconnect describe <group> <command> --json.
  • Prefer MCP? TokConnect also runs an MCP server at https://mcp.tokconnect.com/mcp. Setup: tokconnect.com/connect.
  • Agent guide: tokconnect.com/llms.txt.

TokConnect is an independent service, not affiliated with TikTok.

Metadata

Release files for tokconnect 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tokconnect 0.1.0
File Size Uploaded Provenance Actions
tokconnect-0.1.0.tar.gz 36.9 kB Without provenance Details for tokconnect-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tokconnect 0.1.0
File Interpreter ABI Platform Actions
tokconnect-0.1.0-py3-none-any.whl Python 3 none any Details for tokconnect-0.1.0-py3-none-any.whl

Total release size: 71.0 kB

Release files / tokconnect-0.1.0.tar.gz

Download URL tokconnect-0.1.0.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
24bf48bf0ccb004645b3b7e44306ef1607d7c862c441140cd85228d0c22593d0
BLAKE2b-256 checksum
How to use checksums
5a13aecf85a92c9d4170ddc5936e89cc1c962ef06cc1ebaaa95a7c154d674ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / tokconnect-0.1.0-py3-none-any.whl

Download URL tokconnect-0.1.0-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a354095de1ae3a8450064f56f4586af01a359cdf7b289cf91214e0d1fe60198d
BLAKE2b-256 checksum
How to use checksums
882e525ce3cf05f51227397f1b625c7a45b3e4c20c533f132011987d1a8d2074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for tokconnect 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page