GET /v1/youtube/video_transcript

YouTube transcription API: transcripts with timestamps by video ID

This YouTube transcription API returns a video's caption track in one language as full text and as segments with start time and duration in milliseconds, for $0.0005 a call or $0.50 per 1,000 videos. Send video_id and, for a language other than English, language as a code such as ja or pt-BR. It reads captions YouTube already has, auto-generated ones included, and does not transcribe audio, so a video with no track in that language answers 404 no_captions and is not billed.

Price
$0.0005 per call
Batch
Yes, through /v1/batch
Failed calls
Not charged

Example request

curl
curl 'https://api.virev.ai/v1/youtube/video_transcript?video_id=0e3GPea1Tyg' \
  -H "Authorization: Bearer $VIREV_API_KEY"
python
import os
import requests

response = requests.request(
    "GET",
    "https://api.virev.ai/v1/youtube/video_transcript",
    params={
        "video_id": "0e3GPea1Tyg",
    },
    headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())

Parameters

NameInTypeDescription
video_id requiredquerystringAn 11-character video id, or a watch, Shorts, live, embed or youtu.be URL. Example 0e3GPea1Tyg.
language querystringThe language YouTube answers in, a BCP-47 code such as en or pt-BR; omitted is en.
cached queryauto | cache_only | liveauto (default) serves a read saved within the last 24 hours for these exact arguments, otherwise fetches. cache_only never contacts YouTube (404 not_cached when nothing is saved, whatever its age). live always fetches. Anything else is a 400. Default auto.
get_raw querybooleantrue returns the upstream JSON exactly as YouTube answered it instead of the normalized YouTubeTranscript. Default false.

Example response

The example response of the API reference, with lists cut to their first 3 items and long text shortened.

json
{
  "data": {
    "video_id": "0e3GPea1Tyg",
    "language": "en",
    "language_name": "English",
    "text": "- [Mr. Beast] I've recreated every single set from Squid Game in real life, and whichever one of these 456 people survives the longest, wins 456 grand. (contestants cheering) The first game we're gonna play is red light, green light. They h…",
    "segments": [
      {
        "text": "- [Mr. Beast] I've recreated every single set from Squid Game in real life, and whichever one of these 456 people survives the longest, wins 456 grand.",
        "start_ms": 0,
        "duration_ms": 9000
      },
      {
        "text": "(contestants cheering) The first game we're gonna play is red light, green light.",
        "start_ms": 9000,
        "duration_ms": 4000
      }
    ],
    "segments_complete": true
  },
  "meta": {
    "source": "db",
    "fetched_at": "2026-07-21T15:12:06.655918+00:00",
    "cost": "$0.0005",
    "balance": "$3.3557",
    "request_id": "req_e4ceffba450b3f58066a5352f5323298"
  }
}

Response fields

FieldTypeDescription
data.video_idstringThe 11-character video id, also when you sent a URL.
data.languagestringThe code of the track returned, such as en, ja or en-US. It can differ from the code you sent when only a track of the same base language exists.
data.language_namestringYouTube's label for the track, such as English, or Japanese (auto-generated) for a speech-recognition track.
data.textstringThe whole transcript as one string, the segment texts joined by spaces.
data.segments[].textstringThe words of one caption line.
data.segments[].start_msintegerWhen the line starts, in milliseconds from the start of the video. YouTube gives it in whole seconds.
data.segments[].duration_msinteger or nullTime until the next line starts. The last line runs to the end of the video, and it is null when the video length is unknown.
data.segments_completebooleantrue when every segment has a duration_ms.
meta.sourcestringlive when the call read YouTube, db when it served a saved read.
meta.fetched_atstringWhen the transcript was read from YouTube, in ISO 8601 UTC.
meta.coststringWhat this call cost, $0.0005.
meta.balancestringYour balance after the call.
meta.request_idstringThe id of this request, also in the response headers.

Request a caption language

language takes a BCP-47 code such as en, ja, ko or pt-BR, and a call without it asks for en. The call first looks for a track with that exact code, then for any track of the same base language, so pt finds a pt-BR track and en finds an en-US track. data.language names the track it returned. When a video has both an uploaded and an auto-generated track in one language, the call returns the one YouTube lists first, and data.language_name says which.

  • One call returns one language, so request each language you need in its own call.
  • The API does not translate, so a language the video has no track in answers 404 no_captions.
  • No call lists the caption tracks a video has, and the no_captions answer names none, so ask for each language you need and read a 404 as no track in that language.
  • Start times come from YouTube's transcript panel in whole seconds, so start_ms is always a multiple of 1000.

