Skip to content

How to get YouTube transcripts with an API

Updated · 1 step

As of Nov 2026, the official YouTube Data API only downloads captions for videos you have permission to edit. To read the transcript of anyone else's public video, Fetchproof returns its published captions from the video URL.

The response gives you transcript as timed segments with start and end times, and transcript_only_text as one string for search, summaries or feeding to an LLM.

Request the transcript

Pass a video or Shorts URL. Leave language out for automatic selection, or set it to a code such as en or en-US. Set original_audio=true to get only captions in the language the video was recorded in.

GET /v1/youtube/video/transcript 1 credit per call

cURL

curl --request GET 'https://api.fetchproof.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ' \
  --header 'x-api-key: YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.fetchproof.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ", {
  method: 'GET',
  headers: {
    'x-api-key': process.env.FETCHPROOF_API_KEY,
  },
});
const data = await response.json();
console.log(data);

Python

import os
import requests

response = requests.get(
    "https://api.fetchproof.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ",
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json())

Go

package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ", nil)
  req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}

PHP

<?php
$ch = curl_init("https://api.fetchproof.com/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
  ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Excerpt of published sample response Full response →
{
  "success": true,
  "credits_remaining": 100,
  "credits_charged": 1,
  "videoId": "dQw4w9WgXcQ",
  "type": "manual",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "transcript": [
    {
      "text": "[♪♪♪]",
      "startMs": "1360",
      "endMs": "3040",
      "startTimeText": "0:01"
    }
  ],
  "transcript_only_text": "[♪♪♪] ♪ We're no strangers to love ♪ ♪ You know the rules and so do I ♪ ♪ A full commitmen…",
  "language": "en"
}

What it costs

A returned transcript costs 1 credit, with no extra lookup charge. If no captions match your language, or the original language can't be identified, the call returns null at no charge.

Set cache_max_age to reuse a recent cached result for 0 credits.

Manual or automatic captions

The type field tells you whether the creator uploaded the captions or YouTube generated them. Uploaded captions are usually more accurate for names and technical terms.

Try it with 100 free credits

Sign up with an email address, no card. Credits never expire. Errors cost 0 credits, and each endpoint page lists exactly what it charges.