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

# YouTube Search

> Perform keyword searches across videos, shorts, or channels with pagination.

## Description

This endpoint searches YouTube and returns matching videos, channels, playlists, shorts, and other content types. Perfect for content discovery, research, and finding specific types of educational or business content.

## Endpoint

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

## Headers

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

## Request Body

```json theme={null}
{
  "query": "string", // Required. Search query
  "uploadDate": "string", // Optional. Filter by upload date
  "sortBy": "string", // Optional. Sort results
  "filter": "string", // Optional. Filter by content type
  "continuationToken": "string", // Optional. Token for pagination
  "includeExtras": "string" // Optional. Include additional metadata (slower response)
}
```

### Accepted Values for `uploadDate`

| Value | Description               |
| ----- | ------------------------- |
| hour  | Uploaded in the last hour |
| today | Uploaded today            |
| week  | Uploaded this week        |
| month | Uploaded this month       |
| year  | Uploaded this year        |

### Accepted Values for `sortBy`

| Value     | Description                 |
| --------- | --------------------------- |
| relevance | Sort by relevance (default) |
| date      | Sort by upload date         |
| viewCount | Sort by view count          |
| rating    | Sort by rating              |

### Accepted Values for `filter`

| Value    | Description       |
| -------- | ----------------- |
| video    | Videos only       |
| channel  | Channels only     |
| playlist | Playlists only    |
| short    | Shorts only       |
| live     | Live streams only |
| movie    | Movies only       |

## Responses

### Success (200)

Returns search results organized by content type with pagination support.

```json theme={null}
{
  "videos": [
    {
      "type": "video",
      "id": "Mus_vwhTCq0",
      "url": "https://www.youtube.com/watch?v=Mus_vwhTCq0",
      "title": "Full Stack Web Development Tutorial - Build a Complete App",
      "thumbnail": "https://i.ytimg.com/vi/Mus_vwhTCq0/hq720.jpg",
      "channel": {
        "id": "UCFbNIlppjAuEX4znoulh0Cw",
        "title": "Web Dev Simplified",
        "handle": "webdevsimplified",
        "thumbnail": "https://yt3.ggpht.com/ytc/AIdro_l3ee46SNWQDE..."
      },
      "viewCountText": "425,891 views",
      "viewCountInt": 425891,
      "publishedTimeText": "3 months ago",
      "publishedTime": "2024-10-15T17:08:46.499Z",
      "lengthText": "2:14:32",
      "lengthSeconds": 8072,
      "badges": ["4K", "CC"]
    }
  ],
  "channels": [
    {
      "type": "channel",
      "id": "UCWv7vMbMWH4-V0ZXdmDpPBA",
      "title": "Programming with Mosh",
      "handle": "programmingwithmosh",
      "thumbnail": "https://yt3.ggpht.com/ytc/AIdro_nBgMGIxgHeh...",
      "subscriberCountText": "3.2M subscribers",
      "description": "I train programmers through my online courses and YouTube channel..."
    }
  ],
  "shorts": [
    {
      "type": "short",
      "id": "dM-Q7WKqt8I",
      "url": "https://www.youtube.com/watch?v=dM-Q7WKqt8I",
      "title": "CSS Grid vs Flexbox in 60 seconds",
      "thumbnail": "https://i.ytimg.com/vi/dM-Q7WKqt8I/hq720.jpg",
      "channel": {
        "id": "UCFbNIlppjAuEX4znoulh0Cw",
        "title": "Web Dev Simplified",
        "handle": "webdevsimplified",
        "thumbnail": "https://yt3.ggpht.com/ytc/AIdro_l3ee46SNWQDE..."
      },
      "viewCountText": "89,432 views",
      "viewCountInt": 89432,
      "publishedTimeText": "2 weeks ago",
      "publishedTime": "2025-01-14T17:08:46.499Z",
      "lengthText": "0:58",
      "lengthSeconds": 58,
      "badges": []
    }
  ],
  "playlists": [
    {
      "type": "playlist",
      "id": "PLZlA0Gpn_vH_uZs4vJMIhcinABSTUH2bY",
      "title": "Complete React Tutorial Series",
      "thumbnail": "https://i.ytimg.com/vi/Mus_vwhTCq0/hqdefault.jpg",
      "channel": {
        "title": "Net Ninja",
        "id": "UCW5YeuERMmlnqo4oq8vwUpg"
      },
      "videoCount": 35
    }
  ],
  "shelves": [
    {
      "type": "shelf",
      "title": "Latest tutorials",
      "items": [
        {
          "type": "video",
          "id": "example123",
          "title": "React Hooks Tutorial",
          "thumbnail": "https://i.ytimg.com/vi/example123/hqdefault.jpg"
        }
      ]
    }
  ],
  "lives": [],
  "continuationToken": "EooDEg..."
}
```

