Developer Guide

YouTube API Complete Guide: Search, Videos & Channels for Developers

By Serpent API Team · · 14 min read

YouTube is the world's second-largest search engine and the dominant video platform, with over 800 million videos and 500 hours of new content uploaded every minute. For developers building content monitoring tools, competitor analysis dashboards, trend tracking systems, or AI training pipelines, programmatic access to YouTube data is not optional—it is foundational.

This guide covers Serpent API's three dedicated YouTube endpoints in detail: YouTube Search, Video Details, and Channel Lookup. Each section includes parameter references, response schemas, and working code examples in both Python and Node.js. Whether you are building a social listening tool, a creator analytics platform, or a research pipeline, this guide gives you everything you need to integrate YouTube data into your application.

Why Use a YouTube API?

YouTube's official Data API v3 is powerful but comes with significant friction. You need a Google Cloud project, OAuth credentials, and you are subject to a daily quota of 10,000 units—which sounds generous until you realize that a single search request costs 100 units, meaning you get exactly 100 searches per day for free. Exceeding that requires requesting a quota increase (which Google can deny) or paying for additional quota.

Beyond quota constraints, the official API requires managing OAuth tokens, handling refresh flows, and navigating Google Cloud's IAM system. For many use cases—especially those that only need public data like video titles, view counts, and channel information—this is far more complexity than the task warrants.

Serpent API's YouTube endpoints solve this with a simple REST interface: pass your API key and query parameters, get structured JSON back. No OAuth, no Google Cloud project, no quota applications. One API key works across all Serpent endpoints—YouTube, web search, news, images, and more.

Serpent YouTube API Overview

Serpent API provides three YouTube-specific endpoints, each designed for a distinct data retrieval pattern:

Endpoint Purpose Cost Key Params
/api/youtube/search Search videos, channels, playlists 1 credit q, type, order, duration
/api/youtube/video Fetch details for up to 50 videos 1 credit per batch id (comma-separated)
/api/youtube/channel Look up channel by handle or URL 1 credit handle, url

All three endpoints return structured JSON, accept a single apiKey parameter for authentication, and cost $0.20 per 1,000 queries. There are no separate credit tiers or multiplier costs for YouTube versus other search types.

The YouTube Search endpoint lets you search across YouTube's entire catalog of videos, channels, and playlists. It supports the same filtering capabilities as YouTube's native search, including content type, sort order, duration, and upload date.

Endpoint

GET https://apiserpent.com/api/youtube/search

Parameters

Parameter Type Required Description
q string Yes Search query (e.g., "machine learning tutorial")
apiKey string Yes Your Serpent API key
type string No video (default), channel, playlist, or all
order string No relevance (default), date, viewCount, rating
duration string No short (under 4 min), medium (4–20 min), long (over 20 min)
num integer No Number of results (default: 10, max: 50)
pageToken string No Pagination token from previous response for next page

Python Example: Search for Videos

import requests

API_KEY = "your_api_key_here"

# Search for recent machine learning tutorials, sorted by upload date
response = requests.get("https://apiserpent.com/api/youtube/search", params={
    "q": "machine learning tutorial 2026",
    "type": "video",
    "order": "date",
    "duration": "medium",
    "num": 20,
    "apiKey": API_KEY
})

data = response.json()

for video in data["results"]:
    print(f"Title:     {video['title']}")
    print(f"Channel:   {video['channelTitle']}")
    print(f"Views:     {video.get('viewCount', 'N/A')}")
    print(f"Published: {video['publishedAt']}")
    print(f"URL:       https://youtube.com/watch?v={video['videoId']}")
    print()

# Paginate to the next page of results
if data.get("nextPageToken"):
    next_page = requests.get("https://apiserpent.com/api/youtube/search", params={
        "q": "machine learning tutorial 2026",
        "type": "video",
        "order": "date",
        "duration": "medium",
        "num": 20,
        "pageToken": data["nextPageToken"],
        "apiKey": API_KEY
    })
    page2 = next_page.json()
    print(f"Page 2: {len(page2['results'])} more results")

Node.js Example: Search for Channels

const API_KEY = "your_api_key_here";

