DEV Community

Tarek Etman for SpecStream

Posted on

Google Custom Search JSON API Shuts Down January 1, 2027: Drop In Migration Guide for Python, Node.js, LangChain, and n8n

Google Custom Search JSON API is already closed to new customers and shuts down permanently for existing customers on January 1, 2027. That leaves less than four weeks to cut over production apps, RAG pipelines, and internal automations before googleapis.com/customsearch/v1 starts returning errors.

SpecStream exposes a wire compatible /customsearch/v1 endpoint that returns Google's exact JSON shape (items[].title, link, snippet, displayLink, searchInformation.totalResults, and queries.nextPage). You swap the base URL and API key, keep your existing parser untouched, and pay $1 per 1,000 searches ($0.80 per 1,000 pages for Extract API). New accounts start with $2 of free credit and require no card (2,000 live searches).

Reference links:

What changes in your code

Only two things change: the host moves from https://www.googleapis.com (or https://customsearch.googleapis.com) to https://api.specstream.ai, and key becomes your SpecStream API key. The cx parameter is accepted and ignored so existing query builders do not break.

1. Python (requests)

import os
import requests

# Before (Google Custom Search JSON API, retiring Jan 1, 2027):
# url = "https://www.googleapis.com/customsearch/v1"
# params = {"key": os.environ["GOOGLE_API_KEY"], "cx": os.environ["GOOGLE_CX"], "q": "eu dora compliance", "num": 10}

# After (SpecStream drop in route, $1 per 1,000 searches):
url = "https://api.specstream.ai/customsearch/v1"
params = {
    "key": os.environ["SPECSTREAM_API_KEY"],
    "q": "eu dora compliance",
    "num": 10,
    "start": 1,
}

resp = requests.get(url, params=params, timeout=30)
resp.raise_for_status()
data = resp.json()

for item in data.get("items", []):
    print(item["title"], item["link"], item["snippet"])
Enter fullscreen mode Exit fullscreen mode

The key also works via X-Goog-Api-Key or Authorization: Bearer <key>.

2. Node.js (fetch)

const params = new URLSearchParams({
  key: process.env.SPECSTREAM_API_KEY,
  q: "eu dora compliance",
  num: "10",
  start: "1",
});

// Swap only the host from https://www.googleapis.com to https://api.specstream.ai
const res = await fetch(`https://api.specstream.ai/customsearch/v1?${params}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();

for (const item of data.items ?? []) {
  console.log(item.title, item.link);
}
Enter fullscreen mode Exit fullscreen mode

3. LangChain (GoogleSearchAPIWrapper or custom tool)

If your LangChain agent uses requests or a custom Tool wrapper around Custom Search, point the base URL to https://api.specstream.ai/customsearch/v1. If you also want clean Markdown page text from the returned URLs for RAG, pair it with POST https://api.specstream.ai/v1/extract at $0.80 per 1,000 pages:

import os
import requests
from langchain_core.tools import tool


@tool
def web_search(query: str) -> list[dict]:
    # Search the live web using the Google Custom Search compatible endpoint.
    r = requests.get(
        "https://api.specstream.ai/customsearch/v1",
        params={"key": os.environ["SPECSTREAM_API_KEY"], "q": query, "num": 10},
        timeout=30,
    )
    r.raise_for_status()
    return [
        {"title": i["title"], "link": i["link"], "snippet": i["snippet"]}
        for i in r.json().get("items", [])
    ]
Enter fullscreen mode Exit fullscreen mode

4. n8n (HTTP Request node)

In any existing n8n workflow with an HTTP Request node calling Google CSE:

  1. Change URL from https://www.googleapis.com/customsearch/v1 to https://api.specstream.ai/customsearch/v1.
  2. Replace the key query parameter (or add header Authorization: Bearer {{ $env.SPECSTREAM_API_KEY }}).
  3. Leave all downstream JSON expressions ({{ $json.items[0].link }}, {{ $json.items[0].snippet }}) unchanged.

Cost comparison

Provider Search price per 1,000 Page extraction per 1,000 Free signup credit
Google Custom Search JSON API $5.00 (shuts down Jan 1, 2027) Not included Closed to new users
SpecStream (/customsearch/v1) $1.00 $0.80 (/v1/extract) $2 free credit, no card (2,000 searches)

At 100,000 searches per month, moving from Google CSE ($500/mo) to SpecStream drops the search bill to $100/mo with zero schema rewrite.

Test the live endpoint directly in Postman at https://www.postman.com/specstream-9463290/specstream/collection/58935676-1e5394c9-e645-46d0-80d0-6cac5378f9ec, or read the full Python migration guide at https://specstream.ai/google-custom-search-api-migration-python and shutdown breakdown at https://specstream.ai/google-custom-search-api-shutdown.

Top comments (0)