Endpoint
Search YouTube for videos, channels, and playlists. Filter by type, duration, upload date, country, and sort order. Supports pagination for deep result sets.
| Parameter | Type | Description |
|---|---|---|
| qrequired | string | Search query string |
| typeoptional | string | Result type: video, channel, or playlist. Default: video |
| numoptional | integer | Number of results to return (1-50). Default: 10 |
| orderoptional | string | Sort order: relevance, date, viewCount, rating. Default: relevance |
| countryoptional | string | 2-letter country code (e.g. us, gb, in) |
| durationoptional | string | Video length: short (<4 min), medium (4-20 min), long (>20 min) |
| published_afteroptional | string | ISO 8601 date (e.g. 2026-01-01T00:00:00Z) |
| safeoptional | boolean | Enable safe search filtering. Default: false |
| page_tokenoptional | string | Pagination token from a previous response |
Get comprehensive metadata for any YouTube video including view count, likes, comments, tags, description, duration, and thumbnails in multiple sizes.
| Parameter | Type | Description |
|---|---|---|
| idrequired | string | YouTube video ID (e.g. dQw4w9WgXcQ) or full URL |
Retrieve channel statistics including subscriber count, total views, video count, description, custom URL, and profile images.
| Parameter | Type | Description |
|---|---|---|
| idrequired | string | YouTube channel ID, handle (e.g. @mkbhd), or full URL |
Data You Get
Rich metadata from every YouTube request
Search Results
Title, URL, channel, views, published date, duration, and thumbnail for each result. Sorted by relevance, date, or views.
Video Metadata
Full title, description, view/like/comment counts, tags, duration, publish date, category, and multiple thumbnail sizes.
Channel Stats
Subscriber count, total video count, total view count, channel description, custom URL, and profile/banner images.
Pagination
Each search response includes a next_page_token for retrieving additional pages of results.
Thumbnails
Multiple thumbnail sizes (default, medium, high, maxres) with URLs ready for display in your application.
Country Targeting
Get region-specific search results to understand how content performs across different markets.
Pricing
Quick Start
Start pulling YouTube data in seconds
YouTube Search
curl "https://apiserpent.com/api/social/youtube/search?q=react+tutorial&num=5&order=viewCount" \
-H "X-API-Key: YOUR_API_KEY"
# Response
{
"platform": "youtube",
"type": "search",
"query": "react tutorial",
"results": [
{
"position": 1,
"title": "React Tutorial for Beginners",
"url": "https://youtube.com/watch?v=abc123",
"channel": "Programming with Mosh",
"views": "5.2M views",
"published": "1 year ago",
"duration": "1:04:28",
"thumbnail": "https://i.ytimg.com/vi/abc123/hqdefault.jpg"
}
],
"total_results": 5,
"next_page_token": "CAUQAA"
}
import requests
resp = requests.get(
"https://apiserpent.com/api/social/youtube/search",
params={
"q": "react tutorial",
"num": 5,
"order": "viewCount",
"duration": "long"
},
headers={"X-API-Key": "YOUR_API_KEY"}
)
data = resp.json()
for video in data["results"]:
print(f"{video['position']}. {video['title']}")
print(f" Channel: {video['channel']} | Views: {video['views']}")
print(f" URL: {video['url']}")
print()
# Paginate to next page
if data.get("next_page_token"):
next_resp = requests.get(
"https://apiserpent.com/api/social/youtube/search",
params={"q": "react tutorial", "page_token": data["next_page_token"]},
headers={"X-API-Key": "YOUR_API_KEY"}
)
const resp = await fetch(
'https://apiserpent.com/api/social/youtube/search?' +
new URLSearchParams({
q: 'react tutorial',
num: '5',
order: 'viewCount',
country: 'us'
}),
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
const data = await resp.json();
data.results.forEach(video => {
console.log(`${video.position}. ${video.title}`);
console.log(` ${video.channel} - ${video.views}`);
});
// Paginate
if (data.next_page_token) {
const nextResp = await fetch(
`https://apiserpent.com/api/social/youtube/search?q=react+tutorial&page_token=${data.next_page_token}`,
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
}
Video Details
curl "https://apiserpent.com/api/social/youtube/video?id=dQw4w9WgXcQ" \
-H "X-API-Key: YOUR_API_KEY"
# Response
{
"platform": "youtube",
"type": "video",
"title": "Rick Astley - Never Gonna Give You Up",
"channel": "Rick Astley",
"channel_url": "https://youtube.com/@officialrickastley",
"views": 1580000000,
"likes": 18200000,
"comments": 3100000,
"published": "2009-10-25T06:57:33Z",
"duration": "3:33",
"description": "The official video for \"Never Gonna Give You Up\"...",
"tags": ["rick astley", "never gonna give you up", "rickroll"],
"thumbnails": {
"default": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
"high": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
"maxres": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg"
}
}
import requests
resp = requests.get(
"https://apiserpent.com/api/social/youtube/video",
params={"id": "dQw4w9WgXcQ"},
headers={"X-API-Key": "YOUR_API_KEY"}
)
video = resp.json()
print(f"Title: {video['title']}")
print(f"Views: {video['views']:,}")
print(f"Likes: {video['likes']:,}")
print(f"Duration: {video['duration']}")
print(f"Tags: {', '.join(video['tags'][:5])}")
const resp = await fetch(
'https://apiserpent.com/api/social/youtube/video?id=dQw4w9WgXcQ',
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
const video = await resp.json();
console.log(`Title: ${video.title}`);
console.log(`Views: ${video.views.toLocaleString()}`);
console.log(`Likes: ${video.likes.toLocaleString()}`);
console.log(`Duration: ${video.duration}`);
Channel Info
curl "https://apiserpent.com/api/social/youtube/channel?id=@mkbhd" \
-H "X-API-Key: YOUR_API_KEY"
# Response
{
"platform": "youtube",
"type": "channel",
"title": "Marques Brownlee",
"custom_url": "@mkbhd",
"subscribers": 19800000,
"total_views": 4200000000,
"video_count": 1820,
"description": "MKBHD: Quality Tech Videos...",
"published": "2008-03-21T00:00:00Z",
"profile_image": "https://yt3.ggpht.com/...",
"banner_image": "https://yt3.ggpht.com/..."
}
import requests
resp = requests.get(
"https://apiserpent.com/api/social/youtube/channel",
params={"id": "@mkbhd"},
headers={"X-API-Key": "YOUR_API_KEY"}
)
channel = resp.json()
print(f"Channel: {channel['title']}")
print(f"Subscribers: {channel['subscribers']:,}")
print(f"Total Views: {channel['total_views']:,}")
print(f"Videos: {channel['video_count']:,}")
const resp = await fetch(
'https://apiserpent.com/api/social/youtube/channel?id=@mkbhd',
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
const channel = await resp.json();
console.log(`Channel: ${channel.title}`);
console.log(`Subscribers: ${channel.subscribers.toLocaleString()}`);
console.log(`Videos: ${channel.video_count}`);
FAQ
Frequently asked questions
Serpent's YouTube API requires no Google Cloud project, no OAuth credentials, and has no daily quota limits. You use a single Serpent API key and pay per request ($0.20/1K). The response format is simpler and flatter than Google's nested resource structure.
You can filter by type (video, channel, playlist), num (results count), order (relevance, date, viewCount, rating), country (2-letter code), duration (short, medium, long), published_after (ISO date), safe (boolean), and page_token for pagination.
YouTube API starts at $0.11 per 1,000 requests on the Scale tier. Default: $0.20/1K, Growth: $0.16/1K, Scale: $0.11/1K. All endpoints (search, video, channel) are the same price. 100 free searches included with every new account.
The video endpoint returns title, description, channel name, channel URL, view count, like count, comment count, publish date, duration, tags, thumbnail URLs (multiple sizes), and category. All in a flat JSON structure.
Yes. Each search response includes a next_page_token field. Pass this as the page_token parameter in your next request to get the next page of results. This works identically to the official YouTube API pagination.
Start pulling YouTube data today
Sign up for free and get 100 trial requests. No credit card, no Google API key required.