// Search for channels related to a topic
const params = new URLSearchParams({
  q: "data science",
  type: "channel",
  order: "relevance",
  num: "10",
  apiKey: API_KEY,
});

const response = await fetch(
  `https://apiserpent.com/api/youtube/search?${params}`
);
const data = await response.json();

for (const channel of data.results) {
  console.log(`${channel.title} (@${channel.handle})`);
  console.log(`  Subscribers: ${channel.subscriberCount}`);
  console.log(`  Videos: ${channel.videoCount}`);
  console.log(`  URL: https://youtube.com/${channel.handle}`);
}

Response Schema

The search endpoint returns a JSON object with a results array and an optional nextPageToken. Each result object contains:

Video Details API (Batch Up to 50)

The Video Details endpoint retrieves comprehensive metadata for one or more videos by their IDs. Unlike the search endpoint, which returns summary data, this endpoint returns the full detail set including exact view counts, like counts, comment counts, tags, category, and complete descriptions.

The key advantage is batch support: you can pass up to 50 video IDs in a single request, and it costs only 1 credit. This makes it extremely efficient for enriching large datasets of video URLs.

Endpoint

GET https://apiserpent.com/api/youtube/video

Parameters

Parameter Type Required Description
id string Yes Video ID or comma-separated list of up to 50 IDs
apiKey string Yes Your Serpent API key

Python Example: Batch Video Details

import requests

API_KEY = "your_api_key_here"

# Fetch details for up to 50 videos in a single request (1 credit)
video_ids = [
    "dQw4w9WgXcQ",
    "jNQXAC9IVRw",
    "9bZkp7q19f0",
    "kJQP7kiw5Fk",
    "RgKAFK5djSk",
]

response = requests.get("https://apiserpent.com/api/youtube/video", params={
    "id": ",".join(video_ids),
    "apiKey": API_KEY
})

data = response.json()

for video in data["results"]:
    print(f"Title:       {video['title']}")
    print(f"Channel:     {video['channelTitle']}")
    print(f"Views:       {video['viewCount']:,}")
    print(f"Likes:       {video['likeCount']:,}")
    print(f"Comments:    {video['commentCount']:,}")
    print(f"Duration:    {video['duration']}")
    print(f"Published:   {video['publishedAt']}")
    print(f"Tags:        {', '.join(video.get('tags', [])[:5])}")
    print(f"Category:    {video['categoryId']}")
    print(f"Description: {video['description'][:120]}...")
    print()

Node.js Example: Single Video Lookup

const API_KEY = "your_api_key_here";

// Fetch details for a single video
const params = new URLSearchParams({
  id: "dQw4w9WgXcQ",
  apiKey: API_KEY,
});

const response = await fetch(
  `https://apiserpent.com/api/youtube/video?${params}`
);
const data = await response.json();
const video = data.results[0];

console.log(`Title: ${video.title}`);
console.log(`Views: ${Number(video.viewCount).toLocaleString()}`);
console.log(`Likes: ${Number(video.likeCount).toLocaleString()}`);
console.log(`Like/View Ratio: ${(video.likeCount / video.viewCount * 100).toFixed(2)}%`);
console.log(`Duration: ${video.duration}`);

Response Schema

Each video object in the results array contains:

Batch Efficiency

50 videos per request at 1 credit each means you can fetch details for 50,000 videos for just $0.20. Compare that to making 50,000 individual requests to the official YouTube API, which would consume 50,000 quota units—5x your daily free quota.

Channel API

The Channel endpoint retrieves detailed information about a YouTube channel, including subscriber count, total video count, lifetime view count, channel description, and branding assets. You can look up a channel by its handle (e.g., @mkbhd) or by its full URL.

Endpoint

GET https://apiserpent.com/api/youtube/channel

Parameters

Parameter Type Required Description
handle string One of handle or url Channel handle (e.g., @mkbhd or mkbhd)
url string One of handle or url Full YouTube channel URL
apiKey string Yes Your Serpent API key

Python Example: Channel Lookup by Handle

import requests

API_KEY = "your_api_key_here"

# Look up a channel by handle
response = requests.get("https://apiserpent.com/api/youtube/channel", params={
    "handle": "@mkbhd",
    "apiKey": API_KEY
})

