Google's Custom Search JSON API stops on January 1, 2027: a migration checklist with a drop-in Python adapter
Google's Custom Search JSON API is closed to new customers, and existing customers have until January 1, 2027 to move. That is about five weeks from now. If anything you run calls customsearch/v1 (your own code, google-a
Google's Custom Search JSON API is closed to new customers, and existing customers have until January 1, 2027 to move. That is about five weeks from now. If anything you run calls customsearch/v1 (your own code, google-api-python-client, or a plugin that asks for an API key plus a cx engine ID), this checklist is for you.
Disclosure: I work on BestSERP, a Google SERP API, so one of the options below is ours. The checklist and the parameter mapping apply whichever replacement you pick.
What Google actually said
From Google's Custom Search JSON API overview:
- "The Custom Search JSON API is closed to new customers."
- Existing customers "have until January 1, 2027 to transition to an alternative solution."
- "Vertex AI Search is a favorable alternative for searching up to 50 domains."
- For full web search, Google points to a contact form.
The docs don't say what the endpoint returns after the deadline, so plan as if every request fails on January 1.
Not affected: the embedded Programmable Search Element on up to 50 of your own domains. If your users only search your own site through that box, you may not need an API at all.
Your three options
| Vertex AI Search | Google's full web search offer | A SERP API | |
|---|---|---|---|
| Searches | Up to 50 domains you index | The whole web | Google's results page for any query |
| Setup | Cloud project, data store, search app | Contact form | API key |
| Price | $4 per 1,000 queries after 10,000 free/month, plus storage | Not published | Varies by provider (BestSERP: $0.50 per 1,000) |
| Fits | Search on your own sites | A contract with Google | Whole-web searches you did through CSE |
Parameter mapping (cse.list → a SERP API)
Most parameters keep their name or become a Google operator in the query. This is the mapping for BestSERP; other SERP APIs are similar.
| cse.list | Replacement | Notes |
|---|---|---|
key |
X-API-KEY header |
|
cx |
not needed | |
q, gl, hl
|
same names | |
start |
page |
start=11 → page: 2
|
num (1–10) |
num (10–50) |
Ask for 10 and slice |
dateRestrict d1/w1/m1/y1 |
tbs qdr:d/w/m/y |
Only these four map exactly |
siteSearch |
site:example.com in q
|
Also filter results by domain |
exactTerms, fileType
|
"phrase", filetype:pdf in q
|
|
searchType=image |
/images endpoint |
|
safe, lr, cr, image filters |
no equivalent | Flag these in your inventory |
Fields to watch: items[] becomes organic[], displayLink becomes domain, and there is no totalResults or pagemap.
A drop-in adapter (Python)
Keep the Custom Search response shape so the code that reads results doesn't change:
import os, time, requests
API = "https://api.bestserp.com"
HEADERS = {"X-API-KEY": os.environ["BESTSERP_API_KEY"]}
DATE_RESTRICT = {"d1": "qdr:d", "w1": "qdr:w", "m1": "qdr:m", "y1": "qdr:y"}
def cse_list(q, start=1, num=10, siteSearch=None, dateRestrict=None,
gl="us", hl="en", cx=None, **_):
"""Replacement for service.cse().list(...).execute()."""
if siteSearch:
q = f"site:{siteSearch} {q}"
body = {"q": q, "gl": gl, "hl": hl}
if dateRestrict:
body["tbs"] = DATE_RESTRICT[dateRestrict] # KeyError = no exact equivalent
page = (start - 1) // 10 + 1
if page > 1:
body["page"] = page
r = requests.post(f"{API}/search", headers=HEADERS, json=body, timeout=130)
while r.status_code == 202: # long search: poll (polling is free)
time.sleep(2)
r = requests.get(f"{API}/requests/{r.json()['requestId']}",
headers=HEADERS, timeout=130)
r.raise_for_status()
items = [{"title": o.get("title"), "link": o.get("link"),
"displayLink": o.get("domain"), "snippet": o.get("snippet"),
"source": o.get("source")}
for o in r.json().get("organic", [])]
if siteSearch: # safety net: keep on-site results only
items = [i for i in items
if (i["displayLink"] or "").endswith(siteSearch.removeprefix("www."))]
return {"items": items[:num]}
res = cse_list(q="python requests timeout", cx="YOUR_CX")
for i, item in enumerate(res["items"], 1):
print(i, item["displayLink"] or f"({item['source']})", "|", item["title"])
Things we hit while testing this:
-
Match sites on
domain, notlink. Video and social results (YouTube, Stack Overflow, Medium) can come back without a domain; fall back tosource. -
Replace
startloops with one request. Loopingstart=1, 11, 21is three paged calls;num: 30gets the same results in one. - Pages stop at 50 results. CSE went to 100.
-
Test
site:queries before you cut over. Keep the domain filter above as a safety net.
Cost at your volume
Custom Search charged existing customers $5 per 1,000 above 100 free queries a day, capped at 10,000 a day.
| Searches/day | Custom Search JSON API | BestSERP ($0.50/1k) |
|---|---|---|
| 1,000 | $135/month | $15/month |
| 10,000 | $1,485/month | $150/month |
| 50,000 | not possible (daily cap) | $750/month |
Migration checklist
-
Inventory every call now: grep for
customsearch,cse().listandcx=, plugins included. - Pick a replacement per use case: your own sites → Vertex AI Search or the free Search Element; the whole web → Google's offer or a SERP API.
-
Mark the gaps you rely on (
pagemap,totalResults,safe, image filters, results past 50). - Build the adapter behind a switch that keeps the CSE response shape.
- Run both side by side for a week; compare which domains appear, not exact order.
- Cut over by mid-December, keeping CSE as a fallback until December 31.
- Clean up after January 1: delete the Google API key and engine IDs.
The full guide, with the complete field mapping, a Node.js version of the adapter, test results and a troubleshooting table, is on our blog: Custom Search JSON API alternative: migration guide. If you want to try the adapter, BestSERP gives 3,000 free searches with no card.
Which CSE features are you relying on that I haven't covered? Happy to add them to the mapping.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.