Skip to the page

Google Custom Search API in Ruby

The call that still answers.

Google ends the Custom Search JSON API on January 1, 2027 and no longer takes new customers. Ruby code that calls googleapis.com/customsearch/v1 cannot get a new key, and its calls stop on that date.

SpecStream answers the same request at https://api.specstream.ai/customsearch/v1 and returns Google's JSON. In Ruby you change the host and the key. items, title, link and snippet come back as before, and any cx is accepted.

Searches cost $5 per 1,000 of up to 10 results, the rate Google charges, with no 10,000 a day cap. SpecStream scores 97.9 F-score on all 1,000 SimpleQA Verified questions, as the benchmarks page shows.

New accounts get $10 of credit, no card. It covers 2,000 searches.

Custom Search from Ruby: SpecStream, Google and Vertex AI Search

SpecStreamGoogle Custom Search JSON APIVertex AI Search
The URI Ruby callsGET https://api.specstream.ai/customsearch/v1 with key, q, num and start. Any cx is acceptedGET https://www.googleapis.com/customsearch/v1 with q, an API key and cx, your Programmable Search Engine IDPOST https://discoveryengine.googleapis.com/v1/{servingConfig}:search, with a different request and reply
Takes new customersYes. A key is ready in a minute with $10 of credit, no cardNo. Closed to new customers, discontinued on January 1, 2027Yes. Its free trial gives 10,000 queries per account a month
What it searchesThe whole live web, read when the call arrives. siteSearch keeps a search to one siteThe Programmable Search Engine you configuredUp to 50 domains. Google asks full web search users to contact it
Price$5 per 1,000 searches of up to 10 results, no daily cap$5 per 1,000 queries after 100 free a day, at most 10,000 a day, for existing customers$1.50 per 1,000 queries on Search Standard Edition, $4.00 on Search Enterprise Edition
What JSON.parse gives youGoogle's JSON: items with title, link, snippet, displayLink, htmlTitle, htmlSnippet and formattedUrl, searchInformation.totalResults and queries.nextPageitems, each with the URL, title and text snippets of a resultIts own reply. Search Enterprise Edition includes generated answers at $4.00 per 1,000 queries
Results a callnum from 1 to 10 and start for later pages, as on Google1 to 10 a call, never more than 100 for a queryBilled per query: each API call to Enterprise Search is one
A busy or failed call429 with Retry-After in Google's error form, not chargedIts terms say you may be charged for each successful requestEvery API call is a request, direct or through an integration or the console

Why Ruby code that called Custom Search moves to SpecStream

Other options for the Custom Search JSON API in Ruby

How SpecStream scores

The same numbers as the benchmarks page, from the official tasks and scorers.

How to run the Ruby example

1. Create a key under Agents & API in the workspace. New accounts start with $10 of credit, no card, which covers 2,000 searches.

2. Export the key and call the route once from a shell.

export SPECSTREAM_API_KEY="your key"
curl "https://api.specstream.ai/customsearch/v1?key=$SPECSTREAM_API_KEY&cx=any&q=open+source+vector+databases&num=3"

3. Save the Net::HTTP example as search.rb and run ruby search.rb. In code that already calls Google, replace https://www.googleapis.com or https://customsearch.googleapis.com with https://api.specstream.ai and the key with the SpecStream key. cx stays.

4. With google-apis-customsearch_v1, add service.root_url = "https://api.specstream.ai/" before the first call, as shown above.

The Python page shows the same move with Google's own Python client.

When you need every match instead of ten links, write the request in plain words. SpecStream reads it back as the conditions each row must meet and the facts to bring back, quotes the most it can cost, and delivers the rows after you approve.

Frequently asked questions

Something we didn't answer? Talk to a human

How do I call the Google Custom Search API from Ruby?
Send GET /customsearch/v1 with key, cx and q through Net::HTTP, parse the body with JSON.parse and read items. Google closed the API to new customers and ends it on January 1, 2027. The same request answers at https://api.specstream.ai/customsearch/v1 with a SpecStream key.
Which Ruby gem is the Google Custom Search client?
google-apis-customsearch_v1, whose CustomSearchAPIService#list_cses sends the call. Its documented address setting is service.root_url=; set it to https://api.specstream.ai/ with a SpecStream key in service.key. Tested on November 10, 2026 with google-apis-customsearch_v1 0.25.0: the gem's own list_cses read 10 results.
When is the Custom Search JSON API shut down?
On January 1, 2027, and new customers are already refused. The shutdown page quotes Google's own dates.
How do I get more than 10 results in Ruby?
Send start: 11, then start: 21, or read queries.nextPage[0].startIndex from each reply. Each page of up to 10 results is one search at $0.005.
Do I still need the cx search engine ID?
No. Any cx is accepted, so credentials that hold one keep working unchanged. SpecStream searches the whole live web, and siteSearch keeps a search to one site.
How much does the Google Custom Search API cost?
$5 per 1,000 queries after 100 free a day, up to 10,000 a day, for existing customers. SpecStream charges $5 per 1,000 searches of up to 10 results with no daily cap, and new accounts get $10 of credit, no card. Every rate is on the pricing page.
What should Ruby do with a 429?
Sleep for the seconds in Retry-After and send the call again; the 429 is in Google's error form and is not charged. The paging example above does this.

Sources

SpecStream wrote this page. Each figure about Google comes from Google's own pages, the gem's setting from the gem's own source, and each other figure from that company's own page.

  1. Google Custom Search JSON API overviewdevelopers.google.com/custom-search/v1/overview, read Nov 9, 2026
  2. Google Custom Search JSON API reference, cse.listdevelopers.google.com/custom-search/v1/reference/rest/v1/cse/list, read Nov 9, 2026
  3. Google Custom Search JSON API, using RESTdevelopers.google.com/custom-search/v1/using_rest, read Nov 9, 2026
  4. Google Custom Search terms of servicedevelopers.google.com/custom-search/terms, read Nov 9, 2026
  5. Programmable Search Engine blog: updates to our web search productsprogrammablesearchengine.googleblog.com/2026/01/updates-to-our-web-search-products.html, read Nov 9, 2026
  6. Google Cloud: Agent Search pricingcloud.google.com/generative-ai-app-builder/pricing, read Nov 9, 2026
  7. Google Cloud: servingConfigs.search methodcloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search, read Nov 9, 2026
  8. Gemini API: Grounding with Google Searchai.google.dev/gemini-api/docs/google-search, read Nov 9, 2026
  9. Brave Search APIbrave.com/search/api/, read Nov 9, 2026
  10. Brave, alternatives to the Google Search APIbrave.com/learn/google-api-shutdown/, read Nov 9, 2026
  11. google-apis-customsearch_v1: service.rbgithub.com/googleapis/google-api-ruby-client/blob/main/generated/google-apis-customsearch_v1/lib/google/apis/customsearch_v1/service.rb, read Nov 10, 2026
  12. google-apis-core: base_service.rbgithub.com/googleapis/google-api-ruby-client/blob/main/google-apis-core/lib/google/apis/core/base_service.rb, read Nov 10, 2026
  13. SpecStream benchmarksspecstream.ai/benchmarks, read Nov 10, 2026
  14. SpecStream pricingspecstream.ai/pricing, read Nov 10, 2026
  15. SpecStream for agentsspecstream.ai/agents.md, read Nov 10, 2026