YepAPI
YouTube API

YouTube Search

Search YouTube for videos, channels, and playlists with rich metadata.

POST/v1/youtube/search
$0.01/call

Usage

const res = await fetch('https://api.yepapi.com/v1/youtube/search', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ query: 'nextjs tutorial', type: 'video' }),
});
const { data } = await res.json();
console.log(data.data); // array of video results
curl -X POST https://api.yepapi.com/v1/youtube/search \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "nextjs tutorial", "type": "video"}'

Request Body

ParameterTypeRequiredDescriptionDefault
querystringYesSearch query
typestringNoFilter: video, channel, playlistall
sortstringNoSort: upload_date, view_count, ratingrelevance
durationstringNoDuration filter
upload_datestringNoUpload date filter
featuresstringNoFeature filter
geostringNoCountry code (e.g. US)
langstringNoLanguage code (e.g. en)
tokenstringNoContinuation token for pagination

Response

{
  "ok": true,
  "data": {
    "estimatedResults": "675836",
    "continuation": "EqQD...",
    "data": [
      {
        "type": "video",
        "videoId": "ZVnjOPwW4ZA",
        "title": "Next js Tutorial for Beginners | Nextjs 13 (App Router) with TypeScript",
        "channelTitle": "Programming with Mosh",
        "channelId": "UCWv7vMbMWH4-V0ZXdmDpPBA",
        "channelHandle": "@programmingwithmosh",
        "channelBadges": ["Verified"],
        "isVerifiedChannel": true,
        "description": "Master Next.js 13 and build amazing full-stack apps! This beginner-friendly tutorial covers the new App Router, TypeScript, and ...",
        "viewCount": "1275546",
        "viewCountText": "1,275,546 views",
        "publishDate": "2024-04-13",
        "publishedAt": "2024-04-13T00:00:00Z",
        "publishedTimeText": "2 years ago",
        "lengthText": "1:02:55",
        "thumbnail": [
          { "url": "https://i.ytimg.com/vi/ZVnjOPwW4ZA/hq720.jpg", "width": 360, "height": 202 },
          { "url": "https://i.ytimg.com/vi/ZVnjOPwW4ZA/hq720.jpg", "width": 720, "height": 404 }
        ],
        "richThumbnail": [
          { "url": "https://i.ytimg.com/an_webp/ZVnjOPwW4ZA/mqdefault_6s.webp", "width": 320, "height": 180 }
        ],
        "channelThumbnail": [
          { "url": "https://yt3.ggpht.com/...=s68-c-k-c0x00ffffff-no-rj", "width": 68, "height": 68 }
        ]
      }
    ]
  }
}

Response Fields

FieldTypeDescription
okbooleanWhether the request succeeded
data.estimatedResultsstringEstimated total number of matching results
data.continuationstringToken to fetch the next page of results
data.dataobject[]Array of search results
data.data[].typestringResult type: video, channel, or playlist
data.data[].videoIdstringUnique YouTube video identifier
data.data[].titlestringVideo title as displayed on YouTube
data.data[].channelTitlestringName of the channel that uploaded the video
data.data[].channelIdstringUnique identifier for the channel
data.data[].channelHandlestringChannel handle (e.g. @programmingwithmosh)
data.data[].channelBadgesstring[]Channel verification badges (e.g. Verified)
data.data[].isVerifiedChannelbooleanWhether the channel is verified
data.data[].descriptionstringSnippet of the video description shown in search results
data.data[].viewCountstringRaw view count as a numeric string
data.data[].viewCountTextstringHuman-readable view count (e.g. 1,275,546 views)
data.data[].publishDatestringPublish date in YYYY-MM-DD format
data.data[].publishedAtstringPublish date as ISO 8601 timestamp
data.data[].publishedTimeTextstringRelative publish time (e.g. 2 years ago)
data.data[].lengthTextstringVideo duration in H:MM:SS or MM:SS format
data.data[].thumbnailobject[]Video thumbnail images at various resolutions
data.data[].richThumbnailobject[]Animated preview thumbnail (webp format)
data.data[].channelThumbnailobject[]Channel avatar images
data.data[].badgesstring[]Video badges (e.g. 4K, CC, Beginner)

Use the continuation token from the response as the token parameter to fetch the next page of results.

On this page