YouTube Video Captions

Retrieve available caption tracks for a YouTube video or request captions in SRT, XML, JSON3, or plain-text format. Use it to support transcription, accessibility, localization, or text analysis.

GET /v1/youtube/get_video_captions_v1 $0.02
Price
$0.02 per successful call, Failed calls are free
Endpoint ID
youtube.get_video_captions_v1

Parameters

  • video_id string Required

    The unique identifier for a YouTube video.

    ExampledQw4w9WgXcQ

  • language_code string Optional

    Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.

    Exampleen

  • format string Optional

    Caption output format.

    Available Values:

    • srt: SubRip caption format with timeline cues
    • xml: Original XML caption format
    • json3: YouTube original JSON caption structure
    • txt: Plain text without timeline cues

    Examplesrt

Code samples

curl -G "https://api.mofa-ai.com/v1/youtube/get_video_captions_v1" \
  -H "Authorization: Bearer $MOFA_API_KEY" \
  --data-urlencode 'video_id=dQw4w9WgXcQ' \
  --data-urlencode 'language_code=en' \
  --data-urlencode 'format=srt'

Example response

Request parameters {"format": "srt", "video_id": "dQw4w9WgXcQ", "language_code": "en"}

JSON Captured 2026-11-08, took 4163 ms
{
  "success": true,
  "code": 0,
  "message": "success",
  "request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
  "endpoint": "youtube.get_video_captions_v1",
  "cost_usd": 0.02,
  "data": {
    "code": 0,
    "data": {
      "format": "srt",
      "content": "1\n00:00:01,360 --> 00:00:03,040\n[♪♪♪]\n\n2\n00:00:18,640 --> 00:00:21,880\n♪ We're no strangers to love ♪\n\n3\n00:00:22,640 --> 00:00:26,960\n♪ You know the rules and so do I ♪\n\n4\n00:00:27,040 --> 00:00:31,0…",
      "video_id": "dQw4w9WgXcQ",
      "language_code": "en",
      "language_name": "English"
    },
    "message": null,
    "requestId": "9d20ad2945904a748f48fdfae13022fc",
    "recordTime": "2026-11-08T08:00:12.224319946",
    "requestParams": {
      "body": null,
      "query": {
        "format": "srt",
        "videoId": "dQw4w9WgXcQ",
        "languageCode": "en"
      }
    }
  }
}

Try it

Sign in to call this endpoint from this page. Successful calls are billed to your balance, failed calls are free, and new accounts get $0.50 of trial credit.

Sign in to try

More YouTube endpoints

  • General Search

    $0.02

    Search YouTube by keyword with optional type, upload-date, duration, feature, and sort filters, or continue with a token. Use it to discover videos, channels…

    /v1/youtube/search_v1

  • Video Details

    $0.02

    Retrieve public details for a YouTube video identified by video ID. Use it to inspect a known video before further content or comment analysis.

    /v1/youtube/get_video_detail_v1

  • Channel Videos

    $0.02

    Retrieve public videos from a YouTube channel, with optional cursor-based pagination. Use it to browse a channel's uploads and continue through additional re…

    /v1/youtube/get_channel_videos_v1

  • Channel Shorts

    $0.02

    Retrieve public Shorts from a YouTube channel ID with optional continuation-token pagination. Use it to browse a channel's short-form videos and continue thr…

    /v1/youtube/get_channel_shorts_v1

  • Video Comment List

    $0.02

    Retrieve first-level comments for a YouTube video with sorting, locale options, and cursor pagination. Use it to review audience discussion or continue throu…

    /v1/youtube/get_video_comment_v1

  • Video Sub Comment List

    $0.02

    Retrieve replies associated with a YouTube comment continuation cursor, with optional locale settings. Use it to follow threaded discussion beyond first-leve…

    /v1/youtube/get_video_sub_comment_v1

↑↓ to move, Enter to open, Esc to close