The sample below is a real stored answer for a Japanese video, read from YouTube on 2026-11-19 and cut to the first 2 of its 131 segments, with text shortened. The cached=cache_only in the request serves that stored read and never contacts YouTube.

curl
curl 'https://api.virev.ai/v1/youtube/video_transcript?video_id=kJr98PyRl_k&language=ja&cached=cache_only' \
  -H "Authorization: Bearer $VIREV_API_KEY"
json
{
  "data": {
    "video_id": "kJr98PyRl_k",
    "language": "ja",
    "language_name": "Japanese (auto-generated)",
    "text": "YouTubeで1000回再生されたら いくらもらえると思いますか?こんにちは 、黒です。今回はYouTubeの収益額 と単価を全部大暴露というテーマでお話を していき[音楽]ます。いきなり結論なん ですけども、こういう収益公開の動画って なかなか金額言わないじゃないです。早く 言ってよってイライラしたりする方も いらっしゃると思うんですよね。なので …",
    "segments": [
      {
        "text": "YouTubeで1000回再生されたら いくらもらえると思いますか?こんにちは 、黒です。今回はYouTubeの収益額 と単価を全部大暴露というテーマでお話を",
        "start_ms": 0,
        "duration_ms": 9000
      },
      {
        "text": "していき[音楽]ます。いきなり結論なん ですけども、こういう収益公開の動画って なかなか金額言わないじゃないです。早く 言ってよってイライラしたりする方も いらっしゃると思うんですよね。なので",
        "start_ms": 9000,
        "duration_ms": 8000
      }
    ],
    "segments_complete": true
  },
  "meta": {
    "source": "db",
    "fetched_at": "2026-11-19T15:48:25.639134+00:00",
    "cost": "$0.0005",
    "balance": "$978.2133",
    "request_id": "req_40c21cad57094a305eb0bf899c45a9ad"
  }
}

Timestamps and an SRT file

A segment's duration_ms runs to the start of the next segment, and the last segment runs to the end of the video. So duration_ms is null only on a last segment whose video length is unknown, and segments_complete is then false. The script below writes an SRT subtitle file and gives a segment with no duration 4 seconds.

To read, search or download one transcript as TXT, SRT or WebVTT without code, use the free YouTube transcript tool on virev.ai.

python
import os
import requests

API = "https://api.virev.ai/v1/youtube/video_transcript"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}


def stamp(ms):
    hours, ms = divmod(ms, 3_600_000)
    minutes, ms = divmod(ms, 60_000)
    seconds, ms = divmod(ms, 1000)
    return f"{hours:02}:{minutes:02}:{seconds:02},{ms:03}"


response = requests.get(API, params={"video_id": "0e3GPea1Tyg"}, headers=HEADERS, timeout=60)
response.raise_for_status()
segments = response.json()["data"]["segments"]

with open("0e3GPea1Tyg.srt", "w", encoding="utf-8") as srt:
    for n, seg in enumerate(segments, 1):
        end = seg["start_ms"] + (seg["duration_ms"] or 4000)
        srt.write(f"{n}\n{stamp(seg['start_ms'])} --> {stamp(end)}\n{seg['text']}\n\n")

Videos with no captions

A video with no caption track in the requested language answers 404 with error.code no_captions. A video that does not exist or was removed answers 404 not_found. Neither is billed. The API reads captions only, so a video without a track needs a speech-to-text service that transcribes its audio.

python
import os
import requests

response = requests.get(
    "https://api.virev.ai/v1/youtube/video_transcript",
    params={"video_id": "0e3GPea1Tyg", "language": "de"},
    headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
    timeout=60,
)
if response.status_code == 404:
    print(response.json()["error"]["code"])
else:
    response.raise_for_status()
    print(response.json()["data"]["language_name"])

Bulk transcripts through batch

POST /v1/batch/trigger with operation=youtube.video_transcript takes up to 10,000 rows, each the query you would send to this endpoint, such as {"video_id": "kJr98PyRl_k", "language": "ja"}. Starting a job is free. Your balance must cover rows times $0.0005, which is $5.00 for 10,000 rows, and a row is billed only when it returns a transcript.

  • Poll GET /v1/batch/progress/{snapshot_id} until status is ready, failed or canceled.
  • Download GET /v1/batch/snapshot/{snapshot_id} as NDJSON, JSON or CSV, where each row carries its input beside data.
  • With include_errors=true, a video with no captions comes back as a row with input and error instead of being dropped.
  • In CSV, data.segments is one JSON-encoded cell, so pick NDJSON when you need the timestamps.
  • An organization runs at most 5 batch jobs at once.
python
import json
import os
import time
import requests

