using System;
using System.Net.Http;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var query = System.Web.HttpUtility.ParseQueryString(string.Empty);
query["engine"] = "youtube_video";
query["q"] = "abc";
query["no_cache"] = "false";
query["api_key"] = "YOUR_API_KEY";
var response = await client.GetAsync(
$"https://serpapi.abcproxy.com/search?{query}"
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
import java.net.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://serpapi.abcproxy.com/search" +
"?engine=youtube_video" +
"&q=abc" +
"&no_cache=false" +
"&api_key=YOUR_API_KEY";
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream())
);
String response = in.lines().collect(Collectors.joining());
System.out.println(response);
}
}
API Parameters
Search Query
Name
Type
Required
Description
Example
v
string
No
Parameter defines the Video ID.
123
Localization
Name
Type
Required
Description
Example
gl
string
No
us
hl
string
No
en
Pagination
Name
Type
Required
Description
Example
next_page_token
string
No
Parameter defines the next page token. It is used for retrieving the next page results for related videos, comments or replies. It should be one of
- related_videos_next_page_token
- comments_next_page_token
- comments_sorting_token.token
- replies_next_page_token
from the search results.
-
Serpapi Parameters
Name
Type
Required
Description
Example
engine
string
Yes
Set parameter to youtube_video to use the YouTube Video API engine.
youtube_video
no_cache
boolean
No
Parameter will force SerpApi to fetch the YouTube Video results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to false (default) to allow results from the cache, or true to disallow results from the cache.
trueorfalse
api_key
string
Yes
Parameter defines the SerpApi private key to use.
-
Response
Success 200
Response Body
{
"search_metadata": {
"raw_html_file": "https://webserp.abcproxy.com/files/f2af9b62c9f11ab5/c12beb3e-3067-4acb-ba1f-ca15b2bbaed6.html",
"xray_html_file": "https://webserp.abcproxy.com/files/f2af9b62c9f11ab5/c12beb3e-3067-4acb-ba1f-ca15b2bbaed6.xray",
"total_time_taken": "10.2821",
"id": "c12beb3e-3067-4acb-ba1f-ca15b2bbaed6",
"json_endpoint": "https://webserp.abcproxy.com/files/f2af9b62c9f11ab5/c12beb3e-3067-4acb-ba1f-ca15b2bbaed6.json",
"created_at": "2025-04-14 17:28:43",
"youtube_video_url": "https://www.youtube.com/watch?v=vFcS080VYQ0"
},
"search_parameters": {
"engine": "youtube_video",
"v": "vFcS080VYQ0",
"no_cache": true,
"fetch_mode": "dynamic",
"api_key": "21a9e021a236d0b8c980d6d616f4bd19"
},
"thumbnail": "https://i.ytimg.com/vi/vFcS080VYQ0/maxresdefault.jpg",
"views": "2.2M views",
"published_date": "9 years ago",
"related_videos": [
{
"thumbnail": {
"static": "https://i.ytimg.com/vi/N6BJVM5tvnw/hqdefault.jpg?sqp=-oaymwEmCKgBEF5IWvKriqkDGQgBFQAAiEIYAdgBAeIBCggYEAIYBjgBQAE=&rs=AOn4CLAsaThDb2HP8Byh9Cogw6eoHurEjA",
"rich": "https://i.ytimg.com/vi/N6BJVM5tvnw/mqdefault_6s.webp?sqp=-oaymwEmCKgBEF5IWvKriqkDGQgBFQAAiEIYAdgBAeIBCggYEAIYBjgBQAE=&rs=AOn4CLAsaThDb2HP8Byh9Cogw6eoHurEjA"
},
"title": "Coffee Roasting Explained",
"published_date": "1 year ago",
"views": "1.5M views",
"extracted_views": 1,
"channel": {
"name": "James Hoffmann",
"link": "https://www.youtube.com/watch?v=N6BJVM5tvnw&pp=0gcJCX4JAYcqIYzv",
"thumbnail": "https://i.ytimg.com/vi/N6BJVM5tvnw/hqdefault.jpg?sqp=-oaymwEmCKgBEF5IWvKriqkDGQgBFQAAiEIYAdgBAeIBCggYEAIYBjgBQAE=&rs=AOn4CLAsaThDb2HP8Byh9Cogw6eoHurEjA",
"verified": true
},
"video_id": "N6BJVM5tvnw&pp=0gcJCX4JAYcqIYzv",
"link": "https://www.youtube.com/watch?v=N6BJVM5tvnw&pp=0gcJCX4JAYcqIYzv",
"length": "18:38"
},
{
"title": "Jon Stewart & Pete Buttigieg on Tariffs, Trump Chaos and the Democrats’ Future | The Weekly Show",
"published_date": "3 days ago",
"views": "1.4M views",
"extracted_views": 1,
"channel": {
"name": "The Weekly Show with Jon Stewart",
"link": "https://www.youtube.com/watch?v=4rHKwHQUa78",
"verified": true
},
"video_id": "4rHKwHQUa78",
"link": "https://www.youtube.com/watch?v=4rHKwHQUa78"
},
"..."
],
"title": "The basics about: Coffee",
"channel": {
"thumbnail": "https://yt3.ggpht.com/ytc/AIdro_kMZ5WTp1HyAeBY2MwKPN5lZqyatfx9LzFKolh6v_OTdBo=s48-c-k-c0x00ffffff-no-rj",
"link": "https://www.youtube.com/@OldGameBox",
"subscribers": "16.4K subscribers",
"extracted_subscribers": 164000,
"name": "Old Game Box"
},
"description": {
"content": "I'm no expert, but I do enjoy a nice cup of coffee.\n\n\n\nI know this channel is about games, but you drink something while playing every now and then, right?"
},
"chapters": [
{
"title": "Intro"
},
{
"title": "Types of coffee"
},
{
"title": "Roasts"
},
{
"title": "Water"
}
]
}
Response Fields
Field
Type
Description
search_metadata
object
Contains timing and status information
search_parameters
object
Contains query parameters and search context
organic_results
object[]
OrganicResults
related_videos
object
RelatedVideos
chapters
object
Chapters
description
object
Description
Error Responses
Common Errors
HTTP Status
Error Code
Description
200
400
API Key can not be empty
200
401
Param error
200
402
Api key error
200
403
Insufficient Balance
200
404
Deduction failed
200
405
Failed to record usage count
200
406
Unsupported engine
200
407
Network error
200
408
File not found
200
409
Limit param error
200
410
Build url error
200
411
Failed to QueryRecentRecord
200
412
Failed to find json
200
413
Get html error
200
414
HTML is empty
200
429
Too many request
Error Example
{
"code": 400,
"message": "API Key can not be empty"
}
Parameter defines the country to use for the Youtube video. It's a two-letter country code. (e.g., us for the United States, uk for United Kingdom, or fr for France) Head to the for a full list of supported Google countries.
Parameter defines the language to use for the Youtube video. It's a two-letter language code. (e.g., en for English, es for Spanish, or fr for French). Head to the for a full list of supported Google languages.