* **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": "'query' parameter is required and must be a non-empty string. Please provide a search term."
}
```

### Bad Gateway (502)

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

```json theme={null}
{
  "error": "Failed to search YouTube"
}
```

### Internal Server Error (500)

Returned if there's an unexpected server error.

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

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/youtube/search \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "query": "web development tutorial",
  "filter": "video",
  "sortBy": "viewCount",
  "uploadDate": "month"
}'
```

## Example Response

```json theme={null}
{
  "videos": [
    {
      "type": "video",
      "id": "Mus_vwhTCq0",
      "url": "https://www.youtube.com/watch?v=Mus_vwhTCq0",
      "title": "Full Stack Web Development Tutorial - Build a Complete App",
      "thumbnail": "https://i.ytimg.com/vi/Mus_vwhTCq0/hq720.jpg",
      "channel": {
        "id": "UCFbNIlppjAuEX4znoulh0Cw",
        "title": "Web Dev Simplified",
        "handle": "webdevsimplified",
        "thumbnail": "https://yt3.ggpht.com/ytc/AIdro_l3ee46SNWQDE3tpPXONvTIEN2ZFGF7DMRLSc4kPx1zhEQ=s68-c-k-c0x00ffffff-no-rj"
      },
      "viewCountText": "425,891 views",
      "viewCountInt": 425891,
      "publishedTimeText": "3 months ago",
      "publishedTime": "2024-10-15T17:08:46.499Z",
      "lengthText": "2:14:32",
      "lengthSeconds": 8072,
      "badges": ["4K", "CC"]
    }
  ],
  "channels": [],
  "playlists": [],
  "shorts": [],
  "shelves": [],
  "lives": [],
  "continuationToken": "EooDEg..."
}
```

## Notes

* The `query` parameter is required and must be a non-empty string
* Use filters to narrow down results to specific content types (videos, channels, playlists, etc.)
* The `continuationToken` from the response can be used to fetch additional pages of results
* Setting `includeExtras` to "true" includes additional metadata like like/comment counts but may slow down the response
* Search results are organized by content type in separate arrays
* This endpoint uses **10 credits** per request
* Results are paginated - use the `continuationToken` to retrieve additional pages

## 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/search
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/search:
    post:
      tags:
        - YouTube
      summary: Search YouTube
      description: >-
        Perform keyword searches across videos, shorts, or channels with
        pagination.
      operationId: searchYouTube
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YouTubeSearchRequest'
      responses:
        '200':
          description: Search results returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeSearchResponse'
        '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:
    YouTubeSearchRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
        uploadDate:
          type: string
          description: Optional upload-date filter forwarded to the upstream provider.
        sortBy:
          type: string
          description: Optional sort mode forwarded to the upstream provider.
        filter:
          type: string
          description: Optional result filter forwarded to the upstream provider.
        continuationToken:
          type: string
        includeExtras:
          type: string
          description: Optional upstream flag forwarded to request additional metadata.
        requestSource:
          $ref: '#/components/schemas/RequestSource'
    YouTubeSearchResponse:
      type: object
      properties:
        videos:
          type: array
          items:
            $ref: '#/components/schemas/YouTubeVideoSummary'
        channels:
          type: array
          items:
            type: object
            additionalProperties: true
        playlists:
          type: array
          items:
            type: object
            additionalProperties: true
        shorts:
          type: array
          items:
            $ref: '#/components/schemas/YouTubeVideoSummary'
        continuationToken:
          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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````