Google's Custom Search API shuts down Jan 1. Migrate by changing one URL.
If you have code that calls https://www.googleapis.com/customsearch/v1 , it stops working on January 1, 2027 . Google has already closed the API to new customers, and existing ones are being moved off it. I went through this myself and ended up building a small open-source tool for it. This post covers what's changing, what your options are, and the approach I went with, including where it falls…
Google is shutting down its Custom Search JSON API on January 1, 2027. Developers currently using the API, which provided 100 free queries per day and $5 per 1,000 queries, need to migrate to an alternative solution. The API can no longer be used for general web search, as Google only offers partner-only options with no public pricing.
There are three options for migration:
1. Rewrite the code to use a new search API, such as Serper, Exa, or Tavily. However, each API returns a different JSON format, requiring parsing, pagination, and error handling adjustments.
2. Switch to Google's Vertex AI Search, which is suitable for searching private content or a limited set of sites (up to 50 domains). This also requires a code rewrite.
3. Keep the same API shape and swap the backend, using a thin layer that mimics the old API. This approach involves deploying a Cloudflare Worker that forwards requests to a new provider while maintaining the same parameters and response format.
The article describes an open-source tool called cse-compat, which serves the custom search API with the same parameters, response fields, and error format as the original API. It forwards requests to Serper, a SERP API, while preserving the original API shape. cse-compat can be deployed on Cloudflare for free and requires providing a Serper API key and custom keys for the proxy. The tool handles key aspects like no results, pagination limits, error formats, and total results.
Before January 1, 2027, developers should save real responses from their existing Custom Search API key to compare the results with their new provider. The article notes that results will not match Google's index exactly, as they are sourced from the replacement provider.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.