Get YouTube transcript
curl --request POST \
--url https://app.dumplingai.com/api/v1/get-youtube-transcript \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"videoUrl": "<string>",
"preferredLanguage": "<string>",
"includeTimestamps": true,
"timestampsToCombine": 2
}
'import requests
url = "https://app.dumplingai.com/api/v1/get-youtube-transcript"
payload = {
"videoUrl": "<string>",
"preferredLanguage": "<string>",
"includeTimestamps": True,
"timestampsToCombine": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoUrl: '<string>',
preferredLanguage: '<string>',
includeTimestamps: true,
timestampsToCombine: 2
})
};
fetch('https://app.dumplingai.com/api/v1/get-youtube-transcript', 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://app.dumplingai.com/api/v1/get-youtube-transcript",
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([
'videoUrl' => '<string>',
'preferredLanguage' => '<string>',
'includeTimestamps' => true,
'timestampsToCombine' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.dumplingai.com/api/v1/get-youtube-transcript"
payload := strings.NewReader("{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.dumplingai.com/api/v1/get-youtube-transcript")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/get-youtube-transcript")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}"
response = http.request(request)
puts response.read_body{
"language": "<string>",
"transcript": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Data APIs
Get YouTube Transcript
Retrieve transcript segments for a YouTube video using DumplingAI’s transcript service. If the requested preferred language is unavailable but captions exist in another language, the first available transcript is returned instead.
POST
/
api
/
v1
/
get-youtube-transcript
Get YouTube transcript
curl --request POST \
--url https://app.dumplingai.com/api/v1/get-youtube-transcript \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"videoUrl": "<string>",
"preferredLanguage": "<string>",
"includeTimestamps": true,
"timestampsToCombine": 2
}
'import requests
url = "https://app.dumplingai.com/api/v1/get-youtube-transcript"
payload = {
"videoUrl": "<string>",
"preferredLanguage": "<string>",
"includeTimestamps": True,
"timestampsToCombine": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoUrl: '<string>',
preferredLanguage: '<string>',
includeTimestamps: true,
timestampsToCombine: 2
})
};
fetch('https://app.dumplingai.com/api/v1/get-youtube-transcript', 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://app.dumplingai.com/api/v1/get-youtube-transcript",
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([
'videoUrl' => '<string>',
'preferredLanguage' => '<string>',
'includeTimestamps' => true,
'timestampsToCombine' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.dumplingai.com/api/v1/get-youtube-transcript"
payload := strings.NewReader("{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.dumplingai.com/api/v1/get-youtube-transcript")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/get-youtube-transcript")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoUrl\": \"<string>\",\n \"preferredLanguage\": \"<string>\",\n \"includeTimestamps\": true,\n \"timestampsToCombine\": 2\n}"
response = http.request(request)
puts response.read_body{
"language": "<string>",
"transcript": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Description
This endpoint extracts the transcript from a specified YouTube video URL, formats the transcript, and optionally includes timestamps.Endpoint
POST https://app.dumplingai.com/api/v1/get-youtube-transcript
Headers
- Content-Type:
application/json - Authorization: Bearer
<API_KEY>(required)
Request Body
{
"videoUrl": "string", // Required. The URL of the YouTube video.
"includeTimestamps": "boolean", // Optional. Whether to include timestamps in the transcript. Default: true.
"timestampsToCombine": "number", // Optional. The number of timestamps to combine in the transcript. Default: 5.
"preferredLanguage": "string" // Optional. Preferred language for the transcript.
}
Accepted Values for preferredLanguage
The preferredLanguage parameter accepts the following language codes:
| Language Code | Language |
|---|---|
| af | Afrikaans |
| ak | Akan |
| sq | Albanian |
| am | Amharic |
| ar | Arabic |
| hy | Armenian |
| as | Assamese |
| ay | Aymara |
| az | Azerbaijani |
| bn | Bangla |
| eu | Basque |
| be | Belarusian |
| bho | Bhojpuri |
| bs | Bosnian |
| bg | Bulgarian |
| my | Burmese |
| ca | Catalan |
| ceb | Cebuano |
| zh | Chinese |
| zh-HK | Chinese (Hong Kong) |
| zh-CN | Chinese (China) |
| zh-SG | Chinese (Singapore) |
| zh-TW | Chinese (Taiwan) |
| zh-Hans | Chinese (Simplified) |
| zh-Hant | Chinese (Traditional) |
| hak-TW | Hakka Chinese (Taiwan) |
| nan-TW | Min Nan Chinese (Taiwan) |
| co | Corsican |
| hr | Croatian |
| cs | Czech |
| da | Danish |
| dv | Divehi |
| nl | Dutch |
| en | English |
| en-US | English (United States) |
| eo | Esperanto |
| et | Estonian |
| ee | Ewe |
| fil | Filipino |
| fi | Finnish |
| fr | French |
| gl | Galician |
| lg | Ganda |
| ka | Georgian |
| de | German |
| el | Greek |
| gn | Guarani |
| gu | Gujarati |
| ht | Haitian Creole |
| ha | Hausa |
| haw | Hawaiian |
| iw | Hebrew |
| hi | Hindi |
| hmn | Hmong |
| hu | Hungarian |
| is | Icelandic |
| ig | Igbo |
| id | Indonesian |
| ga | Irish |
| it | Italian |
| ja | Japanese |
| jv | Javanese |
| kn | Kannada |
| kk | Kazakh |
| km | Khmer |
| rw | Kinyarwanda |
| ko | Korean |
| kri | Krio |
| ku | Kurdish |
| ky | Kyrgyz |
| lo | Lao |
| la | Latin |
| lv | Latvian |
| ln | Lingala |
| lt | Lithuanian |
| lb | Luxembourgish |
| mk | Macedonian |
| mg | Malagasy |
| ms | Malay |
| ml | Malayalam |
| mt | Maltese |
| mi | Māori |
| mr | Marathi |
| mn | Mongolian |
| ne | Nepali |
| nso | Northern Sotho |
| no | Norwegian |
| ny | Nyanja |
| or | Odia |
| om | Oromo |
| ps | Pashto |
| fa | Persian |
| pl | Polish |
| pt | Portuguese |
| pa | Punjabi |
| qu | Quechua |
| ro | Romanian |
| ru | Russian |
| sm | Samoan |
| sa | Sanskrit |
| gd | Scottish Gaelic |
| sr | Serbian |
| sn | Shona |
| sd | Sindhi |
| si | Sinhala |
| sk | Slovak |
| sl | Slovenian |
| so | Somali |
| st | Southern Sotho |
| es | Spanish |
| su | Sundanese |
| sw | Swahili |
| sv | Swedish |
| tg | Tajik |
| ta | Tamil |
| tt | Tatar |
| te | Telugu |
| th | Thai |
| ti | Tigrinya |
| ts | Tsonga |
| tr | Turkish |
| tk | Turkmen |
| uk | Ukrainian |
| ur | Urdu |
| ug | Uyghur |
| uz | Uzbek |
| vi | Vietnamese |
| cy | Welsh |
| fy | Western Frisian |
| xh | Xhosa |
| yi | Yiddish |
| yo | Yoruba |
| zu | Zulu |
Responses
Success (200)
Returns the transcript of the specified YouTube video and the language that was actually returned.{
"transcript": "string",
"language": "string"
}
- Content-Type: application/json
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid or missing required parameters.{
"error": "Error message describing the issue"
}
Not Found (404)
Returned if no subtitles are found for the video.{
"error": "No subtitles found for the video: <videoID>"
}
Internal Server Error (500)
Returned if there’s an error during the transcript extraction process.{
"error": "Error message describing the issue"
}
Example Request
curl -X POST https://app.dumplingai.com/api/v1/get-youtube-transcript \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"videoUrl": "https://www.youtube.com/watch?v=example",
"includeTimestamps": true,
"timestampsToCombine": 5,
"preferredLanguage": "en"
}'
Example Response
{
"transcript": "00:00 - Welcome to this video.\n00:05 - Today we'll be discussing...",
"language": "en"
}
Notes
- The
videoUrlparameter must be a valid YouTube video URL. - If
includeTimestampsis set tofalse, the transcript will not include timestamp information. - The
timestampsToCombineparameter determines how many individual transcript segments are combined into a single line with a timestamp. - The
preferredLanguageparameter allows you to request a specific transcript language. - If the requested
preferredLanguageis not available but the video has captions in another language, the endpoint will automatically fall back to the first available transcript instead of failing. - The
languagefield in the response always reflects the transcript language that was actually returned, which may differ frompreferredLanguage. - This endpoint uses 20 credits per request.
- The transcript extraction attempts to retrieve the captions of a YouTube video. Some videos have captions disabled, this action will fail on these videos.
Rate Limiting
Rate limit headers (X-RateLimit-Limit and X-RateLimit-Remaining) are included in the response to indicate the user’s current rate limit status.Authorizations
Body
application/json