API Documentation
Learn how to integrate Subtube API into your application.
Quick Start
# JSON (default)
curl -X GET "https://subtube.app/api/v1/transcribe/?videoUrl=https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
-H "Authorization: Bearer YOUR_API_KEY"
# SRT format
curl -X GET "https://subtube.app/api/v1/transcribe/?videoUrl=https://www.youtube.com/watch?v=dQw4w9WgXcQ&format=srt" \
-H "Authorization: Bearer YOUR_API_KEY"
# VTT format
curl -X GET "https://subtube.app/api/v1/transcribe/?videoUrl=https://www.youtube.com/watch?v=dQw4w9WgXcQ&format=vtt" \
-H "Authorization: Bearer YOUR_API_KEY"
# Plain text (no timestamps)
curl -X GET "https://subtube.app/api/v1/transcribe/?videoUrl=https://www.youtube.com/watch?v=dQw4w9WgXcQ&format=txt" \
-H "Authorization: Bearer YOUR_API_KEY"const videoUrl = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
const format = 'srt'; // json | srt | vtt | txt
const url = `https://subtube.app/api/v1/transcribe/?videoUrl=${encodeURIComponent(videoUrl)}&format=${format}`;
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
}
});
if (format === 'json') {
const data = await response.json();
console.log(data);
} else {
const text = await response.text();
console.log(text);
}import requests
from urllib.parse import urlencode
video_url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
format = 'srt' # json | srt | vtt | txt
params = {'videoUrl': video_url, 'format': format}
url = f'https://subtube.app/api/v1/transcribe/?{urlencode(params)}'
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get(url, headers=headers)
if format == 'json':
print(response.json())
else:
print(response.text)<?php
$videoUrl = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$format = 'srt'; // json | srt | vtt | txt
$url = 'https://subtube.app/api/v1/transcribe/?videoUrl=' . urlencode($videoUrl) . '&format=' . $format;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY'
]);
$response = curl_exec($ch);
curl_close($ch);
if ($format === 'json') {
$data = json_decode($response, true);
print_r($data);
} else {
echo $response;
}📝 Don't have an API key yet? Create one here
Parameters
| Parameter | Required | Description |
|---|---|---|
videoUrl | Yes | YouTube video URL |
format | No | Response format: json (default), srt, vtt, txt |
Response
JSON (default)
{
"success": true,
"videoId": "dQw4w9WgXcQ",
"language": "en",
"isAutoGenerated": false,
"subtitles": [
{
"start": 0.0,
"end": 2.5,
"text": "First subtitle line"
},
{
"start": 2.5,
"end": 5.0,
"text": "Second subtitle line"
}
]
}SRT
1
00:00:00,000 --> 00:00:02,500
First subtitle line
2
00:00:02,500 --> 00:00:05,000
Second subtitle lineVTT
WEBVTT
00:00:00.000 --> 00:00:02.500
First subtitle line
00:00:02.500 --> 00:00:05.000
Second subtitle lineTXT
First subtitle line
Second subtitle lineError Codes
| Code | Description |
|---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - API key is inactive or revoked |
404 | Not Found - Video not found or subtitles unavailable |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Something went wrong on our end |
Need Help?
If you have questions or need assistance, check out our request history to debug issues or contact support.