Docs · Video transcript
Video transcript
What's said in a video or Short: its captions as timed segments and as one block of text.
https://api.lurkapi.com/v1/youtube/video/transcriptWhen to use this
Use it to turn a video into text for summaries, search, research or repurposing. It reads the video's captions: the creator's own or YouTube's auto-generated ones (isGenerated tells them apart).
Pick a language with language (e.g. es); without it you get English when the video has it, else the video's main language. availableLanguages lists every caption track. YouTube's machine translation isn't available, so a language the video has no captions in returns 404.
Videos without captions, and private or removed ones, return 404 not_found.
Parameters
All parameters go in the query string.
| Parameter | Description |
|---|---|
urlstringrequired | The video's URL (watch, youtu.be, /shorts/, /live/ or /embed/ links all work) or its 11-character id, e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ.
|
languagestringoptional | Language code, e.g. en, es or pt-BR. pt also matches pt-BR. Default: English if the video has it, else its main language. |
Example request
Replace YOUR_API_KEY with your key, or set LURKAPI_KEY for the code. Get a free key.
curl "https://api.lurkapi.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ" \
-H "x-api-key: YOUR_API_KEY"const params = new URLSearchParams({
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
});
const res = await fetch(`https://api.lurkapi.com/v1/youtube/video/transcript?${params}`, {
headers: { "x-api-key": process.env.LURKAPI_KEY },
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.error}`);
console.log(data.transcript);import os
import requests
res = requests.get(
"https://api.lurkapi.com/v1/youtube/video/transcript",
params={
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
},
headers={"x-api-key": os.environ["LURKAPI_KEY"]},
timeout=60,
)
data = res.json()
if not data["success"]:
raise RuntimeError(f"{data['code']}: {data['error']}")
print(data["transcript"])Example response
A real response from this endpoint, captured from the live API and trimmed to a couple of items. Strings over 96 characters (mostly signed media URLs) are cut short and end in ….
Show the example response (2 KB)Hide
{
"success": true,
"credits_remaining": 999983,
"credits_charged": 1,
"videoId": "dQw4w9WgXcQ",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"language": "English",
"languageCode": "en",
"isGenerated": false,
"transcript": [
{
"text": "♪ We're no strangers to love ♪",
"startMs": 18640,
"endMs": 21880,
"startTimeText": "0:18"
},
{
"text": "♪ You know the rules and so do I ♪",
"startMs": 22640,
"endMs": 26960,
"startTimeText": "0:22"
}
],
"transcript_only_text": "♪ We're no strangers to love ♪ ♪ You know the rules and so do I ♪",
"availableLanguages": [
{
"code": "en",
"name": "English",
"isGenerated": false
},
{
"code": "en",
"name": "English",
"isGenerated": true
},
{
"code": "de-DE",
"name": "German (Germany)",
"isGenerated": false
},
{
"code": "ja",
"name": "Japanese",
"isGenerated": false
},
{
"code": "pt-BR",
"name": "Portuguese (Brazil)",
"isGenerated": false
},
{
"code": "es-419",
"name": "Spanish (Latin America)",
"isGenerated": false
}
]
}Response fields
Every field of a successful response. [] marks a list: a[].b is the b of each item in a. nullable fields can be null; optional fields can be missing.
Show all 18 fieldsHide
| Field | Type | Description |
|---|---|---|
| success | true | Always true here; errors have success: false. |
| credits_remaining | number | Your balance after this call. On anonymous playground calls: free tries left today. |
| credits_charged | number | Credits this call cost; 0 on free endpoints. On anonymous playground calls: tries used (1). |
| videoId | string | Video id. |
| url | string | Link to the video. |
| language | string | Language of the transcript, e.g. "English". |
| languageCode | string | Its code as YouTube names the track, e.g. en or pt-BR. |
| isGenerated | boolean | Auto-generated by YouTube's speech recognition, rather than captions the creator uploaded. |
| transcript | object[] | Timed segments, in order. |
| transcript[].text | string | What's said in this segment. |
| transcript[].startMs | number | Segment start, ms from the start of the video. |
| transcript[].endMs | number | Segment end, ms; never past the next segment's start. |
| transcript[].startTimeText | string | Segment start as a timestamp, e.g. "1:23". |
| transcript_only_text | string | The whole transcript as one string, without timestamps. |
| availableLanguages | object[] | Every caption track the video has. |
| availableLanguages[].code | string | Language code; pass it as language. |
| availableLanguages[].name | string | Language name, e.g. "English". |
| availableLanguages[].isGenerated | boolean | Auto-generated rather than uploaded by the creator. |
Caching and freshness
Responses are cached for up to 30 days, so a repeat call within that window can return the same data. It still costs 1 credit.
Errors
Errors return { success: false, error, code, docs } with the HTTP status below. Validation errors, 401/402/429 rejections and 5xx failures are free; not_found is charged (how charging works). All error codes.
| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key | No API key. Send it in the x-api-key header. |
| 401 | invalid_api_key | The key is unknown or was revoked. |
| 402 | insufficient_credits | Not enough credits for this call. Buy a pack or wait for tomorrow's top-up. |
| 404 | not_found | The endpoint, or the thing you asked for (ad, post, subreddit), doesn't exist. Charged when the platform was checked. |
| 405 | method_not_allowed | Endpoints take GET with query params. |
| 429 | rate_limited | Too many calls at once. Wait for the retry-after seconds, then retry. |
| 500 | internal_error | Something broke on our side. Retry; 5xx errors are free. |
| 502 | upstream_error | The platform didn't give a usable answer. Retry; 5xx errors are free. |
| 503 | upstream_busy | All our connections to the platform are busy. Retry in a few seconds; 5xx errors are free. |
| 504 | upstream_timeout | The platform took over 30 seconds to answer. Retry; timeouts are free. |
Use it in Claude
Once LurkAPI is connected to Claude, this endpoint is the youtube_transcript tool. Ask in plain English, for example:
Use LurkAPI's youtube_transcript with url "https://www.youtube.com/watch?v=dQw4w9WgXcQ" and summarize what you find.Claude calls youtube_transcript with arguments like these, and each call costs 1 credit:
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}Tool results skip nulls and empty lists to save tokens.