Google Search API Use Cases
Learn what Google's Search APIs can do, how to retrieve results, and what to use now that the Custom Search JSON API is closed to new customers.
Short answer: Google’s Custom Search JSON API lets an application retrieve web or image results from a configured Programmable Search Engine. Typical uses include searching one website or a selected collection, building topic-focused search across chosen domains, embedding search into an application, and processing result data as JSON. Google says the Custom Search JSON API is closed to new customers; existing customers must transition by January 1, 2027.
That lifecycle matters when choosing an implementation. Programmable Search Engine remains the broader product for configuring a search experience, while the JSON API is the server or client interface that returns structured results. New projects should evaluate Google’s stated alternatives before investing in a new JSON API integration.
What the Google Search API actually does
The Custom Search JSON API does not provide an unrestricted general-purpose dump of Google’s entire web index. It queries the scope and configuration of a Programmable Search Engine. You create an engine, define the sites or collection it covers, obtain its Search Engine ID (cx), and call the API with an API key and a query.
Google documents two related ways to deliver search:
| Option | How it works | Best fit |
|---|---|---|
| Programmable Search Engine element or hosted page | A Google-provided search box and results experience rendered for users. | Adding visible search to a website with limited backend work. |
| Custom Search JSON API | Your code sends HTTP requests and receives metadata and result entries as JSON. | Applications that need to process, store, rank, or render results themselves. |
See Google’s Custom Search JSON API overview and Programmable Search Engine overview for the product boundaries.
Google Search API use cases
1. Search your own website
Configure a Programmable Search Engine around your domain, then use the element or API to search documentation, a help center, a knowledge base, or a product catalog. This is the clearest answer to “Can I use the Google Search API to search my own website?”: yes, when your engine is configured for that site.
Keep the scope explicit. The engine configuration determines which sources can appear; the API is not a guarantee of complete coverage, instant indexing, or a particular ranking.
2. Search a selected collection of sites
A curated engine can cover multiple domains, such as partner documentation, approved research sources, or an internal collection of public sites. This is useful when users need results constrained to sources you selected instead of an unrestricted web search.
3. Topic-focused search
Programmable Search Engine can focus on a subject across multiple sites and tailor the experience to a defined audience. The result quality still depends on the configured sites, query, and Google’s ranking behavior. Do not describe this as universal coverage.
4. Add search to an application
Use the hosted or client-side search element when your main requirement is a ready-made search interface. Choose the JSON API when your application needs its own result cards, filtering layer, analytics pipeline, or domain-specific presentation.
5. Retrieve results for application processing
The JSON API has one documented list method. A response includes request metadata, search-engine metadata, and result entries. Results can include a URL, title, text snippets, and available rich-snippet information. The documented data model is based on OpenSearch 1.1.
6. Image search
Google documents image results as a supported API use case in addition to web results. Treat image licensing, display rights, and downstream storage as separate decisions; the API’s ability to return image results does not grant reuse rights.
Availability before you build
As of September 29, 2026, Google’s overview states: “The Custom Search JSON API is closed to new customers.” Existing customers have until January 1, 2027 to transition. Do not write a new-project plan that assumes a new API key and engine will be accepted.
Google points users searching up to 50 domains toward Vertex AI Search. For full-web-search requirements, Google asks interested users to contact it about its full-web solution. The cited documentation does not promise feature parity, migration automation, pricing equivalence, or identical ranking between these options.
Also distinguish the discontinued Site Restricted JSON API: Google says that endpoint stopped serving traffic on January 8, 2025 and directs customers to Google Cloud Agent Search. That date is separate from the main Custom Search JSON API’s January 1, 2027 transition deadline.
Setup for an existing Custom Search JSON API customer
- Create or configure a Programmable Search Engine for the sites or collection you need.
- Copy the engine’s Search Engine ID, called
cx. - Use an existing Google API key authorized for the Custom Search API.
- Send a GET request to
https://www.googleapis.com/customsearch/v1withkey,cx, andq. - Read the JSON response and render or process the entries in your application.
Google’s API introduction describes the engine ID and API-key setup. The REST reference documents the list request.
Runnable request examples
Replace YOUR_API_KEY, YOUR_ENGINE_ID, and the query text. These examples use the web-search form of the API.
cURL
curl --get 'https://www.googleapis.com/customsearch/v1' \
--data-urlencode 'key=YOUR_API_KEY' \
--data-urlencode 'cx=YOUR_ENGINE_ID' \
--data-urlencode 'q=payment API documentation'
Python
import requests
params = {
"key": "YOUR_API_KEY",
"cx": "YOUR_ENGINE_ID",
"q": "payment API documentation",
}
response = requests.get(
"https://www.googleapis.com/customsearch/v1",
params=params,
timeout=30,
)
response.raise_for_status()
data = response.json()
for item in data.get("items", []):
print(item.get("title"))
print(item.get("link"))
print(item.get("snippet"))
print()
Node.js
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
cx: 'YOUR_ENGINE_ID',
q: 'payment API documentation'
});
const response = await fetch(
`https://www.googleapis.com/customsearch/v1?${params}`
);
if (!response.ok) {
throw new Error(`Google Search API returned ${response.status}`);
}
const data = await response.json();
for (const item of data.items ?? []) {
console.log(item.title);
console.log(item.link);
console.log(item.snippet);
}
Request options and result handling
key, cx, and q are the essential values. The REST reference lists additional parameters for language, result preferences, pagination, and image searching. Add only options your configured engine and use case require, and URL-encode every query value.
Code defensively around the response:
- An empty result set may omit
items; treat that as a valid zero-result response. - Use the returned URL and title as display data, but expect snippets and rich metadata to vary.
- Log request identifiers and HTTP status codes without logging API keys.
- Validate external URLs before fetching result pages yourself.
Or skip the browser setup
If your real requirement is creating screenshots of search results, documentation pages, or rendered application states, ScreenshotNeo provides a single website-screenshot API request. It is separate from Google’s search products: give it a URL and it returns a PNG, JPEG, WebP, or PDF.
See the ScreenshotNeo API documentation for the available options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests; r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90); open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' }); const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Cookie banners, newsletter popups, and chat widgets are removed before the shot. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Performance, reliability, and cost planning
Performance
- Cache identical queries in your application when freshness allows.
- Keep result rendering separate from the request layer so slow downstream page fetches do not delay search responses.
- Request only the fields and result count your interface needs.
- Use bounded client timeouts and retry only transient failures.
Reliability
- Handle HTTP errors and JSON error objects explicitly.
- Use exponential backoff with a retry limit for temporary failures; do not retry invalid credentials or malformed engine IDs.
- Provide an empty-state message when no results are returned.
- Monitor quota consumption and the January 1, 2027 transition requirement for existing customers.
Cost and eligibility
Google’s published figures apply to existing customers during the transition period: 100 queries per day are free, then $5 per 1,000 additional queries, with a 10,000-query-per-day cap. These are legacy terms, not an offer for new customers or a promise of long-term availability.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 or 403 response | Missing, invalid, or unauthorized API key. | Check the key, enabled API, restrictions, and billing configuration in Google Cloud. |
“Invalid value” for cx |
The engine ID is missing or copied incorrectly. | Copy the Search Engine ID from the configured Programmable Search Engine and URL-encode it. |
Valid response with no items |
No results matched the query within the engine’s scope. | Show a zero-results state and verify the engine includes the expected domains. |
| Results come from unexpected sites | The engine configuration is broader than intended. | Review included and excluded sites, then retest with a distinctive query. |
| Quota errors | Daily usage or the documented cap has been reached. | Reduce duplicate requests, cache results, and review the migration path. |
| Image results are missing | The request or engine is not configured for image search. | Check the image-search option and the REST reference before changing your parser. |
| Site Restricted API no longer works | That endpoint ceased serving traffic on January 8, 2025. | Follow Google’s direction toward Google Cloud Agent Search. |
Choosing an approach
| Requirement | Starting point |
|---|---|
| Visible search box with minimal custom code | Programmable Search Engine element or hosted results page. |
| Custom result cards or backend processing | Custom Search JSON API, only for eligible existing customers. |
| Search up to 50 domains in a new Google project | Evaluate Vertex AI Search, which Google names as an alternative. |
| Full-web search | Contact Google about its full-web solution. |
| Rendered screenshots or PDFs of result pages | ScreenshotNeo, with cleanup and usage-based billing rules described above. |
FAQ
Is the Google Search API the same as Google web search?
No. The Custom Search JSON API queries a configured Programmable Search Engine and its defined scope.
Can a new developer sign up for the Custom Search JSON API?
Google’s overview says it is closed to new customers. Existing customers have until January 1, 2027 to transition.
Does the API search private pages?
The cited documentation describes web and image results from a configured engine. It does not establish private-content indexing or access-control behavior.
Are Google’s legacy prices available for new projects?
No. The 100-free-query and $5-per-1,000 figures are described as existing-customer terms during discontinuation.
What should I migrate to?
Google names Vertex AI Search for searches spanning up to 50 domains and asks full-web-search prospects to contact Google. Compare scope and eligibility before selecting a replacement.

