# YouTube transcript: `POST /v1/youtube/transcript`

Cost: 2 credits (2 (an empty answer, an unknown or private video, and failed requests are free)). Docs: https://scrapercompany.com/docs/reference/youtube-transcript

One caption track as `segments` (`start_s`, `duration_s`, `text`)
plus the joined `text`, and `available_languages` (code, name, `kind`
`manual` or `asr` for auto-generated, `translatable`).

`lang` picks the
track (creator captions over auto-generated; omit for English, else
YouTube's default). Entities are decoded, line breaks become spaces,
empty cues are dropped. A video without captions, or without a track in
`lang`, is a 404 (not charged); an age-gated video is a 404 that says
so. Machine translation (`tlang`) is not offered: YouTube answered it
with HTTP 429 on every measured attempt.

Request body (JSON):

- `video_id` (string; required; min length 11, max length 300): The 11-character video id (`8jPQjjsBbIc`) or any YouTube video URL: `watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`. Ids come from `POST /v1/youtube/search` (`videos[].video_id`).
- `lang` (string | null; optional; min length 2, max length 20, pattern ^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$): Caption language code (`en`, `pt-BR`). Creator captions win over auto-generated ones; `en` also matches `en-GB`. Omit for English when the video has it, else YouTube's default track. A language the video has no track in is a 404 that lists the ones it has.
- `hl` (string; optional; default en; pattern ^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,4})?$): Interface language YouTube localizes texts in (`hl`): relative dates, view-count wording, caption track names. Counts parse to integers only for English-style numbers.
- `gl` (string; optional; default US; pattern ^[A-Za-z]{2}$): Content country (`gl`), two letters.

Base URL: `https://api.scrapercompany.com`. Auth: send your key in the `x-api-key` header. A failed request (4xx or 5xx) or an empty result costs 0 credits.

- [Full API reference as one Markdown file](https://scrapercompany.com/llms-full.txt)
- [OpenAPI spec](https://scrapercompany.com/openapi.json)
