# YouTube Video Transcript

Get the transcript for a YouTube video. Also available as /api/youtube/{videoId}/transcript and the matching legacy /api/youtube-external/* aliases.

- **Documentation:** [https://scrappa.co/docs/youtube-api/youtube_transcript](https://scrappa.co/docs/youtube-api/youtube_transcript)
- **API group:** YouTube API
- **Endpoint:** `GET https://scrappa.co/api/youtube/transcript`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `video_id` | string | Yes | YouTube video ID (aliases: videoId, id) |
| `videoId` | string | Yes | YouTube video ID (aliases: video_id, id) |
| `id` | string | Yes | YouTube video ID (aliases: video_id, videoId) |
| `language` | string | No | Transcript language code or name (alias: lang). |
| `lang` | string | No | Transcript language code or name (alias: language). |
| `hl` | string | No | Language code for localized upstream video info lookups (e.g., en). |
| `gl` | string | No | Country code for localized upstream video info lookups (e.g., US). |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/youtube/transcript?video_id=dQw4w9WgXcQ&language=es"
```

## Example response

```json
{
    "videoId": "dQw4w9WgXcQ",
    "language": "es",
    "languageName": "Spanish",
    "sourceLanguage": "en",
    "sourceLanguageName": "English",
    "isAutoGenerated": true,
    "isTranslated": true,
    "availableLanguages": [
        {
            "language": "en",
            "name": "English",
            "isAutoGenerated": true,
            "isTranslatable": true
        }
    ],
    "translationLanguages": [
        {
            "language": "es",
            "name": "Spanish"
        }
    ],
    "transcript": [
        {
            "text": "Hola mundo",
            "startMs": 1000,
            "durationMs": 2000,
            "endMs": 3000,
            "startTime": 1
        }
    ],
    "text": "Hola mundo"
}
```

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
