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

# Get YouTube Transcript

> Retrieve transcript segments for a YouTube video using DumplingAI's transcript service. If the requested preferred language is unavailable but captions exist in another language, the first available transcript is returned instead.

## Description

This endpoint extracts the transcript from a specified YouTube video URL, formats the transcript, and optionally includes timestamps.

## Endpoint

```
POST https://app.dumplingai.com/api/v1/get-youtube-transcript
```

## Headers

* **Content-Type:** `application/json`
* **Authorization:** Bearer `<API_KEY>` (required)

## Request Body

```json theme={null}
{
  "videoUrl": "string", // Required. The URL of the YouTube video.
  "includeTimestamps": "boolean", // Optional. Whether to include timestamps in the transcript. Default: true.
  "timestampsToCombine": "number", // Optional. The number of timestamps to combine in the transcript. Default: 5.
  "preferredLanguage": "string" // Optional. Preferred language for the transcript.
}
```

### Accepted Values for `preferredLanguage`

The `preferredLanguage` parameter accepts the following language codes:

| Language Code | Language                 |
| ------------- | ------------------------ |
| af            | Afrikaans                |
| ak            | Akan                     |
| sq            | Albanian                 |
| am            | Amharic                  |
| ar            | Arabic                   |
| hy            | Armenian                 |
| as            | Assamese                 |
| ay            | Aymara                   |
| az            | Azerbaijani              |
| bn            | Bangla                   |
| eu            | Basque                   |
| be            | Belarusian               |
| bho           | Bhojpuri                 |
| bs            | Bosnian                  |
| bg            | Bulgarian                |
| my            | Burmese                  |
| ca            | Catalan                  |
| ceb           | Cebuano                  |
| zh            | Chinese                  |
| zh-HK         | Chinese (Hong Kong)      |
| zh-CN         | Chinese (China)          |
| zh-SG         | Chinese (Singapore)      |
| zh-TW         | Chinese (Taiwan)         |
| zh-Hans       | Chinese (Simplified)     |
| zh-Hant       | Chinese (Traditional)    |
| hak-TW        | Hakka Chinese (Taiwan)   |
| nan-TW        | Min Nan Chinese (Taiwan) |
| co            | Corsican                 |
| hr            | Croatian                 |
| cs            | Czech                    |
| da            | Danish                   |
| dv            | Divehi                   |
| nl            | Dutch                    |
| en            | English                  |
| en-US         | English (United States)  |
| eo            | Esperanto                |
| et            | Estonian                 |
| ee            | Ewe                      |
| fil           | Filipino                 |
| fi            | Finnish                  |
| fr            | French                   |
| gl            | Galician                 |
| lg            | Ganda                    |
| ka            | Georgian                 |
| de            | German                   |
| el            | Greek                    |
| gn            | Guarani                  |
| gu            | Gujarati                 |
| ht            | Haitian Creole           |
| ha            | Hausa                    |
| haw           | Hawaiian                 |
| iw            | Hebrew                   |
| hi            | Hindi                    |
| hmn           | Hmong                    |
| hu            | Hungarian                |
| is            | Icelandic                |
| ig            | Igbo                     |
| id            | Indonesian               |
| ga            | Irish                    |
| it            | Italian                  |
| ja            | Japanese                 |
| jv            | Javanese                 |
| kn            | Kannada                  |
| kk            | Kazakh                   |
| km            | Khmer                    |
| rw            | Kinyarwanda              |
| ko            | Korean                   |
| kri           | Krio                     |
| ku            | Kurdish                  |
| ky            | Kyrgyz                   |
| lo            | Lao                      |
| la            | Latin                    |
| lv            | Latvian                  |
| ln            | Lingala                  |
| lt            | Lithuanian               |
| lb            | Luxembourgish            |
| mk            | Macedonian               |
| mg            | Malagasy                 |
| ms            | Malay                    |
| ml            | Malayalam                |
| mt            | Maltese                  |
| mi            | Māori                    |
| mr            | Marathi                  |
| mn            | Mongolian                |
| ne            | Nepali                   |
| nso           | Northern Sotho           |
| no            | Norwegian                |
| ny            | Nyanja                   |
| or            | Odia                     |
| om            | Oromo                    |
| ps            | Pashto                   |
| fa            | Persian                  |
| pl            | Polish                   |
| pt            | Portuguese               |
| pa            | Punjabi                  |
| qu            | Quechua                  |
| ro            | Romanian                 |
| ru            | Russian                  |
| sm            | Samoan                   |
| sa            | Sanskrit                 |
| gd            | Scottish Gaelic          |
| sr            | Serbian                  |
| sn            | Shona                    |
| sd            | Sindhi                   |
| si            | Sinhala                  |
| sk            | Slovak                   |
| sl            | Slovenian                |
| so            | Somali                   |
| st            | Southern Sotho           |
| es            | Spanish                  |
| su            | Sundanese                |
| sw            | Swahili                  |
| sv            | Swedish                  |
| tg            | Tajik                    |
| ta            | Tamil                    |
| tt            | Tatar                    |
| te            | Telugu                   |
| th            | Thai                     |
| ti            | Tigrinya                 |
| ts            | Tsonga                   |
| tr            | Turkish                  |
| tk            | Turkmen                  |
| uk            | Ukrainian                |
| ur            | Urdu                     |
| ug            | Uyghur                   |
| uz            | Uzbek                    |
| vi            | Vietnamese               |
| cy            | Welsh                    |
| fy            | Western Frisian          |
| xh            | Xhosa                    |
| yi            | Yiddish                  |
| yo            | Yoruba                   |
| zu            | Zulu                     |

