Hi
In below code i am getting error.
Error 404 (Not Found)!!1
404. That’s an error.
The requested URL /v2/reports/reports?key=ApiKey was not found on this server. That’s all we know.
public void VideoContentDetails()
{
Int32 Count = 1;
StringBuilder htmlTable = new StringBuilder();
List listVideo = new List();
var client = new RestClient("youtubeanalytics.googleapis.com/v2/reports");
var request = new RestRequest("reports", Method.GET);
request.AddParameter("key", "ApiKey");
var response = client.Execute(request);
}
Thanks
Sandhiya PriyaPosted Jan 2, 2026, 11:50 AM
You’re getting 404 – Not Found because the YouTube Analytics API endpoint is incorrect and incomplete in your request. The HTML you pasted is actually Google’s default 404 error page, not something caused by your C# code syntax.
Let’s break it down clearly.
The main issues in your code are:
Wrong base URL + resource combination
Missing required query parameters
YouTube Analytics API does NOT work with API key alone
1. Incorrect URL construction
You are doing this:
This results in:
That URL does not exist, which is why Google returns 404.
2. Correct base URL
The correct base URL should include https and should not duplicate
reports.Correct base URL:
3. YouTube Analytics API requires OAuth 2.0
? Important
You cannot access YouTube Analytics reports using just an API key.
The API requires:
OAuth 2.0 authentication
An access token
A valid authorized YouTube channel
So this will always fail:
4. Required parameters for
/reportsThe
/reportsendpoint requires mandatory parameters such as:idsstartDateendDatemetricsWithout these, the request is invalid even if authentication works.
5. Correct example (URL format)
A valid request looks like this:
And it must include an OAuth Bearer token.
6. Correct RestSharp example (simplified)
7. Why LAN or browser tests may confuse you
Opening the URL directly in a browser ? returns 404
Using API key ? unauthorized for Analytics API
Missing OAuth token ? request rejected
This behavior is expected.
summary
•
/v2/reports/reportsis invalid• API key alone will not work
• Required parameters are missing
• Use correct base URL
• Authenticate using OAuth 2.0
• Pass required query parameters
Satya KarkiPosted Feb 8, 2023, 7:49 AM
Hi Ramco, check your API Key whether it is correct and try.
Rijwan AnsariPosted Feb 8, 2023, 7:08 AM
Replace with correct ApiKey.
Rijwan AnsariPosted Feb 8, 2023, 7:07 AM
Hi,
I think your API key is incorrect or missing scope.
Naimish MakwanaPosted Feb 8, 2023, 6:43 AM
Hello Ramco,
Try below code.
Thanks
Naimish Makwana
Amit MohantyPosted Feb 8, 2023, 6:29 AM
Try this