Custom Search API
googleapis · Analytics
Searches over a website or collection of websites
Authentication
Sample Requests
Returns metadata about the search performed, metadata about the engine used for the search, and the search results.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1?q=test&cr=example&cx=example&gl=example&hl=example&hq=example&lr=example&alt=json&key=YOUR_API_KEY&num=1&safe=safeUndefined&sort=desc&start=1&c2coff=example&fields=example&filter=example&rights=example&$.xgafv=1&imgSize=imgSizeUndefined&imgType=imgTypeUndefined&orTerms=example&callback=example&fileType=example&linkSite=example&lowRange=example&highRange=example"aUser=example&exactTerms=example&googlehost=example&searchType=searchTypeUndefined&siteSearch=example&uploadType=example&oauth_token=example&prettyPrint=true&relatedSite=example&access_token=example&dateRestrict=example&excludeTerms=example&imgColorType=imgColorTypeUndefined&upload_protocol=example&imgDominantColor=imgDominantColorUndefined&siteSearchFilter=siteSearchFilterUndefined"
import requests
params = {
"q": "test",
"cr": "example",
"cx": "example",
"gl": "example",
"hl": "example",
"hq": "example",
"lr": "example",
"alt": "json",
"key": "YOUR_API_KEY",
"num": "1",
"safe": "safeUndefined",
"sort": "desc",
"start": "1",
"c2coff": "example",
"fields": "example",
"filter": "example",
"rights": "example",
"$.xgafv": "1",
"imgSize": "imgSizeUndefined",
"imgType": "imgTypeUndefined",
"orTerms": "example",
"callback": "example",
"fileType": "example",
"linkSite": "example",
"lowRange": "example",
"highRange": "example",
"quotaUser": "example",
"exactTerms": "example",
"googlehost": "example",
"searchType": "searchTypeUndefined",
"siteSearch": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"relatedSite": "example",
"access_token": "example",
"dateRestrict": "example",
"excludeTerms": "example",
"imgColorType": "imgColorTypeUndefined",
"upload_protocol": "example",
"imgDominantColor": "imgDominantColorUndefined",
"siteSearchFilter": "siteSearchFilterUndefined"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1');
url.searchParams.set('q', 'test');
url.searchParams.set('cr', 'example');
url.searchParams.set('cx', 'example');
url.searchParams.set('gl', 'example');
url.searchParams.set('hl', 'example');
url.searchParams.set('hq', 'example');
url.searchParams.set('lr', 'example');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('num', '1');
url.searchParams.set('safe', 'safeUndefined');
url.searchParams.set('sort', 'desc');
url.searchParams.set('start', '1');
url.searchParams.set('c2coff', 'example');
url.searchParams.set('fields', 'example');
url.searchParams.set('filter', 'example');
url.searchParams.set('rights', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('imgSize', 'imgSizeUndefined');
url.searchParams.set('imgType', 'imgTypeUndefined');
url.searchParams.set('orTerms', 'example');
url.searchParams.set('callback', 'example');
url.searchParams.set('fileType', 'example');
url.searchParams.set('linkSite', 'example');
url.searchParams.set('lowRange', 'example');
url.searchParams.set('highRange', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('exactTerms', 'example');
url.searchParams.set('googlehost', 'example');
url.searchParams.set('searchType', 'searchTypeUndefined');
url.searchParams.set('siteSearch', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('relatedSite', 'example');
url.searchParams.set('access_token', 'example');
url.searchParams.set('dateRestrict', 'example');
url.searchParams.set('excludeTerms', 'example');
url.searchParams.set('imgColorType', 'imgColorTypeUndefined');
url.searchParams.set('upload_protocol', 'example');
url.searchParams.set('imgDominantColor', 'imgDominantColorUndefined');
url.searchParams.set('siteSearchFilter', 'siteSearchFilterUndefined');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1")
q := baseURL.Query()
q.Set("q", "test")
q.Set("cr", "example")
q.Set("cx", "example")
q.Set("gl", "example")
q.Set("hl", "example")
q.Set("hq", "example")
q.Set("lr", "example")
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("num", "1")
q.Set("safe", "safeUndefined")
q.Set("sort", "desc")
q.Set("start", "1")
q.Set("c2coff", "example")
q.Set("fields", "example")
q.Set("filter", "example")
q.Set("rights", "example")
q.Set("$.xgafv", "1")
q.Set("imgSize", "imgSizeUndefined")
q.Set("imgType", "imgTypeUndefined")
q.Set("orTerms", "example")
q.Set("callback", "example")
q.Set("fileType", "example")
q.Set("linkSite", "example")
q.Set("lowRange", "example")
q.Set("highRange", "example")
q.Set("quotaUser", "example")
q.Set("exactTerms", "example")
q.Set("googlehost", "example")
q.Set("searchType", "searchTypeUndefined")
q.Set("siteSearch", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("relatedSite", "example")
q.Set("access_token", "example")
q.Set("dateRestrict", "example")
q.Set("excludeTerms", "example")
q.Set("imgColorType", "imgColorTypeUndefined")
q.Set("upload_protocol", "example")
q.Set("imgDominantColor", "imgDominantColorUndefined")
q.Set("siteSearchFilter", "siteSearchFilterUndefined")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1")
uri.query = URI.encode_www_form({
"q" => "test",
"cr" => "example",
"cx" => "example",
"gl" => "example",
"hl" => "example",
"hq" => "example",
"lr" => "example",
"alt" => "json",
"key" => "YOUR_API_KEY",
"num" => "1",
"safe" => "safeUndefined",
"sort" => "desc",
"start" => "1",
"c2coff" => "example",
"fields" => "example",
"filter" => "example",
"rights" => "example",
"$.xgafv" => "1",
"imgSize" => "imgSizeUndefined",
"imgType" => "imgTypeUndefined",
"orTerms" => "example",
"callback" => "example",
"fileType" => "example",
"linkSite" => "example",
"lowRange" => "example",
"highRange" => "example",
"quotaUser" => "example",
"exactTerms" => "example",
"googlehost" => "example",
"searchType" => "searchTypeUndefined",
"siteSearch" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"relatedSite" => "example",
"access_token" => "example",
"dateRestrict" => "example",
"excludeTerms" => "example",
"imgColorType" => "imgColorTypeUndefined",
"upload_protocol" => "example",
"imgDominantColor" => "imgDominantColorUndefined",
"siteSearchFilter" => "siteSearchFilterUndefined"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1?" . http_build_query([
"q" => "test",
"cr" => "example",
"cx" => "example",
"gl" => "example",
"hl" => "example",
"hq" => "example",
"lr" => "example",
"alt" => "json",
"key" => "YOUR_API_KEY",
"num" => "1",
"safe" => "safeUndefined",
"sort" => "desc",
"start" => "1",
"c2coff" => "example",
"fields" => "example",
"filter" => "example",
"rights" => "example",
"$.xgafv" => "1",
"imgSize" => "imgSizeUndefined",
"imgType" => "imgTypeUndefined",
"orTerms" => "example",
"callback" => "example",
"fileType" => "example",
"linkSite" => "example",
"lowRange" => "example",
"highRange" => "example",
"quotaUser" => "example",
"exactTerms" => "example",
"googlehost" => "example",
"searchType" => "searchTypeUndefined",
"siteSearch" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"relatedSite" => "example",
"access_token" => "example",
"dateRestrict" => "example",
"excludeTerms" => "example",
"imgColorType" => "imgColorTypeUndefined",
"upload_protocol" => "example",
"imgDominantColor" => "imgDominantColorUndefined",
"siteSearchFilter" => "siteSearchFilterUndefined"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Returns metadata about the search performed, metadata about the engine used for the search, and the search results. Uses a small set of url patterns.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict?q=test&cr=example&cx=example&gl=example&hl=example&hq=example&lr=example&alt=json&key=YOUR_API_KEY&num=1&safe=safeUndefined&sort=desc&start=1&c2coff=example&fields=example&filter=example&rights=example&$.xgafv=1&imgSize=imgSizeUndefined&imgType=imgTypeUndefined&orTerms=example&callback=example&fileType=example&linkSite=example&lowRange=example&highRange=example"aUser=example&exactTerms=example&googlehost=example&searchType=searchTypeUndefined&siteSearch=example&uploadType=example&oauth_token=example&prettyPrint=true&relatedSite=example&access_token=example&dateRestrict=example&excludeTerms=example&imgColorType=imgColorTypeUndefined&upload_protocol=example&imgDominantColor=imgDominantColorUndefined&siteSearchFilter=siteSearchFilterUndefined"
import requests
params = {
"q": "test",
"cr": "example",
"cx": "example",
"gl": "example",
"hl": "example",
"hq": "example",
"lr": "example",
"alt": "json",
"key": "YOUR_API_KEY",
"num": "1",
"safe": "safeUndefined",
"sort": "desc",
"start": "1",
"c2coff": "example",
"fields": "example",
"filter": "example",
"rights": "example",
"$.xgafv": "1",
"imgSize": "imgSizeUndefined",
"imgType": "imgTypeUndefined",
"orTerms": "example",
"callback": "example",
"fileType": "example",
"linkSite": "example",
"lowRange": "example",
"highRange": "example",
"quotaUser": "example",
"exactTerms": "example",
"googlehost": "example",
"searchType": "searchTypeUndefined",
"siteSearch": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"relatedSite": "example",
"access_token": "example",
"dateRestrict": "example",
"excludeTerms": "example",
"imgColorType": "imgColorTypeUndefined",
"upload_protocol": "example",
"imgDominantColor": "imgDominantColorUndefined",
"siteSearchFilter": "siteSearchFilterUndefined"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict');
url.searchParams.set('q', 'test');
url.searchParams.set('cr', 'example');
url.searchParams.set('cx', 'example');
url.searchParams.set('gl', 'example');
url.searchParams.set('hl', 'example');
url.searchParams.set('hq', 'example');
url.searchParams.set('lr', 'example');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('num', '1');
url.searchParams.set('safe', 'safeUndefined');
url.searchParams.set('sort', 'desc');
url.searchParams.set('start', '1');
url.searchParams.set('c2coff', 'example');
url.searchParams.set('fields', 'example');
url.searchParams.set('filter', 'example');
url.searchParams.set('rights', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('imgSize', 'imgSizeUndefined');
url.searchParams.set('imgType', 'imgTypeUndefined');
url.searchParams.set('orTerms', 'example');
url.searchParams.set('callback', 'example');
url.searchParams.set('fileType', 'example');
url.searchParams.set('linkSite', 'example');
url.searchParams.set('lowRange', 'example');
url.searchParams.set('highRange', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('exactTerms', 'example');
url.searchParams.set('googlehost', 'example');
url.searchParams.set('searchType', 'searchTypeUndefined');
url.searchParams.set('siteSearch', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('relatedSite', 'example');
url.searchParams.set('access_token', 'example');
url.searchParams.set('dateRestrict', 'example');
url.searchParams.set('excludeTerms', 'example');
url.searchParams.set('imgColorType', 'imgColorTypeUndefined');
url.searchParams.set('upload_protocol', 'example');
url.searchParams.set('imgDominantColor', 'imgDominantColorUndefined');
url.searchParams.set('siteSearchFilter', 'siteSearchFilterUndefined');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict")
q := baseURL.Query()
q.Set("q", "test")
q.Set("cr", "example")
q.Set("cx", "example")
q.Set("gl", "example")
q.Set("hl", "example")
q.Set("hq", "example")
q.Set("lr", "example")
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("num", "1")
q.Set("safe", "safeUndefined")
q.Set("sort", "desc")
q.Set("start", "1")
q.Set("c2coff", "example")
q.Set("fields", "example")
q.Set("filter", "example")
q.Set("rights", "example")
q.Set("$.xgafv", "1")
q.Set("imgSize", "imgSizeUndefined")
q.Set("imgType", "imgTypeUndefined")
q.Set("orTerms", "example")
q.Set("callback", "example")
q.Set("fileType", "example")
q.Set("linkSite", "example")
q.Set("lowRange", "example")
q.Set("highRange", "example")
q.Set("quotaUser", "example")
q.Set("exactTerms", "example")
q.Set("googlehost", "example")
q.Set("searchType", "searchTypeUndefined")
q.Set("siteSearch", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("relatedSite", "example")
q.Set("access_token", "example")
q.Set("dateRestrict", "example")
q.Set("excludeTerms", "example")
q.Set("imgColorType", "imgColorTypeUndefined")
q.Set("upload_protocol", "example")
q.Set("imgDominantColor", "imgDominantColorUndefined")
q.Set("siteSearchFilter", "siteSearchFilterUndefined")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict")
uri.query = URI.encode_www_form({
"q" => "test",
"cr" => "example",
"cx" => "example",
"gl" => "example",
"hl" => "example",
"hq" => "example",
"lr" => "example",
"alt" => "json",
"key" => "YOUR_API_KEY",
"num" => "1",
"safe" => "safeUndefined",
"sort" => "desc",
"start" => "1",
"c2coff" => "example",
"fields" => "example",
"filter" => "example",
"rights" => "example",
"$.xgafv" => "1",
"imgSize" => "imgSizeUndefined",
"imgType" => "imgTypeUndefined",
"orTerms" => "example",
"callback" => "example",
"fileType" => "example",
"linkSite" => "example",
"lowRange" => "example",
"highRange" => "example",
"quotaUser" => "example",
"exactTerms" => "example",
"googlehost" => "example",
"searchType" => "searchTypeUndefined",
"siteSearch" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"relatedSite" => "example",
"access_token" => "example",
"dateRestrict" => "example",
"excludeTerms" => "example",
"imgColorType" => "imgColorTypeUndefined",
"upload_protocol" => "example",
"imgDominantColor" => "imgDominantColorUndefined",
"siteSearchFilter" => "siteSearchFilterUndefined"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/customsearch/v1/customsearch/v1/siterestrict?" . http_build_query([
"q" => "test",
"cr" => "example",
"cx" => "example",
"gl" => "example",
"hl" => "example",
"hq" => "example",
"lr" => "example",
"alt" => "json",
"key" => "YOUR_API_KEY",
"num" => "1",
"safe" => "safeUndefined",
"sort" => "desc",
"start" => "1",
"c2coff" => "example",
"fields" => "example",
"filter" => "example",
"rights" => "example",
"$.xgafv" => "1",
"imgSize" => "imgSizeUndefined",
"imgType" => "imgTypeUndefined",
"orTerms" => "example",
"callback" => "example",
"fileType" => "example",
"linkSite" => "example",
"lowRange" => "example",
"highRange" => "example",
"quotaUser" => "example",
"exactTerms" => "example",
"googlehost" => "example",
"searchType" => "searchTypeUndefined",
"siteSearch" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"relatedSite" => "example",
"access_token" => "example",
"dateRestrict" => "example",
"excludeTerms" => "example",
"imgColorType" => "imgColorTypeUndefined",
"upload_protocol" => "example",
"imgDominantColor" => "imgDominantColorUndefined",
"siteSearchFilter" => "siteSearchFilterUndefined"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with Custom Search API?
Custom Search API is a Analytics API. Developers commonly use analytics APIs for:
- tracking product usage and user behaviour
- building custom reporting and BI dashboards
- measuring marketing and campaign performance
- running funnel, retention, and cohort analysis
- aggregating metrics from multiple data sources
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Custom Search API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide