TikTok API Python Client
Extract TikTok data with our TikTok API Python client. Get programmatic access to music data, video metadata, hashtags, followers, hearts, shares, video URLs, profiles, and more using simple Python code. Start free, no credit card required.

Trusted by industry leaders all over the world
Integrate our TikTok API
The Apify API client for Python is the official library that allows you to use TikTok API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.
Python
JavaScript
HTTP
MCP
1from apify_client import ApifyClient2
3# Initialize the ApifyClient with your Apify API token4# Replace '<YOUR_API_TOKEN>' with your token.5client = ApifyClient("<YOUR_API_TOKEN>")6
7# Prepare the Actor input8run_input = {9 "hashtags": ["fyp"],10 "resultsPerPage": 100,11 "proxyCountryCode": "None",12}13
14# Run the Actor and wait for it to finish15run = client.actor("clockworks/tiktok-scraper").call(run_input=run_input)16
17# Fetch and print Actor results from the run's dataset (if there are any)18print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])19for item in client.dataset(run["defaultDatasetId"]).iterate_items():20 print(item)21
22# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Get data with TikTok API Python client
Use our Python API client to extract TikTok data by providing hashtags, profile URLs, or specific video URLs as inputs. The API returns structured data, including author metadata, video statistics, play counts, share counts, comment counts, music information, and timestamps.
Input
{ "hashtags": [ "bananas" ], "resultsPerPage": 100, "proxyCountryCode": "None", "shouldDownloadCovers": false, "shouldDownloadVideos": false, "shouldDownloadSubtitles": false, "shouldDownloadSlideshowImages": false}
Output
{ "text": "banana bananana funny cartoon 😂#foryou #foryoupage #funny #memes #funnynimations #viraltiktok #fyp #bts #Love #trend@TikTok @TikTok Bangladesh @funny animation @funny animation @funny animation ", "diggCount": 18400, "playCount": 722300, "shareCount": 1902, "webVideoUrl": "<https://www.tiktok.com/@funnyanimation242/video/7298624334447299858>", "collectCount": 1912, "commentCount": 257, "createTimeISO": "2023-11-07T07:50:05.000Z", "authorMeta.name": "funnyanimation242", "authorMeta.avatar": "<https://p16-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/d0d51b24a15a39a40c5334139188a78a.jpeg?lk3s=a5d48078&nonce=45592&refresh_token=f827e0f5cd7a48c58837494cf2683cab&x-expires=1722942000&x-signature=alkielqA31AuKYfP%2BlVum5%2BoeAc%3D&shp=a5d48078&shcp=b59d6b55>", "videoMeta.duration": 17, "musicMeta.musicName": "original sound", "musicMeta.musicAuthor": "funny animation", "musicMeta.musicOriginal": true}
Sign up for Apify account01
Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.
Install Apify Python client02
Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with TikTok API from your Python applications.
Get your Apify API token03
Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.
Integrate TikTok API04
Navigate to the TikTok API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate TikTok API into your Python application.
Get your TikTok data via API05
The TikTok API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?
Never get blocked
Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.
Customers love us
We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.
Monitor your runs
With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.
Export to various formats
Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.
Integrate Apify to your workflow
You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.
Large developer community
Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!
Python-ready TikTok data extraction
Connect to hundreds of apps right away using ready-made integrations, or set up your own with webhooks and our API.
TikTok does not provide an official Python API client for scraping video content, profiles, and hashtag data at scale. However, our TikTok Scraper serves as a powerful unofficial Python API client that extracts publicly available data from the platform, giving you access to comprehensive TikTok data for your projects and business needs.
Yes! You can try our TikTok Python API client for free. Apify offers free tier usage with $5 in platform credits for new users. The Python API client uses pay-per-event pricing: $0.03 per actor start, $0.004 per dataset item, with optional add-ons like video downloads for $0.001 each.
You can extract comprehensive TikTok data using Python API clients including author avatars and usernames, video text and descriptions, engagement metrics (likes, shares, comments, play counts), video duration and timestamps, music metadata (name, author, original status), profile information (followers, bio, verification status), hashtag performance data, and video URLs for download.
Yes, it is legal to scrape publicly available TikTok data using Python API clients. Python-based TikTok scrapers are ethical and do not extract private user data such as email addresses, gender, or location. They only collect information that users have chosen to share publicly through Python API integration. However, you should ensure you have legitimate reasons for data collection and comply with GDPR and other applicable privacy regulations when using Python API clients.
Getting started with our TikTok Python API is easy — simply create a free Apify account, get your API token, and start using the TikTok API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.