curl
curl "https://api.scority.ai/v1/youtube/transcript?video_id=dQw4w9WgXcQ&language=en" \
-H "x-api-key: YOUR_API_KEY"Learn how to fetch YouTube transcripts and captions with an API, handle errors, choose languages and use transcript data in AI workflows.
A YouTube Transcript API returns machine-readable transcript text and timestamped segments for public YouTube videos that have accessible captions. Scority focuses on that transcript contract instead of downloads, uploads, channel analytics or player embeds.
The Scority endpoint accepts either video_id or video_url. Send exactly one. You can also request a caption language with language or lang.
Use the x-api-key header from trusted server-side code. Do not put API keys in frontend bundles or browser-only apps.
A successful response returns the selected language, transcript source, full text and timestamped segments.
curl "https://api.scority.ai/v1/youtube/transcript?video_id=dQw4w9WgXcQ&language=en" \
-H "x-api-key: YOUR_API_KEY"const url = new URL("https://api.scority.ai/v1/youtube/transcript")
url.searchParams.set("video_id", "dQw4w9WgXcQ")
url.searchParams.set("language", "en")
const response = await fetch(url, {
headers: {
"x-api-key": process.env.SCORITY_API_KEY
}
})
if (!response.ok) {
const error = await response.json()
throw new Error(error.error?.code ?? "transcript_request_failed")
}
const transcript = await response.json()import os
import requests
response = requests.get(
"https://api.scority.ai/v1/youtube/transcript",
params={"video_id": "dQw4w9WgXcQ", "language": "en"},
headers={"x-api-key": os.environ["SCORITY_API_KEY"]},
timeout=30,
)
if not response.ok:
code = response.json().get("error", {}).get("code")
raise RuntimeError(code or "transcript_request_failed")
transcript = response.json()Transcript availability depends on the video and its caption tracks. Your integration should treat errors as part of the normal API contract.
Transcript APIs are useful when video speech needs to become structured text for automated processing.
Scority works with many public YouTube videos and has fallback infrastructure for harder cases, but some videos may still return transcript_not_available or upstream_transcript_failed. Do not design clients around a promise that every video will resolve.