Quick Start

Request

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

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

const translated: Transcript = await supadata.youtube.translate({
  videoId: 'dQw4w9WgXcQ',
  lang: 'es',
});

Response

{
  "content": "Nunca voy a abandonarte, nunca voy a decepcionarte…",
  "lang": "es"
}
This endpoint has longer than usual response times. See Latency for more details.

Specification

Endpoint

GET https://api.supadata.ai/v1/youtube/transcript/translate 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.
langstringYesISO 639-1 language code of the translation
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
}
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
}

Latency

Due to the duration of transcript translation tasks, the endpoint may take 20 or more seconds to complete. Please make sure to increase the request timeout in your application.

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.

Pricing

  • 1 minute of transcript = 30 credits