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

If you already have access to Google’s Custom Search JSON API, you can retrieve search results with an HTTPS GET request using an API key, a Programmable Search Engine ID (cx), and a query (q). But Google says the API is closed to new customers. If you are starting a new project, assess alternatives such as Vertex AI Search or a commercial SERP API before building around it.

This guide shows how the supported Google API works, how to request and parse results, what its limits mean, and what to consider if you need Google results for a new application.

What Google’s search API does—and who can use it

Google’s supported API for programmatic search is the Custom Search JSON API. It queries a configured Programmable Search Engine and returns results as JSON. A search engine can be configured for a collection of sites or a supported web scope; it is not automatically a byte-for-byte replica of every result and feature shown on google.com.

Google currently describes the Custom Search JSON API as closed to new customers. Existing customers are told to transition to an alternative by January 1, 2027. That makes access status the first decision, not an implementation detail: an API key or engine ID alone does not establish that a new project can enroll.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  • Already enrolled: confirm that your Google account and project retain API access, then use the request format below.
  • Starting now: evaluate Vertex AI Search, which Google names as an alternative, or compare commercial SERP API providers. Confirm each provider’s current coverage, pricing, terms, and result format directly before choosing.
  • Need results specifically from google.com: verify that the selected product actually supports your desired scope and result types. Custom Search JSON API results should not be assumed to reproduce every live Google SERP feature.

Set up the API request

1. Configure a Programmable Search Engine

In the Programmable Search control panel, configure the engine for the sites or web scope your application needs, then copy its engine identifier. This identifier is sent as cx. The engine’s scope determines what the API searches; it is not a substitute for the query.

2. Create and protect an API key

Create an API key for the project that will make requests. Treat it as a credential: keep it on a server or in another appropriately protected environment rather than embedding it in browser code that visitors can inspect. Apply the restrictions available for your deployment and monitor usage.

3. Send a URL-encoded GET request

The endpoint is https://www.googleapis.com/customsearch/v1. The required parameters are key, cx, and q. Use a URL-encoding library instead of concatenating a raw query, because spaces, punctuation, and non-ASCII characters must be encoded correctly.

GET https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=SEARCH_ENGINE_ID&q=how+to+scrape+google+search+results

Google’s REST guide documents a maximum request length of 2,048 characters. Keep the complete URL within that limit, including the encoded query and parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Runnable examples

Replace the example credentials and query with your own. These examples make a single request and parse result items defensively: a successful response can omit items when there are no results.

cURL

curl --get 'https://www.googleapis.com/customsearch/v1' 
  --data-urlencode 'key=YOUR_API_KEY' 
  --data-urlencode 'cx=YOUR_SEARCH_ENGINE_ID' 
  --data-urlencode 'q=how to scrape google search results'

Python

import os
import requests

endpoint = "https://www.googleapis.com/customsearch/v1"
params = {
    "key": os.environ["GOOGLE_API_KEY"],
    "cx": os.environ["GOOGLE_SEARCH_ENGINE_ID"],
    "q": "how to scrape google search results",
}

