YTAPI.devDocs

Search YouTube

search(query, options?): SearchResponse

GET
https://api.ytapi.dev/v1/search
1 Credit

Search videos, channels, playlists, movies, or Shorts. Does not consume YouTube Data API quota.

API Key

All requests require a valid API key from the developer dashboard.

Headers: Authorization: Bearer YOUR_API_KEYorX-API-Key: YOUR_API_KEY

See Authentication for headers and rate limits.

Query Parameters

ParameterTypeRequiredDescription
qquery
stringYes

Search keyword or phrase.

limitquery
numberNo

Max results to return, from 1 to 50. Default 20.

typequery
stringNo

video, channel, playlist, movie, or shorts. Default video.

upload_datequery
stringNo

hour, today, week, month, or year.

durationquery
stringNo

short (under 4m), medium (4~20m), or long (over 20m).

sort_byquery
stringNo

relevance (default), rating, upload_date, or view_count.

cursorquery
stringNo

Opaque pagination token for retrieving the next page.

Response (HTTP 200)

{
  "query": string,               // Echoed search string
  "type": string,                // Search target filter applied
  "has_more": boolean,           // Whether additional search results are available
  "next_cursor": string | null,  // Cursor token to fetch the next page of results
  "items": [                     // Array of search result hits
    {
      // Fields that do not apply to a result's type are left out.
      "id": string,              // Video ID, channel ID, or playlist ID
      "type": string,            // "video", "channel", "playlist", or "shorts"
      "title": string,           // Result title
      "description": string,     // Snippet / description
      "author": string,          // Channel name
      "channel_id": string,      // Channel ID
      "length_seconds": number,  // Duration in seconds (for videos)
      "length_text": string,     // Formatted duration string (e.g. "20:40")
      "view_count_text": string, // Formatted view count (e.g. "89K views")
      "published_text": string,  // Relative upload date (e.g. "2 weeks ago")
      "thumbnails": [            // Artwork at one or more sizes
        { "url": string, "width": number, "height": number }
      ],
      "handle": string,          // Channel results: handle (e.g. "@TED")
      "subscriber_count_text": string, // Channel results: e.g. "27.8M subscribers"
      "video_count_text": string,      // Playlist results: e.g. "11 videos" or "9 episodes"
      "badges": string[]         // e.g. ["Verified"]
    }
  ]
}