Back to APIs
YouTube Data API
Access YouTube's catalog to search for videos, retrieve channel metadata, manage playlists, and get video statistics.
Base URL
https://www.googleapis.com/youtube/v3videoschannelsplaylistssearchstatistics
Endpoints
GET
/searchSearch YouTube for videos, channels, or playlists.
const response = await fetch("https://www.googleapis.com/youtube/v3/search?part=snippet&q=Next.js+tutorial&type=video&maxResults=5&key=YOUR_API_KEY", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);Response Preview
{
"kind": "youtube#searchListResponse",
"pageInfo": { "totalResults": 12400 },
"items": [{
"id": { "kind": "youtube#video", "videoId": "dQw4w9WgXcQ" },
"snippet": {
"title": "Next.js 14 Full Course",
"channelTitle": "Fireship",
"publishedAt": "2024-01-15T12:00:00Z"
}
}]
}GET
/videosGet statistics and details for specific video IDs.
const response = await fetch("https://www.googleapis.com/youtube/v3/videos?part=statistics,snippet&id=dQw4w9WgXcQ&key=YOUR_API_KEY", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);Response Preview
{
"items": [{
"id": "dQw4w9WgXcQ",
"snippet": { "title": "Rick Astley - Never Gonna Give You Up" },
"statistics": {
"viewCount": "1400000000",
"likeCount": "15000000",
"commentCount": "2800000"
}
}]
}