curl --request POST \
--url https://{deployment}/api/v1/youtube/transcript/v2 \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"format": "json",
"preferred_lang": "en",
"with_metadata": false
}
'import requests
url = "https://{deployment}/api/v1/youtube/transcript/v2"
payload = {
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"format": "json",
"preferred_lang": "en",
"with_metadata": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
video_url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
format: 'json',
preferred_lang: 'en',
with_metadata: false
})
};
fetch('https://{deployment}/api/v1/youtube/transcript/v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{deployment}/api/v1/youtube/transcript/v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_url' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
'format' => 'json',
'preferred_lang' => 'en',
'with_metadata' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{deployment}/api/v1/youtube/transcript/v2"
payload := strings.NewReader("{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{deployment}/api/v1/youtube/transcript/v2")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployment}/api/v1/youtube/transcript/v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}"
response = http.request(request)
puts response.read_body{
"video_id": "dQw4w9WgXcQ",
"format": "json",
"content": "[{\"text\":\"We're no strangers to love\",\"start\":0.0,\"duration\":3.5}]",
"success": true,
"retry_info": {
"total_attempts": 1,
"failed_attempts": 0
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}Get YouTube transcript
Returns the transcript of a YouTube video in the requested format. Identify the video by either video_url or video_id. Requires a Basic license. This route is rate limited.
Set with_metadata: true to include video metadata in the response — note that the metadata fields require a Pro license; a Basic key returns the transcript with an upgrade placeholder in metadata.
curl --request POST \
--url https://{deployment}/api/v1/youtube/transcript/v2 \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"format": "json",
"preferred_lang": "en",
"with_metadata": false
}
'import requests
url = "https://{deployment}/api/v1/youtube/transcript/v2"
payload = {
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"format": "json",
"preferred_lang": "en",
"with_metadata": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
video_url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
format: 'json',
preferred_lang: 'en',
with_metadata: false
})
};
fetch('https://{deployment}/api/v1/youtube/transcript/v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{deployment}/api/v1/youtube/transcript/v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_url' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
'format' => 'json',
'preferred_lang' => 'en',
'with_metadata' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{deployment}/api/v1/youtube/transcript/v2"
payload := strings.NewReader("{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{deployment}/api/v1/youtube/transcript/v2")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployment}/api/v1/youtube/transcript/v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n \"format\": \"json\",\n \"preferred_lang\": \"en\",\n \"with_metadata\": false\n}"
response = http.request(request)
puts response.read_body{
"video_id": "dQw4w9WgXcQ",
"format": "json",
"content": "[{\"text\":\"We're no strangers to love\",\"start\":0.0,\"duration\":3.5}]",
"success": true,
"retry_info": {
"total_attempts": 1,
"failed_attempts": 0
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}{
"video_id": "<string>",
"format": "<string>",
"content": "<string>",
"success": true,
"error": "<string>",
"metadata": {
"title": "<string>",
"author_name": "<string>",
"author_url": "<string>",
"thumbnail_url": "<string>",
"thumbnail_maxres_url": "<string>",
"channel_id": "<string>",
"xml_feed_url": "<string>",
"subscriber_count": "<string>",
"view_count": 123,
"like_count": 123,
"channel_handle": "<string>",
"date_published": "2023-11-07T05:31:56Z",
"upload_date": "2023-11-07T05:31:56Z"
},
"retry_info": {
"total_attempts": 123,
"failed_attempts": 123,
"errors": [
"<string>"
]
}
}Authorizations
Your deployment's API key (MMK_API_KEY).
Body
Provide either video_url or video_id.
Full YouTube URL. Use this or video_id.
11-character YouTube video ID. Use this or video_url.
Preferred caption language (ISO code, e.g. en, ko). Falls back to the default track when unavailable.
Output format for content.
xml, json, vtt, srt Include video metadata in the response. Metadata fields require a Pro license.
Was this page helpful?

