YouTube Search by Hashtag API
Provide one of: hashtag, continuationToken. Search YouTube and get matching videos, channels, and playlists
Quick start
cURL
curl --request GET 'https://api.fetchproof.com/v1/youtube/search/hashtag?hashtag=nasa' \
--header 'x-api-key: YOUR_API_KEY' JavaScript
const response = await fetch("https://api.fetchproof.com/v1/youtube/search/hashtag?hashtag=nasa", {
method: 'GET',
headers: {
'x-api-key': process.env.FETCHPROOF_API_KEY,
},
});
const data = await response.json();
console.log(data); Python
import os
import requests
response = requests.get(
"https://api.fetchproof.com/v1/youtube/search/hashtag?hashtag=nasa",
headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json()) Go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/youtube/search/hashtag?hashtag=nasa", nil)
req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
} PHP
<?php
$ch = curl_init("https://api.fetchproof.com/v1/youtube/search/hashtag?hashtag=nasa");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response; {
"success": true,
"credits_remaining": 100,
"credits_charged": 1,
"videos": [
{
"type": "video",
"id": "_cgTVTwu4nw",
"url": "https://www.youtube.com/watch?v=_cgTVTwu4nw",
"title": "NASA Rocket Engine Fireplace - 8 Hours in 4K",
"description": null,
"thumbnail": "https://i.ytimg.com/vi/_cgTVTwu4nw/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAHq3riV3QDRXShajl1JQBw4ZogoA",
"channel": {
"id": "UCLA_DiR1FfKNvjuUpBHmylQ",
"title": "NASA",
"thumbnail": "https://yt3.ggpht.com/eIf5fNPcIcj9ig-wZBeq4stFy1lgjWTW1nLT5dYlFkHZprZ03QBiMcbpwNMB6XSBjrSFGtAGQg=s68-c-k-c0x00ffffff-no-rj"
},
"viewCountText": "633,372 views",
"viewCountInt": 633372,
"publishedTimeText": "1y ago",
"publishedTime": null,
"lengthText": "8:00:29",
"lengthSeconds": 28829,
"badges": []
},
{
"type": "video",
"id": "rN6KtK7IjdQ",
"url": "https://www.youtube.com/watch?v=rN6KtK7IjdQ",
"title": "VERY RARE & VERY LOUD!!! NASA X-59 and F-15 simultaneous departure!",
"description": null,
"thumbnail": "https://i.ytimg.com/vi/rN6KtK7IjdQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCnv-OnRxvEjVjpz5CV1ROnsoyOpg",
"channel": {
"id": "UC3mMzXI4T4FE9QInDwaUO2A",
"title": "Erik’s Aviation",
"thumbnail": "https://yt3.ggpht.com/J7aHRQIbIQFRuUcIJUXZpkiXySBuF8Vp5ktuJkdFhlGLGajci4jN32tVpkCj2Hg1qYCtnk2bqkQ=s68-c-k-c0x00ffffff-no-rj"
},
"viewCountText": "131,539 views",
"viewCountInt": 131539,
"publishedTimeText": "4d ago",
"publishedTime": null,
"lengthText": "1:40",
"lengthSeconds": 100,
"badges": []
},
{
"type": "video",
"id": "7qYeAd7DweA",
"url": "https://www.youtube.com/watch?v=7qYeAd7DweA",
"title": "It's Real! Watch Video: NASA Livestream Captures Mystery Object Near SpaceX Dragon | GRAVITAS",
"description": null,
"thumbnail": "https://i.ytimg.com/vi/7qYeAd7DweA/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBnnm4IOF9q813hTj-Wwpzwel2iZg",
"channel": {
"id": "UC_gUM8rL-Lrg6O3adPW9K1g",
"title": "WION",
"thumbnail": "https://yt3.ggpht.com/evxeFzRem76hjPRh_S_B5MvjNhl4yKjSrIzmvwFx3nyEWHBOPHA4jTum6Yys3HRR0IvYmWud=s68-c-k-c0x00ffffff-no-rj"
},
"viewCountText": "878,912 views",
"viewCountInt": 878912,
"publishedTimeText": "10d ago",
"publishedTime": null,
"lengthText": "3:05",
"lengthSeconds": 185,
"badges": []
}
],
"continuationToken": "4qmFsgLtBRIJRkVoYXNodGFnGsgFQ0NSNl93TkRRMUZSUVVKcGNHNXdabkpzTFZNd2VVOXZRa2RNY2pJNGIxUllaemgyYWpGM1JWbDVMVE13ZDB4RVl6TTNWM1pCVW1sVWR6WnVOWGMzYm5weFdFMVplbU5sV21sYVZDMXRkazFwUjA4M01ESnZObmt5VHkxWWNrRkZXV3AxZFMxM1dtRmtNRzlIVlVGU2FuWnhUalpsY..."
} What it returns
- success boolean
- credits_remaining integer
- credits_charged integer
- videos array
- continuationToken string
- channels array
- playlists array
- shorts array
- shelves array
- lives array
Parameters
Hashtag to search for
Search for all types of content or only shorts
Use continuationToken from the previous response to get the next page.
Use cases
- Find videos grouped under a campaign hashtag
- Collect public event recaps with the event tag
- Track variants of a niche creator-community tag
- Find hashtag results to verify whether a tag has relevant videos
Billing
Errors cost zero credits. Empty results follow this operation’s rules.
Default: 1 credit
An empty result costs 0 credits.
How charges are determined
Cost is decided per call, not per endpoint: the same operation can cost different amounts depending on what it returns.
A call that fails costs 0 credits. A result served from cache costs 0 credits.
`default` is the cost when no rule matches. Rules are evaluated in order and the first whose conditions all hold wins.
A `when` condition is one of: `param` (the request parameter is true), `outcome` (the classifier's outcome), `empty` / `nonEmpty` (a response field is empty and absent, or a non-empty array or string), `flag` (a response field is exactly true).
A cost of `{ perStartedMinute: n, of: [fields] }` is n x max(1, ceil(seconds / 60)), so even a short result bills at least one minute.
Related YouTube endpoints
FAQ
How much does the YouTube Search by Hashtag API cost?
A call costs 1 credit by default. Errors cost 0 credits. New accounts get 100 free credits with no card. After that, credits come in one-time packs that never expire: 25,000 for $27 and 500,000 for $297 (plus any tax). There is no subscription.
What do I need to call it?
An API key in the x-api-key header, plus hashtag, and one of hashtag or continuationToken. You don't need a YouTube account or developer app.
What does it return?
Typed JSON. Top-level fields include videos, continuationToken, channels, playlists, shorts and shelves. The full schema and a real sample response are on this page and in the API reference.
Is this an official YouTube API?
No. Fetchproof is an unofficial API that returns public YouTube data only.