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.

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

Parameters

Name Required Type Description Example Allowed values
video_id Required string The unique identifier for a YouTube video. dQw4w9WgXcQ —
language_code Optional string Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks. en —
format Optional string 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 srt srtxmljson3txt

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'

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

Example response

Captured 2026-11-08, took 4163 ms · Request parameters {"format": "srt", "video_id": "dQw4w9WgXcQ", "language_code": "en"}

JSON
{
  "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"
      }
    }
  }
}