BASE = "https://api.virev.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"}
rows = [
    {"video_id": "0e3GPea1Tyg"},
    {"video_id": "kJr98PyRl_k", "language": "ja"},
]

job = requests.post(
    f"{BASE}/v1/batch/trigger",
    params={"operation": "youtube.video_transcript", "format": "ndjson", "include_errors": "true"},
    json=rows,
    headers=HEADERS,
    timeout=60,
).json()["data"]

while True:
    progress = requests.get(f"{BASE}/v1/batch/progress/{job['snapshot_id']}", headers=HEADERS, timeout=60).json()["data"]
    if progress["status"] in ("ready", "failed", "canceled"):
        break
    time.sleep(5)

download = requests.get(f"{BASE}/v1/batch/snapshot/{job['snapshot_id']}", headers=HEADERS, timeout=300)
for line in download.text.splitlines():
    row = json.loads(line)
    if "error" in row:
        print(row["input"]["video_id"], row["error"]["code"])
    else:
        print(row["input"]["video_id"], row["data"]["language"], len(row["data"]["segments"]))

youtube-transcript-api, the YouTube Data API or this API

youtube-transcript-api is a free, MIT-licensed Python library that reads the same caption tracks from your own machine. It takes a list of languages in priority order, can translate a track through YouTube, and formats output as JSON, text, SRT or WebVTT. Its README sample gives start and duration in fractions of a second, such as 1.54, while start_ms here comes in whole seconds. This API returns one language per call, does not translate, and answers JSON with the plain text in data.text. The SRT script above converts it, and a video's title and counts come from the YouTube video details API. The library's README says YouTube blocks most IPs of cloud providers such as AWS, Google Cloud and Azure with RequestBlocked or IpBlocked, and it recommends rotating residential proxies for code that runs there.

  • The library costs nothing per call, and you run and pay for any proxies yourself.
  • This API costs $0.0005 a call, needs only an HTTPS request with a key, and does not bill a failed call.
  • Both read existing captions, and neither transcribes audio.

YouTube's own Data API has a captions.download method, but it needs OAuth with the youtube.force-ssl or youtubepartner scope and permission to edit the video, and each call costs 200 quota units. It downloads captions of videos your account can edit, not of any public video.

How it works

The video's caption track in one language as timed segments and text. This reads captions YouTube already has; it does not transcribe. A video with no track in that language answers 404 no_captions and is not billed. Returns YouTubeTranscript under data; with get_raw=true returns the upstream JSON.

A field YouTube does not carry is null, a list it does not carry is [], and YouTube-only facts sit under extra. Unknown, unsupported, and repeated query parameters return 400 before acquisition or billing.

Errors

StatusWhen
400The request parameters are invalid.
401Missing, malformed, or revoked API key.
402Balance is too low for this request.
404cached=cache_only found nothing saved for these arguments (not_cached; call again with cached=auto to fetch it), or the YouTube account or item does not exist (not_found). You are not charged.
429Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged.
502The upstream fetch failed. You are not charged.
503Billing could not be confirmed, so no upstream data was returned.
504The upstream request timed out. You are not charged.

Frequently asked questions

Does this YouTube transcription API transcribe audio?

No. It reads the caption tracks YouTube already has, uploaded and auto-generated alike, and returns them as text and timed segments. A video with no track in the requested language answers 404 no_captions and is not billed, so a video without captions needs a speech-to-text service.

How much does a YouTube transcript cost through the API?

$0.0005 per call, so 1,000 transcripts cost $0.50 and 10,000 cost $5.00. Batch jobs charge the same per row. A 404 or any other failed call is not billed.

Which languages can I get a transcript in?

Any language the video has a caption track in. Send language as a BCP-47 code such as en, ja or pt-BR, and a call without it asks for en. An exact code wins first, then any track of the same base language. The API does not translate.

How is this different from the youtube-transcript-api Python library?

The library is free and runs on your own machine, and its README says YouTube blocks most cloud provider IPs, so code on a server needs rotating residential proxies. It also translates tracks, takes a language priority list and gives start times in fractions of a second, where this API gives whole seconds. This API is one HTTPS call at $0.0005 with no proxies to run, and it returns one language per call.

Can the official YouTube Data API download captions?

Its captions.download method needs OAuth with the youtube.force-ssl or youtubepartner scope and permission to edit the video, and each call costs 200 quota units. So it downloads captions only of videos your account can edit.

Can I get transcripts for many videos at once?

Yes. POST /v1/batch/trigger with operation=youtube.video_transcript takes up to 10,000 rows, each a video_id with an optional language, and bills $0.0005 for each row that returns a transcript.

Guides that use this endpoint