response = requests.get(endpoint, 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()

Set GOOGLE_API_KEY and GOOGLE_SEARCH_ENGINE_ID in the process environment before running. A timeout prevents the client from waiting indefinitely; handle timeout and HTTP exceptions in production according to your retry policy.

Node.js

const endpoint = 'https://www.googleapis.com/customsearch/v1';
const params = new URLSearchParams({
  key: process.env.GOOGLE_API_KEY,
  cx: process.env.GOOGLE_SEARCH_ENGINE_ID,
  q: 'how to scrape google search results',
});

const response = await fetch(`${endpoint}?${params}`);
if (!response.ok) {
  throw new Error(`Google API request failed: ${response.status} ${await response.text()}`);
}

const data = await response.json();
for (const item of data.items ?? []) {
  console.log(item.title ?? '');
  console.log(item.link ?? '');
  console.log(item.snippet ?? '');
}

Use a supported Node.js version with built-in fetch, or provide a fetch implementation if your runtime does not include it. As with the other examples, keep credentials out of client-visible application code.

Read the response without assuming results exist

The response includes query metadata and may include an items array. Each result item can contain a title, link, and snippet. Treat these fields as data to validate rather than assuming every result has every field.

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.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Use data.items ?? [] (or its language equivalent) so a valid no-results response does not crash the application.
  • Inspect the queries metadata when implementing pagination. Do not invent page offsets or assume more results exist; follow the next-page information returned by the API.
  • Use searchInformation when your interface needs the response’s search metadata. Keep this distinct from the individual result list.
  • Escape result text before inserting it into HTML. API-provided snippets are content, not trusted markup.

Quotas, price, and migration timing

Google’s current overview documents legacy terms for existing Custom Search JSON API customers: 100 queries per day at no charge, then $5 per 1,000 additional requests, with a maximum of 10,000 queries per day. These are existing-customer terms, not an offer new projects can rely on. Google says existing customers have until January 1, 2027 to transition.

Before deployment, recheck Google’s current overview and your project’s actual quota and billing configuration. Track request volume, alert before approaching a limit, and include the migration deadline in your project plan. Do not base a new commercial estimate on legacy prices without confirming they apply to your account.

Display, terms, and the difference from direct scraping

If you show API results to users

Applications displaying Programmable Search results must follow Google’s attribution placement rules. Place the required attribution adjacent to the relevant search box or results as directed by Google’s branding guidance, and review the applicable API and Programmable Search terms before release.

If you mean scraping google.com’s HTML

Automating a browser or fetching result-page HTML directly is a different method from using Custom Search JSON API. The API documentation and terms described here do not settle every legal or contractual question about direct HTML scraping in every jurisdiction. Review current terms and get advice appropriate to your geography and use case rather than assuming direct scraping is universally permitted or prohibited.

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.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Operational practices for a reliable integration

  • Keep the key server-side. Do not publish it in front-end JavaScript, source maps, or client-visible URLs.
  • Encode parameters. Use a URL builder or HTTP client parameters so the query is encoded consistently and the request stays within the documented length limit.
  • Handle failures separately from empty results. An HTTP/API error is not the same as a valid response with no items. Log status and safe diagnostic details without recording credentials.
  • Use bounded retries. Retry only transient failures, with a capped delay and a maximum attempt count. Avoid retry loops that multiply quota use during an outage.
  • Cache where the application permits. Caching can reduce repeat requests and improve response times, but retention and display must remain consistent with the applicable terms and your product’s freshness needs.
  • Monitor schema and usage. Track error rates, latency, request counts, and changes in response handling. Keep parsing tolerant of absent optional fields.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

Enrollment or access is unavailable

Google states that the API is closed to new customers. Confirm whether the Google account and project are existing customers with access. If they are not, do not keep rotating keys in an attempt to solve an enrollment restriction; evaluate an alternative search product.

The request reports a missing or invalid parameter

Check that the request includes key, cx, and q, and that none is blank or misspelled. Confirm that cx is the engine identifier, not a project ID, and that the key belongs to the intended project.

The response has no items

This can be a valid no-results response. Read the query metadata and render an empty state rather than treating the missing array as a parsing failure. If results were expected, check the engine’s configured scope and the exact query.

The query works in a browser but fails in the application

Compare the encoded request parameters, engine ID, key restrictions, and server environment. A key restricted to a different application context may not work from your server. Do not solve this by exposing an unrestricted key to users.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Requests fail on long or unusual queries

Use a URL encoder and check the final request length against Google’s documented 2,048-character limit. Shorten or simplify oversized queries rather than truncating the URL unpredictably.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not a Google search-results API: it captures a page you specify rather than returning search results for a query. If your workflow also needs clean page captures after you have URLs, one GET request can return an image or PDF. See the ScreenshotNeo API documentation.

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

Cookie banners are accepted and 60-plus known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server exposes screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Try ScreenshotNeo free.

Frequently asked questions

What do cx and q mean?

cx identifies the configured Programmable Search Engine, while q contains the search query.

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

Does this API return image results?

The Custom Search JSON API supports web or image results through a configured Programmable Search Engine. Configure the engine and request for the result type your application needs.

Can I use the API key directly in a public website?

Keeping the key server-side is the safer default because client code and requests can be inspected. Use the key restrictions appropriate to your deployment and avoid exposing credentials unnecessarily.

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.