A Developer's First Steps with the Tiklocker API
By The Tiklocker Team on 2025-10-27 08:13:32
Welcome, developers! The Tiklocker API is a simple yet powerful tool designed to let you programmatically download TikTok videos in bulk. Whether you're building a content archive, a social media management tool, or a data analysis script, our API provides the engine you need.
This guide will walk you through making your first successful API call in just a few minutes.
Step 1: Get Your API Key
All API requests are authenticated using a unique API key. Getting yours is free and instant.
- Create a Free Account: If you haven't already, register for an account on our site.
- Navigate to Your Profile: Once logged in, go to your Profile page.
- Copy Your Key: Your API key will be clearly displayed. Keep this key secure, as it is used to track your account's credit usage.
Step 2: Understand the Endpoint
We've kept things simple. There is only one endpoint for batch downloading:
- URL:
https://tiklocker.com/api/batch-download - Method:
POST - Authentication:
Authorization: Bearer YOUR_API_KEY - Body (JSON): An array of up to 20 TikTok video URLs.
The API will process your request and respond directly with a .zip file containing the downloaded videos.
Step 3: Make Your First API Call (Python Example)
Let's put it all together. Here is a simple Python script that uses your API key to download a list of videos.
import requests
# Replace with your actual API key from your profile page
API_KEY = "tok_xxxxxxxxxxxxxxxxxxxxxxxx"
API_URL = "https://tiklocker.com/api/batch-download"
# A list of the video URLs you want to download
video_urls = [
"https://www.tiktok.com/@zachking/video/6768504823336815877",
"https://www.tiktok.com/@therock/video/6925235456273747206"
]
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"urls": video_urls
}
print("Sending request to the Tiklocker API...")
response = requests.post(API_URL, headers=headers, json=data)
if response.status_code == 200:
# Save the received zip file
with open("tiklocker_batch.zip", "wb") as f:
f.write(response.content)
print("✅ Success! Videos saved to tiklocker_batch.zip")
elif response.status_code == 402:
print("❌ Error: Insufficient credits. Please check your account on tiklocker.com.")
else:
print(f"❌ An error occurred: {response.status_code}")
print(response.json())
Step 4: Run Your Script
- Make sure you have Python and the
requestslibrary installed. You can install it using pip:pip install requests - Save the script above to a file named
tiklocker_api_example.py. - Run the script:
python tiklocker_api_example.py - If everything is set up correctly, you should see a
tiklocker_batch.zipfile in your current directory containing the downloaded videos.
🎉 Congratulations! 🎉