YouTube keyword search API
Find up to 20 public YouTube videos matching a keyword.
Make a request
GET /youtube/search accepts query parameters. POST /youtube/search accepts the same inputs as JSON. Send your project key in the x-access-key header; keep it on your server.
Credits: 1 credit for up to 50 returned results; 2 credits for 51–100.
curl request example
curl --fail-with-body --get 'https://api.fetchfox.net/youtube/search' \
-H 'x-access-key: YOUR_KEY' \
--data-urlencode 'query=urban gardening' \
--data-urlencode 'limit=20'JavaScript request example
// Run on your server with FETCHFOX_API_KEY set.
const url = new URL('https://api.fetchfox.net/youtube/search');
url.searchParams.set('query', 'urban gardening');
url.searchParams.set('limit', '20');
const response = await fetch(url, {
headers: { 'x-access-key': process.env.FETCHFOX_API_KEY },
signal: AbortSignal.timeout(130000)
});
if (!response.ok) throw new Error('HTTP ' + response.status);
const result = await response.json();
if (!result.success) throw new Error('Request unsuccessful');
console.log(result.data);Python request example
import json, os
from urllib.parse import urlencode
from urllib.request import Request, urlopen
query = urlencode({"query":"urban gardening","limit":20})
request = Request('https://api.fetchfox.net/youtube/search?' + query,
headers={'x-access-key': os.environ['FETCHFOX_API_KEY']})
with urlopen(request, timeout=130) as response:
result = json.load(response)
if not result.get('success'):
raise RuntimeError('Request unsuccessful')
print(result['data'])Replace placeholder source IDs with real public URLs. See limits and retries before automating calls.
Inputs and limits
Search ranking and coverage depend on the public source. This tool returns one bounded batch.
REST and MCP accept limits from 1 to 100, default 20. Browser viewers request 20. Each new request is billed separately; downloading a current browser result does not make another request.
Use comparable observations
Save source URLs and your retrieval time with returned data. Public metrics can change and some counts are rounded. Missing metrics remain null, separately from genuine zero. Search and channel lists are samples, not a complete archive or guaranteed ranking feed.
Video duration alone does not establish whether an item is a Short. Returned dates and descriptions depend on source availability; optional full_details enrichment on /youtube/videos is capped at 30 videos.