> ## 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 Video

> Retrieve detailed metadata, statistics, related videos, and optionally transcripts for a YouTube video or short.

## Description

This endpoint retrieves comprehensive information about a YouTube video including metadata, statistics, channel information, and optionally the video transcript. Works with both regular videos and shorts.

## Endpoint

```
POST https://app.dumplingai.com/api/v1/youtube/video
```

## Headers

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

## Request Body

```json theme={null}
{
  "url": "string", // Required. Full YouTube video URL
  "get_transcript": "boolean" // Optional. Whether to include transcript data. Default: false
}
```

## Responses

### Success (200)

Returns complete video information including metadata, statistics, and optionally transcript data.

```json theme={null}
{
  "id": "PkZNo7MFNFg",
  "thumbnail": "https://i.ytimg.com/vi/PkZNo7MFNFg/maxresdefault.jpg",
  "type": "video",
  "title": "JavaScript Tutorial for Beginners: Learn JS in 1 Hour",
  "description": "This comprehensive JavaScript tutorial covers all the fundamentals you need to get started with programming...",
  "commentCountText": "1.2M",
  "commentCountInt": 1200000,
  "likeCountText": "12M",
  "likeCountInt": 12000000,
  "viewCountText": "1.5B",
  "viewCountInt": 1500000000,
  "publishDateText": "Oct 25, 2009",
  "publishDate": "2009-10-25T00:00:00.000Z",
  "channel": {
    "id": "UCWv7vMbMWH4-V0ZXdmDpPBA",
    "url": "https://www.youtube.com/@programmingwithmosh",
    "handle": "programmingwithmosh",
    "title": "Programming with Mosh"
  },
  "durationMs": 212000,
  "durationFormatted": "3:32",
  "watchNextVideos": [
    {
      "id": "anotherVideoId",
      "title": "Related Video Title",
      "thumbnail": "https://i.ytimg.com/vi/anotherVideoId/maxresdefault.jpg",
      "channel": {
        "title": "Channel Name",
        "url": "https://www.youtube.com/channel/channelId",
        "handle": "@channelhandle",
        "id": "channelId"
      },
      "publishDateText": "Jan 1, 2023",
      "publishDate": "2023-01-01T00:00:00.000Z",
      "viewCountText": "1M",
      "viewCountInt": 1000000,
      "lengthText": "4:20",
      "videoUrl": "https://www.youtube.com/watch?v=anotherVideoId"
    }
  ],
  "keywords": ["javascript", "programming", "tutorial", "beginner"],
  "transcript": [
    {
      "text": "Welcome to this comprehensive JavaScript tutorial",
      "startMs": "0",
      "endMs": "2500",
      "startTimeText": "0:00"
    },
    {
      "text": "You know the rules and so do I",
      "startMs": "2500",
      "endMs": "5000",
      "startTimeText": "0:02"
    }
  ],
  "transcript_only_text": "We're no strangers to love\nYou know the rules and so do I..."
}
```

