Skip to main content
When you call the Custom Search JSON API, you send a single GET request to Google’s servers, and Google returns a ranked, structured JSON list of results in milliseconds. Under the hood, Google’s web crawler has already visited, indexed, and scored billions of pages — your request simply queries that pre-built index within the scope you define. This page walks you through every stage of that process so you can build confidently on top of it.

The request/response lifecycle

Every search interaction follows the same five-step flow:
1

Your app sends a GET request

Your application issues an HTTP GET request to the Custom Search JSON API endpoint. The three required parameters — your API key (key), your Search Engine ID (cx), and your query string (q) — travel as URL query parameters. No request body is needed.
2

Google authenticates your request

Google validates your key parameter against the Google Cloud project that issued it. If the key is missing, invalid, or over quota, the API returns an error immediately before any search takes place. See Error Codes below for the full list.
3

The Search Engine ID scopes the query

The cx value tells Google which Programmable Search Engine to use. That engine’s configuration — created in the Programmable Search Engine Control Panel — determines whether results come from the full public web or a curated set of specific sites. Google applies that scope before ranking begins.
4

Google queries its index and ranks results

Google searches its pre-built index for documents that match your query within the configured scope. It applies its ranking algorithm — considering relevance signals such as keyword match, link authority, freshness, and user location — and assembles a sorted list of results. Any additional API parameters you supplied (date filters, language, safe search, etc.) are applied at this stage to further filter the candidate set.
5

Google returns a JSON response

A successful request receives an HTTP 200 OK response whose body is a JSON object containing search metadata, engine metadata, and an items array of up to 10 result objects. Your app parses this response and displays results however your UX requires.

Crawling and indexing — what you need to know

Google’s web crawler (Googlebot) continuously discovers and revisits pages across the web, building a searchable index. From a developer perspective, there are three practical implications:

You don't control crawling

The Custom Search API queries Google’s existing index. You cannot trigger a crawl or guarantee that a newly published page appears immediately. Freshness depends on Googlebot’s natural crawl schedule.

Public pages only

Only publicly accessible, non-blocked pages appear in results. Pages behind authentication, disallowed by robots.txt, or marked noindex are excluded.

Index coverage varies

Google does not index the entire web equally. High-authority, frequently updated sites tend to be crawled more often. The totalResults field in the response is an estimate and may not reflect every existing page.

What the Search Engine ID (cx) scopes

The cx parameter is the unique identifier for a Programmable Search Engine you configure in the Control Panel. It is not just an authentication token — it is a search scope definition.
The Search Engine ID (cx) format may look like 8ac1ab64606d234f1 (newer format) or 017576662512468239146:omuauf_lfve (legacy format with colon). Both formats are valid. Copy the value exactly from your Control Panel — do not modify it.
You can further narrow or widen scope at query time using the siteSearch parameter, which overrides the engine’s configured sites for a single request.

What the response contains

A successful 200 OK response is a single JSON object. Here is an annotated overview of its top-level fields:

Pagination

The API returns at most 10 results per request. To retrieve subsequent pages, increment the start parameter. The first result is at index 1; each page advances by num (default 10).
The API can return at most the first 100 results for any query (start max is 91 with num=10). If queries.nextPage is absent from the response, you have reached the last available page.

Error codes

Always check response.items before iterating — the field is absent (not an empty array) when a query returns zero results. A missing items key is not an error; it simply means no results matched within your engine’s scope.

Rate limits and quotas

You can request a quota increase through the Google Cloud Console. All quotas are enforced per Google Cloud project, not per Search Engine ID.