October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Custom Search JSON API

Google Images API Tutorial: Search Images with the Custom Search JSON API (Current Through 2026)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Short answer: Google’s documented image-search interface is the Custom Search JSON API connected to a Programmable Search Engine. Create or use a search engine, obtain an API key, copy its cx ID, then send a GET request to https://www.googleapis.com/customsearch/v1 with q and searchType=image. However, Google says the API is closed to new customers and is scheduled to discontinue it on January 1, 2027. Treat this tutorial as a guide for existing customers and a migration-planning reference, not as a new production dependency.

Current as of September 2026. Verify Google’s service documentation before launch because availability, quotas and pricing can change.

What Google’s Images API actually is

There is not a separate endpoint named “Google Images API.” Image results are a mode of the Custom Search JSON API. The API performs one documented list GET operation against https://www.googleapis.com/customsearch/v1 and returns JSON containing search metadata and result items.

Your request must identify three things:

  • key: your Google API key.
  • cx: the search-engine ID assigned to your Programmable Search Engine.
  • q: the text to search.

Add searchType=image to select image results rather than ordinary web results. A minimal request has this shape:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

https://www.googleapis.com/customsearch/v1?key=YOUR_API_KEY&cx=YOUR_SEARCH_ENGINE_ID&q=QUERY&searchType=image

Keep the API key on a server or in another protected deployment location appropriate to your application. Do not expose a long-lived key in browser JavaScript unless your key restrictions and architecture deliberately support that risk.

Availability, quota and the 2027 sunset

Google’s current overview explicitly states: “The Custom Search JSON API is closed to new customers.” Existing customers receive 100 free queries per day, then pay $5 per 1,000 additional queries, with a maximum of 10,000 queries per day. Google’s documentation lists January 1, 2027 as the discontinuation date.

Item Documented value Planning implication
New-customer access Closed A new project may not be able to obtain service access.
Included usage 100 queries per day for existing customers Cache repeated searches and monitor daily consumption.
Additional usage $5 per 1,000 queries Budget by query count, not by number of images returned.
Daily ceiling 10,000 queries per day for existing customers High-volume applications need another provider or migration plan.
Scheduled discontinuation January 1, 2027 Do not build a long-lived production dependency without a replacement strategy.

The 100-query allowance and 10,000-query maximum are query limits; they are not guarantees about result quality, image rights or uninterrupted availability. Check Google’s official service page for the terms that apply to your account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prerequisites: Programmable Search Engine, cx and API key

  1. Create and configure a Programmable Search Engine. Define the sites or search scope it should cover in the Programmable Search Engine control panel.
  2. Copy the search-engine ID. Google calls this identifier cx. It is distinct from your API key.
  3. Obtain an API key. Apply restrictions and store it according to your server or deployment model.
  4. Confirm that your account is an existing customer. The API is closed to new customers, so a newly created project may not be eligible.

The API key authenticates the request; cx tells Google which Programmable Search Engine configuration to use. Omitting either one produces an unusable request even when the URL and query are correct.

Make your first image-search request

cURL

Replace both placeholders and URL-encode the query. This writes the JSON response to a file:

curl -G "https://www.googleapis.com/customsearch/v1"
--data-urlencode "key=YOUR_API_KEY"
--data-urlencode "cx=YOUR_SEARCH_ENGINE_ID"
--data-urlencode "q=red panda"
--data-urlencode "searchType=image"

Python

Install the requests package if necessary with python -m pip install requests, then run:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

import requests

params = {
"key": "YOUR_API_KEY",
"cx": "YOUR_SEARCH_ENGINE_ID",
"q": "red panda",
"searchType": "image",
}

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", []):
image = item.get("image", {})
print(item.get("title"))
print("source:", item.get("link"))
print("context:", image.get("contextLink"))
print("thumbnail:", image.get("thumbnailLink"))
print("dimensions:", image.get("width"), "x", image.get("height"))

Node.js

In modern Node.js, use the built-in fetch:

const params = new URLSearchParams({
key: 'YOUR_API_KEY',
cx: 'YOUR_SEARCH_ENGINE_ID',
q: 'red panda',
searchType: 'image'
});

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

const response = await fetch(`https://www.googleapis.com/customsearch/v1?${params}`);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
const data = await response.json();

for (const item of data.items ?? []) {
console.log(item.title);
console.log('source:', item.link);
console.log('context:', item.image?.contextLink);
console.log('thumbnail:', item.image?.thumbnailLink);
}

Raw HTTP request