* **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": "'url' parameter is required and must be a non-empty string. Please provide a YouTube video or short URL."
}
```

### Bad Gateway (502)

Returned if the external service is unavailable or returns invalid data.

```json theme={null}
{
  "error": "Failed to retrieve YouTube video information"
}
```

### Internal Server Error (500)

Returned if there's an unexpected server error.

```json theme={null}
{
  "error": "An unexpected server error occurred while fetching YouTube video information"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/youtube/video \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "url": "https://www.youtube.com/watch?v=PkZNo7MFNFg",
  "get_transcript": true
}'
```

## Example Response

```json theme={null}
{
  "id": "PkZNo7MFNFg",
  "thumbnail": "https://i.ytimg.com/vi/PkZNo7MFNFg/maxresdefault.jpg",
  "type": "video",
  "title": "JavaScript Tutorial for Beginners: Learn JS in 1 Hour",
  "description": "This comprehensive JavaScript tutorial covers all the fundamentals you need to get started with programming...",
  "commentCountText": "1.2M",
  "commentCountInt": 1200000,
  "likeCountText": "12M",
  "likeCountInt": 12000000,
  "viewCountText": "1.5B",
  "viewCountInt": 1500000000,
  "publishDateText": "Oct 25, 2009",
  "publishDate": "2009-10-25T00:00:00.000Z",
  "channel": {
    "id": "UCWv7vMbMWH4-V0ZXdmDpPBA",
    "url": "https://www.youtube.com/@programmingwithmosh",
    "handle": "programmingwithmosh",
    "title": "Programming with Mosh"
  },
  "durationMs": 212000,
  "durationFormatted": "3:32",
  "keywords": ["javascript", "programming", "tutorial", "beginner"],
  "transcript": [
    {
      "text": "Welcome to this comprehensive JavaScript tutorial",
      "startMs": "0",
      "endMs": "2500",
      "startTimeText": "0:00"
    }
  ],
  "transcript_only_text": "Welcome to this comprehensive JavaScript tutorial. Today we'll cover variables, functions, objects..."
}
```

## Notes

* The `url` parameter must be a valid YouTube video or short URL
* When `get_transcript` is set to `true`, transcript data will be included if available
* Transcripts are only available for videos that have captions enabled
* The response includes comprehensive video metadata, statistics, and channel information
* `watchNextVideos` contains suggested videos that YouTube recommends
* `transcript_only_text` provides the full transcript as a single concatenated string
* This endpoint uses **10 credits** per request

## 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/youtube/video
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/youtube/video:
    post:
      tags:
        - YouTube
      summary: Get YouTube video
      description: >-
        Retrieve detailed metadata, statistics, related videos, and optionally
        transcripts for a YouTube video or short.
      operationId: getYouTubeVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YouTubeVideoRequest'
            examples:
              includeTranscript:
                summary: Fetch video with transcript
                value:
                  url: https://www.youtube.com/watch?v=PkZNo7MFNFg
                  get_transcript: true
      responses:
        '200':
          description: Video details retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeVideoResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream YouTube data provider returned an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    YouTubeVideoRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: Full YouTube video URL.
        get_transcript:
          type: boolean
          description: When true, include transcript segments.
        requestSource:
          $ref: '#/components/schemas/RequestSource'
    YouTubeVideoResponse:
      type: object
      properties:
        id:
          type: string
        thumbnail:
          type: string
          format: uri
        type:
          type: string
        title:
          type: string
        description:
          type: string
        commentCountText:
          type: string
          nullable: true
        commentCountInt:
          type: integer
          nullable: true
        likeCountText:
          type: string
          nullable: true
        likeCountInt:
          type: integer
          nullable: true
        viewCountText:
          type: string
          nullable: true
        viewCountInt:
          type: integer
          nullable: true
        publishDateText:
          type: string
          nullable: true
        publishDate:
          type: string
          format: date-time
          nullable: true
        channel:
          type: object
          additionalProperties: true
        durationMs:
          type: integer
          nullable: true
        durationFormatted:
          type: string
          nullable: true
        watchNextVideos:
          type: array
          items:
            $ref: '#/components/schemas/YouTubeVideoSummary'
        keywords:
          type: array
          items:
            type: string
        transcript:
          type: array
          items:
            $ref: '#/components/schemas/TranscriptSegment'
        transcript_only_text:
          type: string
          nullable: true
      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
    YouTubeVideoSummary:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        thumbnail:
          type: string
          format: uri
        url:
          type: string
          format: uri
        type:
          type: string
          description: Video type such as `video` or `short`.
        publishDateText:
          type: string
          nullable: true
        publishDate:
          type: string
          format: date-time
          nullable: true
        viewCountText:
          type: string
          nullable: true
        viewCountInt:
          type: integer
          nullable: true
        lengthText:
          type: string
          nullable: true
        channel:
          type: object
          additionalProperties: true
      additionalProperties: true
    TranscriptSegment:
      type: object
      properties:
        text:
          type: string
        startMs:
          type: string
        endMs:
          type: string
        startTimeText:
          type: string
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````