Description

This endpoint extracts the transcript from a specified YouTube video URL, formats the transcript, and optionally includes timestamps.

Endpoint

POST /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. Default: "en".
}

Accepted Values for preferredLanguage

The preferredLanguage parameter accepts the following language codes:

Language CodeLanguage
afAfrikaans
akAkan
sqAlbanian
amAmharic
arArabic
hyArmenian
asAssamese
ayAymara
azAzerbaijani
bnBangla
euBasque
beBelarusian
bhoBhojpuri
bsBosnian
bgBulgarian
myBurmese
caCatalan
cebCebuano
zhChinese
zh-HKChinese (Hong Kong)
zh-CNChinese (China)
zh-SGChinese (Singapore)
zh-TWChinese (Taiwan)
zh-HansChinese (Simplified)
zh-HantChinese (Traditional)
hak-TWHakka Chinese (Taiwan)
nan-TWMin Nan Chinese (Taiwan)
coCorsican
hrCroatian
csCzech
daDanish
dvDivehi
nlDutch
enEnglish
en-USEnglish (United States)
eoEsperanto
etEstonian
eeEwe
filFilipino
fiFinnish
frFrench
glGalician
lgGanda
kaGeorgian
deGerman
elGreek
gnGuarani
guGujarati
htHaitian Creole
haHausa
hawHawaiian
iwHebrew
hiHindi
hmnHmong
huHungarian
isIcelandic
igIgbo
idIndonesian
gaIrish
itItalian
jaJapanese
jvJavanese
knKannada
kkKazakh
kmKhmer
rwKinyarwanda
koKorean
kriKrio
kuKurdish
kyKyrgyz
loLao
laLatin
lvLatvian
lnLingala
ltLithuanian
lbLuxembourgish
mkMacedonian
mgMalagasy
msMalay
mlMalayalam
mtMaltese
miMāori
mrMarathi
mnMongolian
neNepali
nsoNorthern Sotho
noNorwegian
nyNyanja
orOdia
omOromo
psPashto
faPersian
plPolish
ptPortuguese
paPunjabi
quQuechua
roRomanian
ruRussian
smSamoan
saSanskrit
gdScottish Gaelic
srSerbian
snShona
sdSindhi
siSinhala
skSlovak
slSlovenian
soSomali
stSouthern Sotho
esSpanish
suSundanese
swSwahili
svSwedish
tgTajik
taTamil
ttTatar
teTelugu
thThai
tiTigrinya
tsTsonga
trTurkish
tkTurkmen
ukUkrainian
urUrdu
ugUyghur
uzUzbek
viVietnamese
cyWelsh
fyWestern Frisian
xhXhosa
yiYiddish
yoYoruba
zuZulu

Responses

Success (200)

Returns the transcript of the specified YouTube video and the detected language.

{
  "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" \
-H "Request-Source: API" \
-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 videoUrl parameter must be a valid YouTube video URL.
  • If includeTimestamps is set to false, the transcript will not include timestamp information.
  • The timestampsToCombine parameter determines how many individual transcript segments are combined into a single line with a timestamp.
  • The preferredLanguage parameter allows you to specify the desired language for the transcript. If not available, it will default to the first available language.
  • This endpoint uses 2 credit 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.