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

# Transcript

> Get transcript from YouTube video in various formats and languages. If the `lang` parameter is not provided or the transcript is not available in the requested language, the API defaults to the first available language.



## OpenAPI

````yaml v1-openapi GET /youtube/transcript
openapi: 3.1.0
info:
  title: Supadata
  description: Web & Social Media Content API for Developers
  version: 1.3.0
servers:
  - url: https://api.supadata.ai/v1
security:
  - apiKeyAuth: []
paths:
  /youtube/transcript:
    get:
      description: >-
        Get transcript from YouTube video in various formats and languages. If
        the `lang` parameter is not provided or the transcript is not available
        in the requested language, the API defaults to the first available
        language.
      operationId: getYoutubeTranscript
      parameters:
        - in: query
          name: url
          schema:
            type: string
            format: uri
            description: >-
              YouTube video URL. See [supported URL
              formats](https://supadata.ai/documentation/youtube/supported-url-formats).
            example: https://youtu.be/dQw4w9WgXcQ
        - in: query
          name: videoId
          schema:
            type: string
            description: YouTube video ID. Alternative to URL.
            example: dQw4w9WgXcQ
        - in: query
          name: text
          schema:
            type: boolean
            description: When true, returns plain text transcript.
            default: false
        - in: query
          name: chunkSize
          schema:
            type: number
            minimum: 50
            maximum: 10000
            description: Maximum characters per transcript chunk (only when text=false)
            example: 1000
        - in: query
          name: lang
          schema:
            type: string
            description: >-
              Preferred language code of the transcript (ISO 639-1). If not
              provided, the first available language will be returned. If the
              requested language is unavailable, the API defaults to the first
              available language. See
              [Languages](https://supadata.ai/documentation/youtube/supported-language-codes).
            example: en
      responses:
        '200':
          description: Successfully fetched transcript
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transcript'
        '206':
          description: Transcript Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      deprecated: true
      x-codeSamples:
        - lang: TypeScript
          label: Node.js
          source: |-
            import { Supadata } from '@supadata/js';

            const supadata = new Supadata({
              apiKey: 'YOUR_API_KEY',
            });
            const transcript = await supadata.youtube.transcript({
              url: 'https://youtu.be/dQw4w9WgXcQ',
              lang: 'en',
              text: true,
            });
            console.log(transcript);
        - lang: Python
          label: Python
          source: |-
            from supadata import Supadata

            supadata = Supadata(api_key="YOUR_API_KEY")
            text_transcript = supadata.youtube.transcript(
                url="https://youtu.be/dQw4w9WgXcQ",
                lang="en",
                text=True # Set to False to get the transcript with timestamps
            )
            print(text_transcript.content)
        - lang: Shell
          label: cURL - Using URL
          source: >-
            curl -X GET
            "https://api.supadata.ai/v1/youtube/transcript?url=https://youtu.be/dQw4w9WgXcQ&lang=en"
            \
              -H "x-api-key: YOUR_API_KEY" \
              -H "Content-Type: application/json"
components:
  schemas:
    Transcript:
      type: object
      properties:
        content:
          anyOf:
            - type: array
              items:
                $ref: '#/components/schemas/TranscriptChunk'
            - type: string
              description: Plain text transcript when text=true parameter is used
              example: Never gonna give you up, never gonna let you down...
        lang:
          type: string
          description: ISO 639-1 language code of transcript
          example: en
        availableLangs:
          type: array
          items:
            type: string
          description: List of available language codes
          example:
            - en
            - es
            - zh-TW
      required:
        - content
        - lang
        - availableLangs
    Error:
      type: object
      properties:
        error:
          type: string
          enum:
            - invalid-request
            - internal-error
            - forbidden
            - unauthorized
            - upgrade-required
            - transcript-unavailable
            - not-found
            - limit-exceeded
          description: Error code identifying the type of error
          example: invalid-request
        message:
          type: string
          description: Human readable error message
          example: Invalid Request
        details:
          type: string
          description: Detailed error description
          example: The request is invalid or malformed
        documentationUrl:
          type: string
          description: URL to error documentation
          example: https://supadata.ai/documentation/errors#invalid-request
      required:
        - error
        - message
        - details
      description: Standard error response format
    TranscriptChunk:
      type: object
      properties:
        text:
          type: string
          description: Transcript segment
          example: Never gonna give you up...
        offset:
          type: number
          description: Start time in milliseconds
          example: 8150
        duration:
          type: number
          description: Duration in milliseconds
          example: 1200
        lang:
          type: string
          description: ISO 639-1 language code of chunk
          example: en
      required:
        - text
        - offset
        - duration
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````