Need to get YouTube transcripts for your app or website? The YouTube Transcript API lets you fetch video transcripts programmatically. This guide explains how to use it.
With an API, you can automate transcript extraction. No manual copying needed. Perfect for developers building apps, tools, or content platforms.
What is the YouTube Transcript API?
A transcript API is a service that returns video transcripts in a format your code can use (usually JSON). You send a video ID, and the API sends back the transcript text.
YoutubeTS offers a simple REST API for getting YouTube transcripts. It is easy to use and works with any programming language.
Why Use a Transcript API?
Here are common use cases:
- Build tools - Create your own transcript viewer or editor
- Content apps - Add transcript features to your website
- AI/ML projects - Feed transcript data to machine learning models
- Search engines - Index video content for search
- Accessibility tools - Help users who need text versions
- Research - Analyze large amounts of video content
How the YoutubeTS API Works
Our API is simple to use:
1. Get an API Key
Sign up at YoutubeTS.com and get your API key from the dashboard. API keys are available on paid plans.
2. Make an API Request
Send a request to our API endpoint with the video ID.
3. Get JSON Response
The API returns the transcript in JSON format. You can parse this in your code.
API Request Example
Here is how to make an API request:
GET https://youtubets.com/api/v1/transcript?video_id=VIDEO_ID
Headers:
Authorization: Bearer YOUR_API_KEY
Accept: application/json
Parameters:
| Parameter | Required | Description |
|---|---|---|
| video_id | Yes | The YouTube video ID (11 characters) |
API Response Example
The API returns a JSON response like this:
{
"success": true,
"video_id": "dQw4w9WgXcQ",
"video_title": "Video Title Here",
"language": "English",
"language_code": "en",
"transcript": [
{
"text": "Hello everyone",
"start": 0.0,
"duration": 2.5
},
{
"text": "Welcome to this video",
"start": 2.5,
"duration": 3.0
}
],
"full_text": "Hello everyone Welcome to this video..."
}
Response Fields:
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| video_id | string | The YouTube video ID |
| video_title | string | Title of the video |
| language | string | Language of the transcript |
| language_code | string | ISO language code |
| transcript | array | Array of transcript segments with timestamps |
| full_text | string | Complete transcript as plain text |
Code Examples
Python Example
import requests
api_key = "YOUR_API_KEY"
video_id = "dQw4w9WgXcQ"
response = requests.get(
f"https://youtubets.com/api/v1/transcript",
params={"video_id": video_id},
headers={"Authorization": f"Bearer {api_key}"}
)
data = response.json()
print(data["full_text"])
JavaScript Example
const apiKey = "YOUR_API_KEY";
const videoId = "dQw4w9WgXcQ";
fetch(`https://youtubets.com/api/v1/transcript?video_id=${videoId}`, {
headers: {
"Authorization": `Bearer ${apiKey}`,
"Accept": "application/json"
}
})
.then(response => response.json())
.then(data => console.log(data.full_text));
PHP Example
$apiKey = "YOUR_API_KEY";
$videoId = "dQw4w9WgXcQ";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://youtubets.com/api/v1/transcript?video_id=" . $videoId);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $apiKey,
"Accept: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["full_text"];
Error Handling
The API returns error responses when something goes wrong:
{
"success": false,
"error": "No transcript available for this video"
}
Common Error Codes:
| HTTP Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Invalid video ID or no transcript |
| 401 | Invalid or missing API key |
| 429 | Rate limit exceeded |
| 500 | Server error |
Rate Limits
API rate limits depend on your plan:
| Plan | Requests/Month |
|---|---|
| Free | Not available |
| Pro | 1,000 requests |
| Business | 10,000 requests |
| Enterprise | Custom |
Need more? Contact us for enterprise pricing.
API Best Practices
1. Cache Results
Store transcripts in your database. Do not request the same video multiple times. This saves API calls and makes your app faster.
2. Handle Errors Gracefully
Some videos have no transcripts. Your code should handle these cases without crashing.
3. Respect Rate Limits
Do not make too many requests at once. Space out your requests to avoid hitting limits.
4. Secure Your API Key
Never expose your API key in client-side code. Keep it on your server only.
Get API Access
Ready to start using the YouTube Transcript API?
- Sign up at YoutubeTS.com
- Choose a plan with API access
- Get your API key from the dashboard
- Start making requests