channel = response.json()["result"]

print(f"Name:         {channel['title']}")
print(f"Handle:       {channel['handle']}")
print(f"Subscribers:  {channel['subscriberCount']:,}")
print(f"Total Views:  {channel['viewCount']:,}")
print(f"Video Count:  {channel['videoCount']:,}")
print(f"Joined:       {channel['publishedAt']}")
print(f"Description:  {channel['description'][:150]}...")
print(f"Country:      {channel.get('country', 'N/A')}")

Node.js Example: Channel Lookup by URL

const API_KEY = "your_api_key_here";

// Look up a channel using its full YouTube URL
const params = new URLSearchParams({
  url: "https://www.youtube.com/@veritasium",
  apiKey: API_KEY,
});

const response = await fetch(
  `https://apiserpent.com/api/youtube/channel?${params}`
);
const data = await response.json();
const channel = data.result;

console.log(`${channel.title} (${channel.handle})`);
console.log(`  Subscribers: ${Number(channel.subscriberCount).toLocaleString()}`);
console.log(`  Videos: ${channel.videoCount}`);
console.log(`  Total Views: ${Number(channel.viewCount).toLocaleString()}`);

Response Schema

The channel endpoint returns a result object containing:

Pricing: $0.20 per 1K Queries

All YouTube endpoints are priced uniformly at $0.20 per 1,000 queries (Default tier). Growth tier: $0.16/1K. Scale tier: $0.11/1K. No credit multipliers and no minimum monthly commitment. You pay for exactly what you use.

Monthly Volume Total Cost Effective per Query
1,000 queries $0.20 $0.0002
10,000 queries $2.00 $0.0002
100,000 queries $20.00 $0.0002
1,000,000 queries $200.00 $0.0002

The batch Video Details endpoint is exceptionally cost-effective. A single request returns details for up to 50 videos at 1 credit, meaning you can retrieve metadata for 50,000 videos for $0.20. Compare this to the official YouTube Data API, where fetching 50,000 video details would consume 50,000 quota units—5x your daily free allowance—requiring at minimum 5 days of waiting.

No Quota Walls

Unlike the official YouTube Data API which limits you to 10,000 units/day (just 100 searches), Serpent API has no daily quota cap. Your only constraint is your rate limit tier, which scales from 10/min (free) to 200/min (tier2). Need higher throughput? Contact us for custom rate limits.

Use Cases

Content Monitoring

Track mentions of your brand, product, or competitors across YouTube. Set up a cron job that searches for your brand name daily and alerts you when new videos appear. With the order=date parameter, you always get the most recent uploads first.

import requests
from datetime import date

API_KEY = "your_api_key_here"
BRANDS = ["your brand", "competitor 1", "competitor 2"]

for brand in BRANDS:
    response = requests.get("https://apiserpent.com/api/youtube/search", params={
        "q": brand,
        "type": "video",
        "order": "date",
        "num": 10,
        "apiKey": API_KEY,
    })

    videos = response.json()["results"]
    today = date.today().isoformat()
    new_today = [v for v in videos if v["publishedAt"][:10] == today]

    if new_today:
        print(f"[{brand}] {len(new_today)} new video(s) today:")
        for v in new_today:
            print(f"  - {v['title']} by {v['channelTitle']}")

Competitor Analysis

Build a dashboard that tracks competitor channels over time. Use the Channel API to pull subscriber counts and video counts on a schedule, then use the Video Details API to analyze their most recent uploads for engagement patterns.

import requests

API_KEY = "your_api_key_here"
COMPETITORS = ["@competitor1", "@competitor2", "@competitor3"]

