API මිලකරණය සඳහා මෙතන ක්ලික් කරන්න
TTOK.com API එක TTOK.com හි සත්කාරකත්වය දරයි.
TTOK.com API වෙත ප්රවේශ වීමට, ඔබ ඔබේ අද්විතීය API යතුර ඇතුළත් කළ යුතුය. ඔබේ විද්යුත් තැපැල් ලිපිනය සමඟ ලියාපදිංචි වීමෙන් ඔබට API යතුරක් ලබා ගත හැකිය. කරුණාකර ඔබේ API යතුර රහසිගතව තබා ගැනීමට මතක තබා ගන්න.
API සමඟ සත්යාපනය HTTP ශීර්ෂ හරහා හසුරුවනු ලැබේ. සියලුම ඉල්ලීම් සඳහා ආකෘති යතුර තුළ ඔබගේ API යතුර අඩංගු බලය පැවරීමේ ශීර්ෂයක් අවශ්ය වේ: YOUR_API_KEY , එහිදී YOUR_API_KEY යනු ඔබගේ ගිණුම් පිටුවේ ඇති යතුරයි.
ආරක්ෂාව සඳහා, සම්ප්රේෂණය අතරතුර ඔබගේ දත්ත ආරක්ෂා කිරීම සඳහා සියලුම ඉල්ලීම් සංකේතනය කළ HTTPS සම්බන්ධතාවයක් හරහා යැවිය යුතුය.
Extract media from any supported URL with a single synchronous request. No polling required.
POST https://api.ttok.com/api/download
| Parameter | Type | Description |
|---|---|---|
url | string | The URL to extract media from (JSON body) |
Headers: Authorization: YOUR_API_KEY, Content-Type: application/json
import requests
headers = {
"Authorization": "API_KEY",
"Content-Type": "application/json"
}
r = requests.post(
url="https://api.ttok.com/api/download",
headers=headers,
json={"url": "URL"}
)
if r.status_code == 200:
data = r.json()
for item in data.get("items", []):
print(f"Type: {item['type']}, URL: {item['url']}")
else:
print(f"Error: {r.status_code} - {r.text}")const axios = require('axios');
async function download() {
try {
const response = await axios.post(
'https://api.ttok.com/api/download',
{ url: "URL" },
{ headers: { "Authorization": "API_KEY", "Content-Type": "application/json" } }
);
for (const item of response.data.items) {
console.log(`Type: ${item.type}, URL: ${item.url}`);
}
} catch (error) {
console.error(`Error: ${error.response?.status} - ${error.response?.data}`);
}
}
download();
<?php
$ch = curl_init("https://api.ttok.com/api/download");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: API_KEY",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["url" => "URL"]));
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($statusCode === 200) {
$data = json_decode($response, true);
foreach ($data['items'] as $item) {
echo "Type: {$item['type']}, URL: {$item['url']}\n";
}
} else {
echo "Error: $statusCode - $response\n";
}
?>
curl -X POST "https://api.ttok.com/api/download" \
-H "Authorization: API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "URL"}'
{
"success": true,
"items": [
{
"url": "https://...",
"type": "video",
"thumbnail": "https://...",
"mime_type": "video/mp4",
"site": "tiktok",
"title": "Video title"
}
]
}
Convert media to different formats. Returns a binary file stream.
| Endpoint | Output Format | Content-Type |
|---|---|---|
POST /api/convert/mp3 | MP3 audio | audio/mpeg |
POST /api/convert/mp4 | MP4 video | video/mp4 |
POST /api/convert/wav | WAV audio | audio/wav |
POST /api/convert/gif | GIF image | image/gif |
All conversion endpoints are at https://api.ttok.com.
Request body (JSON):
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The media URL to convert |
options.start_time | number | No | Start time in seconds |
options.end_time | number | No | End time in seconds |
options.audio_quality | string | No | Audio bitrate (e.g. "128", "192", "320") |
options.video_quality | string | No | Video quality (e.g. "720", "1080") |
options.h264 | boolean | No | Force H.264 codec for MP4 |
options.subtitles | boolean | No | Embed subtitles if available |
import requests
headers = {
"Authorization": "API_KEY",
"Content-Type": "application/json"
}
r = requests.post(
url="https://api.ttok.com/api/convert/mp3",
headers=headers,
json={
"url": "URL",
"options": {
"audio_quality": "192",
"start_time": 10,
"end_time": 45
}
},
stream=True
)
if r.status_code == 200:
with open("output.mp3", "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
print("Downloaded output.mp3")
else:
print(f"Error: {r.status_code} - {r.text}")curl -X POST "https://api.ttok.com/api/convert/mp3" \
-H "Authorization: API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "URL", "options": {"audio_quality": "192"}}' \
--output output.mp3
All errors return a JSON response with an error field:
// 400 Bad Request
{"error": "Missing URL"}
// 401 Unauthorized
{"error": "Invalid API token"}
// 402 Payment Required
{"error": "Insufficient credits"}
API
රහස්යතා ප්රතිපත්තිය
සේවා කොන්දේසි
අපව අමතන්න
BlueSky හි අපව අනුගමනය කරන්න
2026 TTOK LLC | විසින් සාදන ලදී nadermx