## Responses

### Success (200)

Returns the transcript of the specified YouTube video and the language that was actually returned.

```json theme={null}
{
  "transcript": "string",
  "language": "string"
}
```

* **Content-Type:** application/json
* **X-RateLimit-Limit:** The rate limit for the user.
* **X-RateLimit-Remaining:** The remaining number of requests for the user.

### Bad Request (400)

Returned if the request is invalid or missing required parameters.

```json theme={null}
{
  "error": "Error message describing the issue"
}
```

### Not Found (404)

Returned if no subtitles are found for the video.

```json theme={null}
{
  "error": "No subtitles found for the video: <videoID>"
}
```

### Internal Server Error (500)

Returned if there's an error during the transcript extraction process.

```json theme={null}
{
  "error": "Error message describing the issue"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/get-youtube-transcript \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "videoUrl": "https://www.youtube.com/watch?v=example",
  "includeTimestamps": true,
  "timestampsToCombine": 5,
  "preferredLanguage": "en"
}'
```

## Example Response

```json theme={null}
{
  "transcript": "00:00 - Welcome to this video.\n00:05 - Today we'll be discussing...",
  "language": "en"
}
```

## Notes

* The `videoUrl` parameter must be a valid YouTube video URL.
* If `includeTimestamps` is set to `false`, the transcript will not include timestamp information.
* The `timestampsToCombine` parameter determines how many individual transcript segments are combined into a single line with a timestamp.
* The `preferredLanguage` parameter allows you to request a specific transcript language.
* If the requested `preferredLanguage` is not available but the video has captions in another language, the endpoint will automatically fall back to the first available transcript instead of failing.
* The `language` field in the response always reflects the transcript language that was actually returned, which may differ from `preferredLanguage`.
* This endpoint uses 20 credits per request.
* The transcript extraction attempts to retrieve the captions of a YouTube video. Some videos have captions disabled, this action will fail on these videos.

## Rate Limiting

Rate limit headers (`X-RateLimit-Limit` and `X-RateLimit-Remaining`) are included in the response to indicate the user's current rate limit status.


## OpenAPI

````yaml POST /api/v1/get-youtube-transcript
openapi: 3.0.3
info:
  title: DumplingAI API
  version: 1.0.0
  description: >
    REST API for DumplingAI's content intelligence and automation platform.

    All endpoints are grouped under `/api/v1`; most are secured via Bearer API
    keys unless an operation explicitly sets `security: []`.
servers:
  - url: https://app.dumplingai.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: YouTube
    description: Access metadata, search results, and transcripts from YouTube.
  - name: TikTok
    description: Retrieve TikTok profile, video, follower, and transcript data.
  - name: LinkedIn
    description: Programmatically fetch LinkedIn company and profile data.
  - name: Search
    description: Search-orientated endpoints spanning web, news, maps, and autocomplete.
  - name: Google
    description: Integrations with Google business listings and location data.
  - name: Scraping
    description: Webpage capture, crawling, and structured content extraction utilities.
  - name: Documents
    description: Document processing, conversion, and metadata utilities.
  - name: AI
    description: DumplingAI agent and knowledge base endpoints.
  - name: Developer Tools
    description: Utilities for executing sandboxed code via API.
paths:
  /api/v1/get-youtube-transcript:
    post:
      tags:
        - YouTube
      summary: Get YouTube transcript
      description: >-
        Retrieve transcript segments for a YouTube video using DumplingAI's
        transcript service. If the requested preferred language is unavailable
        but captions exist in another language, the first available transcript
        is returned instead.
      operationId: getYouTubeTranscript
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YouTubeTranscriptRequest'
      responses:
        '200':
          description: Transcript retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeTranscriptResponse'
        '204':
          description: Transcripts disabled for the requested video.
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '404':
          description: No transcript available for the requested video.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream transcript provider returned an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    YouTubeTranscriptRequest:
      type: object
      required:
        - videoUrl
      properties:
        videoUrl:
          type: string
          format: uri
          description: Full YouTube video URL.
        preferredLanguage:
          type: string
          description: >-
            Preferred transcript language code. If unavailable, DumplingAI falls
            back to the first available transcript language for the video.
        includeTimestamps:
          type: boolean
          description: Include timestamps in the transcript output.
        timestampsToCombine:
          type: integer
          minimum: 1
          description: Number of consecutive transcript segments to merge.
        requestSource:
          $ref: '#/components/schemas/RequestSource'
    YouTubeTranscriptResponse:
      type: object
      properties:
        language:
          type: string
          description: >-
            Transcript language returned by the API. This may differ from
            `preferredLanguage` when DumplingAI falls back to the first
            available transcript.
        transcript:
          type: string
          description: Transcript formatted as newline separated segments.
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable description of what went wrong.
      required:
        - error
    RequestSource:
      type: string
      description: Optional identifier describing where the API request originated.
      enum:
        - API
        - WEB
        - MAKE_DOT_COM
        - ZAPIER
        - N8N
        - PLAYGROUND
        - DEFAULT_AUTOMATION
        - AGENT_PREVIEW
        - AGENT_LIVE
        - AUTOPILOT
        - STUDIO
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````