This endpoint will soon be deprecated in favor of the Universal Transcripts. Please migrate your workloads.

Quick Start

Request

import { Supadata, Transcript } from "@supadata/js";

// Initialize the client
const supadata = new Supadata({
  apiKey: "YOUR_API_KEY",
});

const transcript: Transcript = await supadata.youtube.transcript({
  url: "https://youtu.be/dQw4w9WgXcQ",
});
console.log(transcript);

Response

{
  "content": "Never gonna give you up, never gonna let you down...",
  "lang": "en",
  "availableLangs": ["en", "es", "zh-TW"]
}

Specification

Endpoint

GET https://api.supadata.ai/v1/youtube/transcript Each request requires an x-api-key header with your API key available after signing up. Get your API key here.

Query Parameters

ParameterTypeRequiredDescription
urlstringYes*YouTube video URL. See Supported YouTube URL Formats.
videoIdstringYes*YouTube video ID. Alternative to URL
langstringNoPreferred language code of the transcript (ISO 639-1). See Languages.
textbooleanNoWhen true, returns plain text transcript. Default: false
chunkSizenumberNoMaximum characters per transcript chunk (only when text=false)
* Either url or videoId must be provided

Response Format

When text=true:
{
  "content": string,
  "lang": string             // ISO 639-1 language code
  "availableLangs": string[] // List of available languages
}
When text=false:
{
  "content": [
    {
      "text": string,        // Transcript segment
      "offset": number,      // Start time in milliseconds
      "duration": number,    // Duration in milliseconds
      "lang": string         // ISO 639-1 language code of chunk
    }
  ],
  "lang": string             // ISO 639-1 language code of transcript
  "availableLangs": string[] // List of available languages
}

Error Codes

The API returns HTTP status codes and error codes. See this page for more details.

Supported YouTube URL Formats

url parameter supports various YouTube URL formats. See this page for more details.

Languages

The endpoint supports multiple languages. The lang parameter is used to specify the preferred language of the transcript. If the video does not have a transcript in the preferred language, the endpoint will return a transcript in the first available language and a list of other available languages. It is then possible to make another request to get the transcript in your chosen fallback language.
Need to get your transcript in a language not yet supported? Check the Transcript Translation endpoint.

Pricing

  • 1 transcript request = 1 credit