Video Downloader Guides
A Developer's First Steps with the Tiklocker API
The Tiklocker API lets developers programmatically download TikTok videos in bulk with a single authenticated POST request that returns a ready-to-use .zip file. This guide walks you through getting your free API key, understanding the one endpoint you need, and making your first successful call in Python in just a few minutes. No complicated setup, no SDK to install - just a key and a list of URLs.
Whether you're building a content archive, a social-media management tool, or a data-analysis pipeline, the API gives you the same batch-download capability that powers Tiklocker's web tools - exposed for your own scripts. Let's get you from zero to a downloaded .zip as quickly as possible.
Step 1: Get Your API Key
Every request is authenticated with a unique API key. Getting one is free and instant.
- Create a free account. If you haven't already, register for an account on the site.
- Open your profile page. Once logged in, head to your profile.
- Copy your key. Your API key is displayed there. Treat it like a password - it tracks your account's credit usage, so don't paste it into public code or commit it to a repository.
If you ever suspect your key has leaked, regenerate it from the same profile page and update your scripts with the new value.
Step 2: Understand the Endpoint
We kept the surface area deliberately small. There's a single endpoint for batch downloading:
| Property | Value |
|---|---|
| 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 |
| Response | A .zip file containing the downloaded videos |
That's the whole contract. You send a JSON body with your URLs, and the API responds directly with a binary .zip. There's no polling, no job queue to manage, and no second call to fetch results.
Step 3: Make Your First API Call (Python Example)
Here's a complete script that authenticates with your key and downloads a list of videos to a local .zip.
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:
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. Check your account on tiklocker.com.")
else:
print(f"An error occurred: {response.status_code}")
print(response.json())
Notice the handling for status 402 - that's how the API signals you're out of credits, so your script can react gracefully instead of crashing.
Step 4: Run Your Script
- Make sure Python and the
requestslibrary are installed:pip install requests - Save the script above as
tiklocker_api_example.py. - Run it:
python tiklocker_api_example.py - If everything is configured correctly, you'll find a
tiklocker_batch.zipin your current directory containing the downloaded videos.
That's your first successful integration. From here you can loop over larger lists in batches of 20, schedule the script with cron, or wire it into a larger application.
Handling Responses Like a Pro
Production code should account for every status the API can return. Here's a quick reference:
| Status code | Meaning | What to do |
|---|---|---|
200 |
Success | Write response.content to a .zip |
402 |
Insufficient credits | Pause and top up your account |
400 |
Bad request | Check your JSON body and URL format |
401 |
Auth failed | Verify the Authorization header and key |
A few best practices worth baking in from day one:
- Keep your key in an environment variable, not hard-coded in the file. Read it with
os.environ. - Batch in groups of 20, since that's the per-request URL limit. Chunk a long list and call the endpoint repeatedly.
- Add retry logic with a short backoff for transient network errors so a single hiccup doesn't kill a long job.
- Log the status code and response body on failure - the JSON error payload tells you exactly what went wrong.
If you'd rather not write code at all, the same batch capability is available through the no-code Profile Downloader, and single clips work instantly via the TikTok video downloader.
Frequently Asked Questions
How many videos can I send in one API request?
Up to 20 TikTok video URLs per request. To process a larger list, split it into chunks of 20 and call the endpoint once per chunk, saving each .zip as it returns.
Is the Tiklocker API free to use?
Getting an API key is free and instant. Usage is metered against your account's credits, and the API returns a 402 status when you run low - so you always know where you stand before a request fails silently.
Where do I find my API key?
Register for a free account, then open your profile page after logging in. Your key is displayed there. Keep it private and regenerate it from the same page if it's ever exposed.
What format does the API return?
A single .zip file containing the downloaded videos, returned directly in the 200 response body. Just write response.content to a file and unzip it - there's no separate fetch step.
Start Building Today
You're now equipped to download TikTok videos in bulk straight from your own code. Grab your free key, send your first batch of 20 URLs, and let the API hand you back a .zip. When you want a no-code path for entire catalogs, the Profile Downloader has you covered - same power, zero scripting.
Ready to download?
Grab any TikTok, Instagram, YouTube, or X video in seconds — no watermark, no app.
Open the downloader →