YouTube video transcript API
The video's own captions: the language you ask for.
- Cost
- 1 creditAI transcription is billed by the started minute after 2
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
Or the original audio's, typed by the uploader or recognised by YouTube (source), with the languages on offer. A video without captions answers transcript_unavailable and costs nothing; AI transcription of YouTube audio is not available yet.
You send one of url or id.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/youtube/video/transcript" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'id=dQw4w9WgXcQ' \
--data-urlencode 'language=de'import os
import requests
params = {
"id": "dQw4w9WgXcQ",
"language": "de",
}
res = requests.get(
"https://api.socialscrape.io/v1/youtube/video/transcript",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/youtube/video/transcript");
url.search = new URLSearchParams({
id: "dQw4w9WgXcQ",
language: "de",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape YouTube video transcript",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/youtube/video/transcript",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "id",
"value": "dQw4w9WgXcQ"
},
{
"name": "language",
"value": "de"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | url | one of | Video or Short URL (watch, youtu.be, shorts, live, embed). |
id | string | one of | 11-character video id. Also accepted as videoId, video_id. |
language | string | Language code ("en", "es", "en-US"). Overrides the default track unless `original_audio` is set. Also accepted as lang. | |
original_audio | boolean | Only return captions in the video's original spoken language. Takes precedence over `language`. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_e45a821caf0eddcb356f1b98",
"data": {
"object": "transcript",
"platform": "youtube",
"video_id": "dQw4w9WgXcQ",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"language": "de-DE",
"source": "captions",
"duration_seconds": 213,
"text": "Uns beiden ist die Liebe nicht fremd Du kennst die Regeln genau wie ich Für mich zählst nur du Das kriegst du sonst von keinem hier Ich will dir sagen, wie i...",
"segments": [
{
"start": 18.64,
"end": 21.880000000000003,
"text": "Uns beiden ist die Liebe nicht fremd"
},
{
"start": 22.64,
"end": 26.96,
"text": "Du kennst die Regeln genau wie ich"
},
{
"start": 27.04,
"end": 31.04,
"text": "Für mich zählst nur du"
}
],
"available_languages": [
"de-DE",
"en",
"es-419"
],
"extra": {
"language_name": "German (Germany)",
"tracks": [
{
"auto": false,
"code": "en",
"name": "English"
},
{
"auto": true,
"code": "en",
"name": "English (auto-generated)"
},
{
"auto": false,
"code": "de-DE",
"name": "German (Germany)"
}
]
}
},
"cursor": null,
"has_more": null
}Fields
One Transcript in data.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "transcript" | ||
platform | Platform | yes | |
video_id | string or null | ||
url | string or null | ||
language | string or null | BCP 47, "en" | |
source | "captions" or "auto_captions" or "ai" | yes | |
duration_seconds | number or null | ||
text | string | yes | |
segments | TranscriptSegment[] or null | ||
available_languages | string[] or null | ||
extra | object or null |
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), unsupported_url (do not retry), not_found (do not retry), transcript_unavailable (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
Is there an SDK call for it?
The preview Python client has client.youtube.video_transcript(...) and the TypeScript client client.youtube.videoTranscript(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.