Google Search · JavaScript
const params = new URLSearchParams({
"engine": "google",
"q": "best brazilian footballer",
});
const response = await fetch(`https://www.searchapi.io/api/v1/search?${params}`, {
headers: { Authorization: `Bearer ${process.env.SEARCHAPI_API_KEY}` },
});
console.log(await response.json());
const params = new URLSearchParams({
"engine": "google",
"q": "best brazilian footballer",
});
const response = await fetch(`https://www.searchapi.io/api/v1/search?${params}`, {
headers: { Authorization: `Bearer ${process.env.SEARCHAPI_API_KEY}` },
});
console.log(await response.json());
The key is read from SEARCHAPI_API_KEY and sent as a Bearer token.