YouTube Transcript API for Developers
Production-ready YouTube transcript API with 99.9% reliability. Complete documentation with code examples in JavaScript, Python, and cURL for building robust applications.
Our REST API is designed for developers who need reliable, production-grade YouTube transcript extraction. Unlike other services that break your workflows, our API is built for scale with proper error handling, rate limiting, and comprehensive documentation.
Get Your API Key
Sign up at YoutubeTranscripts.cc to get your API key. You'll receive 25 free credits to get started, then pay only for what you use.
Quick Start
Basic cURL Request
curl -X POST https://www.youtubetranscripts.cc/api/v1/extract \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_id": "dQw4w9WgXcQ",
"language": "en"
}'API Reference
POST /api/v1/extract
Extract transcript from a YouTube video.
Headers
AuthorizationBearer YOUR_API_KEYContent-Typeapplication/jsonRequest Body
video_idstring, requiredYouTube video ID (e.g., "dQw4w9WgXcQ")
languagestring, optionalLanguage code (default: "en"). Supports: en, es, fr, de, ja, ko, zh, pt
Response
{
"success": true,
"data": {
"video_id": "dQw4w9WgXcQ",
"title": "Video Title",
"channel": "Channel Name",
"duration": 212,
"language": "en",
"transcript": [
{
"start": 0.0,
"duration": 3.5,
"text": "Never gonna give you up"
},
{
"start": 3.5,
"duration": 2.8,
"text": "Never gonna let you down"
}
]
},
"credits_used": 1,
"credits_remaining": 24
}Code Examples
JavaScript (Node.js)
const fetch = require('node-fetch');
async function extractTranscript(videoId, language = 'en') {
const response = await fetch('https://www.youtubetranscripts.cc/api/v1/extract', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
video_id: videoId,
language: language
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
}
// Usage
extractTranscript('dQw4w9WgXcQ')
.then(result => {
console.log('Transcript:', result.data.transcript);
console.log('Credits remaining:', result.credits_remaining);
})
.catch(error => {
console.error('Error:', error.message);
});Python
import requests
import json
def extract_transcript(video_id, language='en', api_key='YOUR_API_KEY'):
url = 'https://www.youtubetranscripts.cc/api/v1/extract'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
'video_id': video_id,
'language': language
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
return None
# Usage
result = extract_transcript('dQw4w9WgXcQ')
if result and result['success']:
print('Transcript:', result['data']['transcript'])
print('Credits remaining:', result['credits_remaining'])
else:
print('Failed to extract transcript')PHP
<?php
function extractTranscript($videoId, $language = 'en', $apiKey = 'YOUR_API_KEY') {
$url = 'https://www.youtubetranscripts.cc/api/v1/extract';
$data = json_encode([
'video_id' => $videoId,
'language' => $language
]);
$context = stream_context_create([
'http' => [
'method' => 'POST',
'header' => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
],
'content' => $data
]
]);
$response = file_get_contents($url, false, $context);
if ($response === FALSE) {
return null;
}
return json_decode($response, true);
}
// Usage
$result = extractTranscript('dQw4w9WgXcQ');
if ($result && $result['success']) {
echo 'Transcript: ' . json_encode($result['data']['transcript']) . "\n";
echo 'Credits remaining: ' . $result['credits_remaining'] . "\n";
} else {
echo 'Failed to extract transcript' . "\n";
}
?>Error Handling
HTTP Status Codes
Error Response Format
{
"success": false,
"error": {
"code": "VIDEO_NOT_FOUND",
"message": "Video not found or no transcript available",
"details": "The video may be private, deleted, or have no captions"
},
"credits_used": 0,
"credits_remaining": 25
}Rate Limits & Best Practices
Production Guidelines:
- Rate Limit: 60 requests per minute per API key
- Timeout: 30 seconds per request
- Retries: Implement exponential backoff for 429/500 errors
- Caching: Cache successful responses to avoid duplicate requests
- Monitoring: Track your credit usage and success rates
Common Use Cases
Content Management Systems
Automatically extract and index video transcripts for searchable content libraries and knowledge bases.
AI Training Data
Collect large-scale transcript data for training language models and AI applications.
Educational Platforms
Create accessible learning materials by converting video lectures into searchable text format.
Business Intelligence
Analyze competitor content, market research videos, and customer testimonials at scale.
Getting Help
Need help with integration? Check our comprehensive documentation or reach out to our developer support team. We're here to help you build amazing applications with reliable transcript data.
Explore Other Integration Options
Ready to Build with Our API?
Get started with 25 free credits and build production-ready applications today.
Get Your API Key