API · YouTube
GET /youtube/videos/{id}/subtitles
A YouTube video’s captions as a subtitle file: srt, vtt, ttml, json3 or srv1.
| |
|---|
| Request | GET /v1/youtube/videos/{id}/subtitles |
| Operation id | youtube.video.subtitles |
| Cost | 2 credits, refunded if the call fails |
| Auth | API key: Authorization: Bearer <key> or x-api-key. |
A YouTube video’s captions as a subtitle file: srt, vtt, ttml, json3 or srv1.
| Name | Type | Required | Description |
|---|
id | string | yes | A video or Short id, or any URL of it (watch, youtu.be, shorts, live, embed). Example: dQw4w9WgXcQ. |
| Name | Type | Required | Description |
|---|
format | "srt" | "vtt" | "ttml" | "json3" | "srv1" | no | srt (default), vtt, ttml, json3 or srv1. One of srt, vtt, ttml, json3, srv1. |
language | string | no | ISO 639-1 language code (en, es, pt-BR). Example: en. |
| Status | Meaning | Schema |
|---|
200 | The subtitle file. | YouTubeSubtitles |
400 | Invalid input. Nothing was charged. | Error |
401 | Missing or invalid API key. | Error |
402 | Not enough credits, a spend cap was reached, or payment is required. | Error |
403 | The target is private, or the account is suspended. | Error |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. | Error |
429 | Too many requests. Wait for Retry-After seconds. | Error |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. | Error |
| Field | Type | Description |
|---|
kind | "youtube#subtitles" | |
videoId | string | |
languageCode | string | |
isAutoGenerated | boolean | |
isTranslated | boolean | |
format | "srt" | "vtt" | "ttml" | "json3" | "srv1" | |
content | string | The subtitle file, in format. |
availableLanguages | YouTubeCaptionTrack[] | |
Errors use one shape everywhere; see Errors for every code and what to do.