for handle in COMPETITORS:
    # 1. Get channel stats (1 credit)
    ch = requests.get("https://apiserpent.com/api/youtube/channel", params={
        "handle": handle,
        "apiKey": API_KEY,
    }).json()["result"]

    # 2. Search for their recent videos (1 credit)
    videos = requests.get("https://apiserpent.com/api/youtube/search", params={
        "q": ch["title"],
        "type": "video",
        "order": "date",
        "num": 20,
        "apiKey": API_KEY,
    }).json()["results"]

    # 3. Batch fetch full details for engagement metrics (1 credit for up to 50)
    video_ids = [v["videoId"] for v in videos if "videoId" in v]
    if video_ids:
        details = requests.get("https://apiserpent.com/api/youtube/video", params={
            "id": ",".join(video_ids[:50]),
            "apiKey": API_KEY,
        }).json()["results"]

        avg_views = sum(int(d["viewCount"]) for d in details) / len(details)
        print(f"{ch['title']}: {ch['subscriberCount']:,} subs, "
              f"avg {avg_views:,.0f} views/video")

Trend Tracking

Monitor trending topics and emerging content patterns in any niche. Use the search endpoint with order=viewCount to find the most-viewed videos for any topic, or order=date to catch emerging trends before they go viral. Combine with Serpent's web search and news search endpoints to correlate YouTube trends with broader search interest across the web.

Research & Dataset Building

Academic researchers, data scientists, and AI teams use YouTube data for sentiment analysis, language modeling, and content categorization. The batch Video Details endpoint is ideal for building large datasets efficiently: 50 videos per credit means you can compile metadata for 500,000 videos for just $10. Full descriptions, tags, and engagement metrics are included in every response.

Creator Tools & Analytics Platforms

Build tools that help YouTube creators analyze their niche and optimize their strategy. Search for top videos in a category, fetch their details to analyze optimal title lengths, tag usage, posting schedules, and engagement patterns, then present actionable insights to creators through a dashboard or report.

Rate Limits & Best Practices

Rate Limits by Tier

Tier Requests/Minute Queue Priority
Free 10/min Lowest
Paid (default) 50/min Normal
Tier 1 ($50+ balance) 100/min High
Tier 2 ($100+ balance) 200/min Highest

Best Practices

Serpent vs. Official YouTube Data API

Here is a direct comparison between Serpent API's YouTube endpoints and Google's official YouTube Data API v3:

Dimension YouTube Data API v3 Serpent API
Setup required Google Cloud project + OAuth credentials Single API key
Daily quota (free tier) 10,000 units (~100 searches/day) No daily cap
Cost per 1K searches Free up to quota, then apply for increase $0.20 flat
Authentication OAuth 2.0 / API key + project API key only
Batch video details 50 per request (costs 1 unit) 50 per request (costs 1 credit)
Rate limiting model Per-project daily quota Per-minute, tier-based
Scaling Quota increase requires Google approval (weeks) Pay-as-you-go, instant scaling
Write access Yes (upload, manage playlists, comments) Read-only

The official YouTube Data API is the right choice if you need write access (uploading videos, managing playlists, posting comments) or if you need to access private channel data via OAuth. For read-only access to public YouTube data—which covers the vast majority of developer use cases—Serpent API is simpler to integrate, has no daily quota walls, and costs a predictable $0.20 per 1,000 queries.

Getting Started

You can start making YouTube API calls in under two minutes:

  1. Create a free account at apiserpent.com/login. No credit card required.
  2. Generate an API key from your API Keys dashboard.
  3. Make your first request using any HTTP client:
# Quick test with curl
curl "https://apiserpent.com/api/youtube/search?q=python+tutorial&type=video&num=5&apiKey=YOUR_KEY"

# Batch video details
curl "https://apiserpent.com/api/youtube/video?id=dQw4w9WgXcQ,jNQXAC9IVRw&apiKey=YOUR_KEY"

# Channel lookup
curl "https://apiserpent.com/api/youtube/channel?handle=@mkbhd&apiKey=YOUR_KEY"

Your free account includes 100 credits to test all endpoints—YouTube, web search, news, and images. Once you have validated your integration, add credits through the billing dashboard with pay-as-you-go pricing. No subscriptions, no monthly minimums.

For the full API reference including every endpoint and parameter, see our API documentation. If you are evaluating SERP API providers more broadly, our SERP API pricing comparison covers cost analysis across multiple providers.

Try Serpent YouTube API Free

100 free credits included. No credit card required. Search videos, fetch details in batch, and look up channels in seconds.

Get Your Free API Key

Explore: YouTube API · Social Media API · Pricing · Try in Playground