Skip to main content
The Custom Search JSON API returns a single JSON object for every successful GET request to https://www.googleapis.com/customsearch/v1. Before you parse individual results, take a moment to understand the full shape of that object — knowing where totalResults lives versus where each result’s URL lives will save you debugging time later.

Top-Level Response Object

Every response contains the following top-level fields regardless of whether results were found.
string
required
Identifies the resource type. Always "customsearch#search" for Custom Search API responses.
object
Describes the OpenSearch URL template for this API. Primarily used by OpenSearch-compatible clients to construct queries dynamically.
object
Contains metadata about the current search query, the next page of results, and the previous page of results. See Queries Object below for full field details.
object
Reflects configuration from your Programmable Search Engine, including the engine’s human-readable title and any custom facet labels you have defined.
object
Contains aggregate statistics about the search, such as how long it took and the estimated number of results. See Search Information below.
array
An array of search result objects. Each element represents one matching page or image. The array contains between 1 and 10 elements per page (controlled by the num parameter). This field is absent from the response when there are no results — always check for its existence before iterating.

Queries Object

The queries object contains up to three keys: request, nextPage, and previousPage. Each key holds an array with exactly one element — an object describing that query context.
array
Always present. Describes the query that produced the current response.
array
Present when there is a subsequent page of results. Contains one element with the same fields as request, but with startIndex advanced by count. Absent when the current page is the last page or when startIndex + count > 100.
array
Present when the current page is not the first page (startIndex > 1). Contains one element with the same fields as request, but with startIndex decremented by count.

Search Information

number
The time, in seconds, that the backend search took to execute. This is a floating-point number such as 0.237891.
string
A locale-formatted string version of searchTime, for display purposes (e.g., "0.24").
string
The estimated total number of results matching the query, as a string. This number is an approximation and may differ from page to page.
string
A locale-formatted, comma-separated string of totalResults for display (e.g., "1,410,000,000").

Item Fields

Each object in the items array represents one search result. The fields present depend on whether the result is a web page or an image (searchType=image).
string
Always "customsearch#result".
string
The plain-text title of the result page, as shown in search results.
string
The title with HTML markup. Query terms that appear in the title are wrapped in <b> tags. Use this field when rendering results in an HTML context.
The full canonical URL of the result. Use this as the href for the result link.
A shortened, human-readable version of the URL suitable for display beneath the title (e.g., "docs.example.com").
string
A plain-text excerpt from the page that summarizes its content in relation to the query. See Snippets for full details.
string
The same excerpt as snippet but with matching query terms wrapped in <b> tags and line breaks replaced with <br> tags. See Snippets for full details.
string
Google’s cached copy identifier. Combine with https://webcache.googleusercontent.com/search?q=cache:<cacheId> to link to the cached version. Not always present.
string
The URL with spaces and special characters decoded for display.
string
The formatted URL with query terms highlighted in <b> tags.
object
A structured data map extracted from the page. Contains keys such as metatags, cse_image, cse_thumbnail, article, product, person, and others depending on the structured data present on the page. The presence and shape of this object vary widely between results.
object
Present only for image search results (searchType=image). Contains details about the image itself.

Complete Annotated Example

The following is a representative response for the query "open source vector database" with num=2. Fields are annotated with inline comments for clarity.
The items field is omitted entirely from the response when no results are found. Always guard against its absence in your code before iterating:
Use queries.nextPage[0].startIndex as the value for your next start parameter to paginate through results. The API supports pagination up to start=91 (results 91–100), giving you a maximum of 100 results per query.