# Transcripts & captions

Read the caption track of a connected channel's own video to get its transcript.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

To transcribe a YouTube video, read the caption track YouTube already holds for it. Do not download the file and run your own transcription.

Call `GET /v1/accounts/{accountId}/youtube-captions` with `videoId` ([Get a YouTube video transcript](/connect/get-youtube-captions)), for one of the connected channel's own videos.

Auto-generated (ASR) tracks count. YouTube serves them to the channel owner, which is what the connected account is.

An uploaded track wins over an auto-generated one for the same language.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: transcript } = await zernio.connect.getYoutubeCaptions({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' },
  query: { videoId: 'dQw4w9WgXcQ', language: 'en' }
});

console.log(transcript.text);
```
</Tab>
<Tab value="Python">
```python
transcript = client.connect.get_youtube_captions(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    video_id="dQw4w9WgXcQ",
    language="en"
)

print(transcript["text"])
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/youtube-captions?videoId=dQw4w9WgXcQ&language=en" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), trimmed:

```json
{
  "videoId": "dQw4w9WgXcQ",
  "language": "en",
  "trackKind": "asr",
  "source": "cache",
  "fetchedAt": "2026-08-27T21:09:54.000Z",
  "text": "Hey, this is Mickey. I'm the founder of this portfolio of three websites.",
  "cues": [
    { "start": 1.6, "end": 8.88, "text": "Hey, this is Mickey. I'm the founder of" }
  ]
}
```

`format=srt` returns the raw SubRip body in `srt` instead of `cues`. `text` is there either way.

**Quota.** The first read downloads from YouTube and costs 200 quota units. Zernio stores the result, so `source` reads `youtube` once and `cache` afterwards.

Pass `refresh=true` only when the captions changed on YouTube, since that spends the quota again.

`availableTracks` lists every track on the video, so you can request another language.

**`404`.** Only videos owned by the connected channel are readable; anything else is a `404`. A video with no track in the requested language is also a `404`, with `code: "captions_not_found"`.

YouTube generates auto-captions only for videos with recognizable speech. It can take a few hours after upload to publish them, so treat that `404` as "not yet" rather than "never".

`contentDetails.caption` in YouTube's own API reads `false` on videos that do have a serving auto-generated track. It is not a usable availability signal.