> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube Transcript API

> Extract transcripts and available metadata from public YouTube videos.

## Overview

Use YouTube Transcript when you need transcript text from a public video. The endpoint returns the transcript plus available video metadata.

## Endpoint

`POST /api/v2/youtube_transcript`

## Quickstart

<CodeGroup>
  ```python Python theme={null}
  from llmlayer import LLMLayerClient

  client = LLMLayerClient(api_key="YOUR_LLMLAYER_API_KEY")

  response = client.get_youtube_transcript(
      "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      language="en",
  )

  print(response.title)
  print(response.transcript)
  ```

  ```typescript TypeScript theme={null}
  import { LLMLayerClient } from 'llmlayer';

  const client = new LLMLayerClient({
    apiKey: process.env.LLMLAYER_API_KEY,
  });

  const response = await client.getYouTubeTranscript(
    'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    'en',
  );

  console.log(response.title);
  console.log(response.transcript);
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.llmlayer.dev/api/v2/youtube_transcript \
    -H "Authorization: Bearer YOUR_LLMLAYER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "language": "en"
    }'
  ```
</CodeGroup>

## Request Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | YouTube video URL |
| `language` | `string \| null` | No | Preferred transcript language, for example `en`, `es`, or `fr` |

Supported URL forms include:

* `https://www.youtube.com/watch?v=VIDEO_ID`
* `https://youtu.be/VIDEO_ID`

## Response

```json theme={null}
{
  "transcript": "Transcript text...",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Video title",
  "description": "Video description",
  "author": "Channel name",
  "views": 123456,
  "likes": 1234,
  "date": "2026-01-01",
  "language": "en",
  "cost": 0.003
}
```

| Field | Type | Description |
| - | - | - |
| `transcript` | `string` | Transcript text |
| `url` | `string` | Video URL |
| `title` | `string \| null` | Video title |
| `description` | `string \| null` | Video description |
| `author` | `string \| null` | Channel or author |
| `views` | `integer \| null` | View count when available |
| `likes` | `integer \| null` | Like count when available |
| `date` | `string \| null` | Publish date when available |
| `language` | `string \| null` | Transcript language |
| `cost` | `number \| null` | Cost in USD |

## Pricing

YouTube Transcript costs `$0.003` per request.

## Limitations

* The video must be public.
* The video must have captions/transcripts available.
* Requested languages may not be available on every video.
* Live streams may not have transcripts.

## Errors

| Status | Meaning |
| - | - |
| `400` | Invalid YouTube URL |
| `401` | Missing or invalid LLMLayer API key |
| `500` | Transcript extraction failed |

See [Errors & Refunds](/errors) for the shared error format.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.