For debugging, inspect the fully encoded URL your HTTP client generated. The essential parameters remain key, cx, q and searchType=image. Never log the API key in shared logs, tickets or client-visible error messages.

Understand the image-result JSON

Each image result item can include ordinary result fields such as a title, snippet and source result URL, plus image-specific metadata. The image object can include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • contextLink: the page associated with the image result.
  • width and height: image dimensions.
  • byteSize: reported image size in bytes.
  • thumbnailLink, thumbnailWidth and thumbnailHeight: thumbnail URL and dimensions.

Field presence can vary by result, so parse optional values defensively. A thumbnail URL is not proof that you have permission to republish the underlying image. Preserve the source and context URLs, review the source site’s license, and obtain permission when your use requires it.

Image filters and result limits

Image size and type

The image-search mode supports image-specific filters for image size and image type. Use the corresponding documented query parameters for the size or type you need, and validate returned dimensions rather than assuming every result meets your application’s minimum.

One hundred results maximum

Google’s API reference states that no more than 100 results are returned for a query, even when more matches exist. Design interfaces around that ceiling. Do not promise users an unlimited image index, and do not spend additional quota expecting pages beyond the documented maximum to reveal more than the service permits.

Result metadata versus downloadable files

The response describes results; it is not a guarantee that every source URL remains reachable or that every image can be downloaded by your server. Sources can move, require access controls, or change their content after Google indexed them. Treat retrieval as a separate operation with its own timeout, validation and rights checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Production implementation checklist

  • Keep the API key server-side and restrict it to the resources and environments that need it.
  • Validate and normalize user queries before sending them.
  • Cache identical searches where freshness requirements allow; this reduces quota use and improves latency.
  • Handle an absent items array as an empty result set rather than crashing.
  • Store source and context URLs with each result so users can inspect provenance.
  • Apply your own image-dimension and content-policy checks before displaying results.
  • Set a client timeout and retry only transient failures with backoff; repeated retries can consume quota.
  • Track requests by day so the 100-query allowance, paid usage and 10,000-query ceiling cannot surprise you.
  • Build an exit plan before January 1, 2027, because Google has announced discontinuation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

“Invalid value for parameter cx” or no results

Check that you copied the complete Programmable Search Engine ID, not the API key or a browser URL. Confirm that the engine’s configured scope can return results for the query.

Authentication or access errors

Verify the key spelling, restrictions and account eligibility. Because the service is closed to new customers, a newly created key may not grant access to this API.

Web results instead of images

Inspect the outgoing query and make sure it contains the exact parameter searchType=image. A missing or misspelled value requests the wrong search mode.

Empty items array

An empty array is a valid response shape. Show an empty-state message, check the query and engine configuration, and avoid assuming that an empty response means your JSON parser failed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quota exceeded

Stop aggressive retries, inspect your daily counters, and add caching or request deduplication. Existing customers have 100 free queries per day, paid queries cost $5 per 1,000, and the documented daily maximum is 10,000.

A result image no longer loads

Use the context URL to inspect the source page. The API’s metadata does not freeze the source’s availability; handle broken links and changed pages in your UI.

Migration planning before January 1, 2027

The discontinuation date makes provider selection an architectural decision. Inventory every place your application depends on Google-specific fields, the cx configuration, daily quota behavior and image filters. Create an adapter around your search interface so a replacement can return your internal result shape. Compare candidates on official availability, image metadata, authentication and setup effort, quota and price, geographic or licensing filters, and migration risk. An unofficial scraper is not equivalent to Google’s documented API; verify its terms, reliability and permission separately before considering it.

Or skip the browser setup

If your real requirement is obtaining a clean screenshot of a web page rather than searching Google’s image index, ScreenshotNeo provides a direct screenshot API and MCP server. A single GET request returns PNG, JPEG, WebP or PDF output:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for request options. Before capture it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and whether the request was billed. Its MCP server includes take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free ScreenshotNeo plan.

Frequently Asked Questions

Is this a Google Cloud Vision or image-understanding API?

No. The tutorial covers the Custom Search JSON API’s image-result mode, which finds indexed image results and metadata. It is not an image-labeling or computer-vision service.

Can a new developer sign up for this API today?

Google’s current overview says the Custom Search JSON API is closed to new customers. Existing-customer access and account terms should be verified directly with Google.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does an image result include a license that permits reuse?

Not necessarily. The response can include source and context URLs, but you must inspect the source’s license and obtain permission when required.

How many results can one query return?

Google’s API reference limits a query to no more than 100 results.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.