YouTube API
Trending Videos
Get trending YouTube videos by country and category.
POST
$0.01/call/v1/youtube/trendingUsage
const res = await fetch('https://api.yepapi.com/v1/youtube/trending', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ geo: 'US', type: 'now' }),
});
const { data } = await res.json();
console.log(data.data); // array of trending videoscurl -X POST https://api.yepapi.com/v1/youtube/trending \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"geo": "US", "type": "now"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
geo | string | No | Country code (e.g. US, GB, IN) | — |
type | string | No | Category: now, music, gaming, movies | now |
lang | string | No | Language code | — |
Response
{
"ok": true,
"data": {
"data": [
{
"type": "video",
"videoId": "XelMqi0jlvk",
"title": "Christmas Songs Playlist - Top 2 Hour Christmas Songs",
"channelId": "UCn0JHLJWiO3_Y5xfNPcF_Ug",
"channelTitle": "Christmas Songs and Carols - Love to Sing",
"description": "Enjoy the festive classic Top Christmas Songs...",
"viewCount": "15200000",
"commentCount": "61",
"likeCount": "85000",
"publishedTimeText": "3 months ago",
"publishedAt": "2026-01-13T00:00:00Z",
"lengthText": "2:05:32",
"thumbnail": [
{ "url": "https://i.ytimg.com/vi/XelMqi0jlvk/hq720.jpg", "width": 720, "height": 404 }
],
"richThumbnail": [
{ "url": "https://i.ytimg.com/an_webp/XelMqi0jlvk/mqdefault_6s.webp", "width": 320, "height": 180 }
]
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.data | object[] | Array of trending video results |
data.data[].type | string | Content type (always video for trending) |
data.data[].videoId | string | Unique YouTube video identifier |
data.data[].title | string | Video title as displayed on YouTube |
data.data[].channelId | string | Unique identifier for the channel |
data.data[].channelTitle | string | Name of the channel that uploaded the video |
data.data[].description | string | Full video description text |
data.data[].viewCount | string | Total view count as a numeric string |
data.data[].commentCount | string | Total number of comments |
data.data[].likeCount | string | Total number of likes |
data.data[].publishedTimeText | string | Relative publish time (e.g. 3 months ago) |
data.data[].publishedAt | string | Publish date as ISO 8601 timestamp |
data.data[].lengthText | string | Video duration in H:MM:SS or MM:SS format |
data.data[].thumbnail | object[] | Video thumbnail images at various resolutions |
data.data[].richThumbnail | object[] | Animated preview thumbnail (webp format) |
data.data[].channelThumbnail | object[] | Channel avatar images |