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

# Get subtitles

> Download subtitle/caption tracks for a YouTube video.



## OpenAPI

````yaml get /v1/youtube/subtitles
openapi: 3.1.0
info:
  title: Scrapio
  version: 1.0.0
  description: >-
    Turn any URL into structured data. Fetch raw HTML, crawl sites, extract
    structured content, interact with dynamic pages, and search the web through
    one API.
  contact:
    name: Scrapio Support
    url: https://scrapio.dev
  license:
    name: Proprietary
servers:
  - url: https://api.scrapio.dev
    description: Production
security:
  - bearerAuth: []
tags:
  - name: System
  - name: Fetch
  - name: Crawl
  - name: Map
  - name: Interact
  - name: Search
  - name: Google
  - name: Fast Search
  - name: Jobs
  - name: YouTube
  - name: Amazon
  - name: Walmart
  - name: Booking
  - name: Agoda
  - name: Airbnb
  - name: ChatGPT
  - name: Perplexity
  - name: Gemini
  - name: Bing
  - name: Reddit
  - name: TikTok
  - name: Apple App Store
  - name: Target
  - name: Monitors
paths:
  /v1/youtube/subtitles:
    get:
      tags:
        - YouTube
      summary: Get YouTube subtitles
      description: >-
        Download subtitle/caption tracks for a YouTube video. Returns
        timestamped transcript segments grouped by origin (auto-generated vs
        creator-uploaded) and language. Set `include_timestamps: false` to
        receive plain text only.
      operationId: getYouTubeSubtitles
      parameters:
        - name: video_id
          in: query
          required: true
          schema:
            type: string
            pattern: ^[A-Za-z0-9_-]{6,20}$
            description: YouTube video id
        - name: language
          in: query
          required: false
          schema:
            description: Subtitle language
            type: string
            minLength: 2
            maxLength: 16
            pattern: ^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$
        - name: subtitle_origin
          in: query
          required: false
          schema:
            description: 'Subtitle origin: auto_generated or creator'
            type: string
            enum:
              - auto_generated
              - creator
        - name: include_timestamps
          in: query
          required: false
          schema:
            description: Include per-line timestamps
            type: boolean
      responses:
        '200':
          description: Subtitle tracks grouped by origin and language.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeSubtitlesResponse'
        '400':
          description: Invalid video ID or language parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No subtitle tracks available for this video.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: >-
            curl
            "https://api.scrapio.dev/v1/youtube/subtitles?video_id=dQw4w9WgXcQ&language=en"
            \
              -H "Authorization: Bearer $SCRAPIO_API_KEY"
        - lang: Python
          label: Python
          source: |-
            import os, requests
            resp = requests.get(
                "https://api.scrapio.dev/v1/youtube/subtitles",
                headers={"Authorization": f"Bearer {os.environ['SCRAPIO_API_KEY']}"},
                params={"video_id": "dQw4w9WgXcQ", "language": "en"},
            )
            print(resp.json()["subtitles"])
        - lang: JavaScript
          label: Node.js
          source: >-
            const params = new URLSearchParams({ video_id: "dQw4w9WgXcQ",
            language: "en" });

            const { subtitles } = await
            fetch(`https://api.scrapio.dev/v1/youtube/subtitles?${params}`, {
              headers: { Authorization: `Bearer ${process.env.SCRAPIO_API_KEY}` },
            }).then(r => r.json());
components:
  schemas:
    YouTubeSubtitlesResponse:
      type: object
      properties:
        request_id:
          type: string
        video_id:
          type: string
        subtitles:
          type: object
          propertyNames:
            type: string
            enum:
              - auto_generated
              - creator
          additionalProperties:
            type: object
            propertyNames:
              type: string
            additionalProperties:
              type: array
              items:
                type: object
                properties:
                  start_ms:
                    type: string
                  d_duration_ms:
                    type: string
                  snippet:
                    type: object
                    properties:
                      runs:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                          required:
                            - text
                    required:
                      - runs
                required:
                  - start_ms
                  - d_duration_ms
                  - snippet
                additionalProperties: false
          required:
            - auto_generated
            - creator
      required:
        - request_id
        - video_id
        - subtitles
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
        diagnostics:
          type: object
          properties:
            outcome:
              type: string
              enum:
                - failed
            retryable:
              type: boolean
            blocked:
              type: boolean
            timed_out:
              type: boolean
          required:
            - outcome
            - retryable
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````