How to Migrate from Google Custom Search JSON API to TinySearch

Pooja GurungPooja Gurung
How to Migrate from Google Custom Search JSON API to TinySearch

To migrate from Google Custom Search JSON API to TinySearch, replace the endpoint, send your TinyFish key in the X-API-Key header, rename q to query, remove cx, and read results from results[], using url instead of Google’s link field. Then test filters, pagination, errors, and result quality before switching production traffic.

Google’s documentation confirms that the JSON API is closed to new customers and will be discontinued on January 1, 2027. Our Google Custom Search API shutdown guide explains the affected products.

TinySearch supports the same basic workflow—a query in, ranked web results out—but it does not reproduce every Google feature or ranking.

TL;DR

  • Finish before January 1, 2027. Existing Google Custom Search JSON API integrations need an alternative before discontinuation.
  • Change requests and response handling. Replace the endpoint and credentials, translate parameters, and read TinySearch’s result fields.
  • Resolve compatibility gaps early. Image search, custom engine settings, date sorting, and some response metadata need separate decisions.
  • Plan for peak traffic. The migration guide lists free access at 30 requests per minute and 500 per hour, with Search Packs offering higher limits. Confirm the applicable capacity and billing for your account.
  • Test before cutover. Compare representative queries and downstream application results, then switch traffic gradually.

Who needs to migrate from Google Custom Search API?

Applications that call the Google Custom Search JSON API need a migration plan. That includes backend search services, AI agents, research assistants, scheduled jobs, and applications using Google’s Python or Node.js client libraries.

Image-search integrations are affected too. If your requests include searchType=image, replacing the web-search endpoint alone will not preserve that feature.

The retiring JSON API is distinct from Google’s embedded Search Element. Review the product your application actually uses rather than assuming every Google-powered search box follows the same migration path. Our Custom Search JSON API explainer covers that distinction.

Also establish whether your application searches a predefined collection of websites or the wider public web. The difference between full-web search and site search affects which restrictions you must preserve.

Use TinyFish in your agent

Add TinyFish to ChatGPT, Claude, Cursor and more in one click.

Connect TinyFish

Google Custom Search JSON API to TinySearch: What changes?

The request and response changes are small for basic web search. The important work is preserving the behavior your application depends on.

ComponentGoogle Custom Search JSON APITinySearch
HTTP methodGETGET
Endpointhttps://www.googleapis.com/customsearch/v1https://api.search.tinyfish.ai
API-key authenticationkey query parameterX-API-Key header
Search engine IDcx requiredNot required
Query parameterqquery
Results arrayitems[]results[]
Results per request1–10Up to 10
Accessible result rangeUp to 100Up to 110 across pages 0–10
Search typesWeb and imageWeb, news, and research papers
Response formatJSONJSON

These are API limits, not guarantees that every query returns the maximum number of results. TinySearch also does not inherit the configuration associated with your Google engine ID.

Google Custom Search API migration checklist

SEARCH MIGRATION • 10 CHECKPOINTS

Google Custom Search API
Migration checklist

Complete the controlled production rollout before January 1, 2027.
01 Identify every API dependency and its owner.
02 Configure TinyFish keys securely for each environment.
03 Update endpoints, credentials, and request parameters.
04 Update response parsing and any result-count displays.
05 Resolve unsupported features and engine restrictions.
06 Test pagination boundaries, error handling, and retries.
07 Validate peak request capacity and account billing.
08 Compare representative queries against agreed acceptance criteria.
09 Complete a controlled production rollout before January 1, 2027.
10 Monitor usage and remove unused legacy configuration safely.

How to migrate from Google Custom Search JSON API to TinySearch

Use the following seven steps to move from dependency discovery to production cutover. The technical migration guide includes complete parameter mappings, adapters, and additional examples.

Step 1: Identify every Google Custom Search API dependency

Start with an inventory of call sites and configuration. Search application code for direct requests, client-library calls, and environment variables:

code
rg -l 'customsearch/v1|customsearch\.googleapis\.com|cse\(\)\.list|google\.customsearch' .
rg -l 'customsearch|GOOGLE_CSE|CSE_ID|SEARCH_ENGINE_ID' --glob '!*.lock' .

These commands list matching files, including broader matches that need manual review. Also inspect wrappers that construct a Google customsearch client, configuration with differently named keys, notebooks, scheduled scripts, and no-code workflows.

Code search alone cannot establish that nothing else uses the API. In Google Cloud Monitoring, select the Consumed API resource and filter by service = 'customsearch.googleapis.com' to inspect activity across the projects you operate.

For each integration, record its owner, request parameters, consumed response fields, traffic volume, and failure behavior. A service reading only titles and URLs needs less adaptation than one relying on PageMap metadata, image results, or custom engine rules.

Step 2: Create a TinyFish API key

Sign in and open the TinyFish API Keys page. Create a separate key for each environment and store it immediately; keys are shown only once.

For a local shell session, set:

code
export TINYFISH_API_KEY="your_api_key_here"

For deployed applications, supply the key through your existing secret-management configuration. Keep it out of source control, browser-side code, screenshots, and logs.

The authentication documentation specifies the X-API-Key header for REST requests. The Python SDK reads TINYFISH_API_KEY from the environment automatically.

Step 3: Replace the endpoint and translate request parameters

Keep the query unchanged while testing the request translation. These examples use data retention regulations.

Before: Google Custom Search JSON API

code
curl -G "https://www.googleapis.com/customsearch/v1" \
  --data-urlencode "key=$GOOGLE_API_KEY" \
  --data-urlencode "cx=$GOOGLE_CSE_ID" \
  --data-urlencode "q=data retention regulations"

After: TinySearch

code
curl -G "https://api.search.tinyfish.ai" \
  --data-urlencode "query=data retention regulations" \
  -H "X-API-Key: $TINYFISH_API_KEY"

Use a newly created TinyFish key; do not move the Google key into the new header. Removing cx also removes the reference to your configured Google engine, so recreate the restrictions your application still needs.

Google parameterTinySearch approachImportant distinction
keyX-API-Key headerUse your TinyFish key
qqueryKeep the search text
cxRemoveRecreate relevant engine rules separately
siteSearch + siteSearchFilterinclude_domains or exclude_domainsDomain lists are not URL-path patterns
gllocationTranslate country codes and test targeting behavior
lrlanguageA simple lang_en becomes en; complex language expressions need review
dateRestrictrecency_minutesConvert the time window; month/year approximations need care
startpage plus local offset handlingOne-based result offset becomes zero-based pagination
numSlice results in application codeAdditional pages may be needed
searchType=imageNo direct equivalentUse a separate image-search source

Move an engine’s included and excluded domains into the corresponding comma-separated filters. A restriction such as example.com/docs/* requires additional handling because a domain filter alone also permits other paths. Post-filtering can reduce the number of usable results.

Set country and language explicitly when they matter to your application. The TinySearch search reference documents defaults of location=US and language=en when both are omitted. Setting only one can automatically select the other, which may change the audience your results target.

For dates, dateRestrict=d7 corresponds to a seven-day window of 10080 minutes. Calendar-month requirements may be better expressed with explicit date bounds. Do not combine recency_minutes with after_date or before_date.

TinySearch also accepts an optional purpose describing the search intent. Add it after establishing a baseline so you can evaluate its effect separately. Use the complete parameter mapping for parameters beyond this shortlist.

Step 4: Update response parsing and migrate your Python integration

Update both the client call and the fields consumed downstream. A successful request is not enough if your application still looks for Google’s items[].link.

Before: Google Custom Search API Python example

code
import os
from googleapiclient.discovery import build

service = build(
    "customsearch",
    "v1",
    developerKey=os.environ["GOOGLE_API_KEY"],
)

res = service.cse().list(
    q="data retention regulations",
    cx=os.environ["GOOGLE_CSE_ID"],
).execute()

for item in res.get("items", []):
    print(item["title"], item["link"])

After: TinySearch Python example

code
from tinyfish import TinyFish

client = TinyFish()

response = client.search.query(
    query="data retention regulations"
)

for result in response.results:
    print(result.title, result.url)

Ensure the tinyfish package is installed in the environment running the new integration. Update and lock your application’s dependencies through its normal package-management process.

The JSON below is shortened from the real response published in TinyFish’s migration guide, captured there on November 29, 2026. It shows one result with selected fields; the other results and the result-count field are omitted. It is not a newly executed search.

code
{
  "query": "data retention regulations",
  "results": [
    {
      "position": 1,
      "site_name": "europarl.europa.eu",
      "title": "Towards new EU data retention rules",
      "url": "https://europarl.europa.eu/RegData/etudes/BRIE/2026/789333/EPRS_BRI(2026)789333_EN.pdf"
    }
  ],
  "page": 0
}
Google response fieldTinySearch field or handling
items[]results[]
items[].titleresults[].title
items[].linkresults[].url
items[].snippetresults[].snippet
items[].displayLinkresults[].site_name
searchInformation.totalResultsNo equivalent estimated total
queries.nextPageApplication-managed pagination
items[].pagemapNo direct equivalent

TinySearch’s total_results counts results returned on the current page. Do not use it to display an estimated number of all matching pages or calculate a total page count. Also check how your interface renders snippets, missing dates, and empty values.

Step 5: Update pagination, error handling, and retries

Google uses a one-based result offset, start. TinySearch uses a zero-based page number, page.

Google startTinySearch page
10
111
212

These mappings translate result positions, not Google’s rankings. They assume ten-result boundaries. In Python, for an arbitrary starting position, calculate page = (start - 1) // 10 and the within-page offset (start - 1) % 10.

For example, start=8 and num=10 spans two TinySearch pages: take the final three positions from page 0 and up to seven from page 1. Validate bounds and handle shorter responses; do not assume every page is full or request a page beyond 10.

Update retries using the HTTP status and structured error details:

  • Invalid input or authentication: Fix the parameters or key rather than repeatedly sending the same request.
  • Per-minute throttling: Respect Retry-After when returned.
  • Daily allowance exhaustion: A 429 with details.reason="free_allowance_exhausted" should not trigger short-backoff retries. The documented daily reset is 00:00 UTC.
  • Insufficient credits: For 402 INSUFFICIENT_CREDITS, resolve the account condition or wait for an applicable allowance reset. Adding funds does not by itself enable wallet spending.
  • Temporary server errors: Use bounded exponential backoff, with jitter where appropriate.

The TinySearch error reference distinguishes these cases. Check your SDK’s retry behavior before adding another retry loop. A failed request must remain an error, not become an empty search result.

Step 6: Test Google Custom Search and TinySearch side by side

While Google access remains available, select 50–200 representative queries from your application logs, including difficult queries and important filters. This is a starting sample suggested by the migration guide, not a universal acceptance threshold.

Run both providers under comparable conditions and define pass criteria before reviewing the results.

Evaluation criterionWhat to measure
RelevanceWhether the top results satisfy the user’s intent
Source coverageWhether required sources are discoverable
Result overlapShared URLs among the top results
LatencyMedian (p50) and p95 response times from your application
Downstream outcomesQuality of final application or AI-generated answers
ReliabilityErrors, timeouts, retries, and application behavior

Overlap is a diagnostic, not a quality score. Different URLs can answer the same question well. Compare against your configured Google API results rather than assuming they match google.com.

Repeat a subset of queries to understand normal result variation. Include no-result queries, restrictive domain filters, non-English searches, and pagination boundaries. Test authentication failures and throttling separately from relevance. Record actual test results before making performance claims or approving production cutover.

Step 7: Switch production traffic and remove legacy dependencies

Deploy to staging first, then put provider selection behind a feature flag. Begin with a controlled share of production traffic and monitor errors, latency, result quality, and quota consumption.

Confirm capacity for peak traffic before increasing the rollout. A successful low-volume test does not establish that the application can sustain a production burst.

Rollback to Google is only possible while your existing access remains available. Complete the transition before discontinuation rather than relying on Google as a long-term fallback.

After the new path is validated, remove obsolete search configuration and dependencies. Revoke a Google key only after confirming that no other service still uses it. Monitor TinySearch usage through the dashboard or the Runs API linked from its API reference.

How can you migrate without rewriting every integration?

A compatibility adapter can translate TinySearch responses into Google-style fields such as items[].link. That lets existing consumers continue working while you update call sites incrementally.

The official guide provides Python and TypeScript Google-shaped adapters. They cover common request translations and result fields, and raise errors for unsupported parameters rather than silently ignoring them.

Treat the adapter as a migration aid, not a complete emulation. It does not restore Google rankings, engine configuration, estimated result totals, or PageMap metadata. The published examples slice a single fetched page, so requests spanning page boundaries require additional handling.

Keep compatibility tests around every field your callers consume. Once those callers use your new search interface, remove the temporary adapter if it no longer serves a purpose.

Which Google Custom Search API features have no direct TinySearch equivalent?

Resolve unsupported features before changing production requests. Several differences affect application behavior rather than just parameter names.

Google featureMigration consideration
Dedicated image searchUse a separate image-search source
Phrase, term, and file-type parametersNo direct parameters for exactTerms, excludeTerms, orTerms, or fileType; test any query syntax before depending on it
Configurable page sizeSlice results and retrieve additional pages where required
Custom engine configurationsRecreate supported restrictions; review refinements, promotions, and synonyms separately
Sort by dateDate filters narrow the window but do not reproduce chronological sorting
SafeSearch and licensing filtersValidate suitable controls or choose a source with the required support
Estimated total-result countsChange pagination and count-display logic
PageMap metadataRetrieve relevant page metadata separately where available; do not assume schema equivalence
Exact Google rankingsEvaluate against application requirements

Post-processing is not automatically equivalent to provider-side filtering. If content safety, licensing, or exact restrictions are required, test the complete behavior before accepting the replacement.

Applications using Google Custom Search API image search need a separate plan for that feature even if their web-search migration is straightforward.

Can TinySearch handle your production search volume?

Compare daily usage with peak per-minute and per-hour traffic. A generous daily allowance can still be unsuitable for a concentrated burst.

The comparison below uses Google’s published limits and TinyFish’s migration guide. Capacity information was reviewed on December 3, 2026; confirm the limits and billing enabled for your account before rollout.

CapacityGoogle Custom Search JSON APITinySearch migration guide
Free daily allowance100 queriesUp to 12,000 requests, subject to shorter-window limits
Free-tier rate limitsCheck Google Cloud project quotas30 requests per minute and 500 per hour
Higher capacityPublished ceiling of 10,000 queries per daySearch Packs up to 1,200 requests per minute
Higher-capacity arrangementExisting service and billing termsMigration guide lists Search Packs without a contract; custom limits also available

The migration guide describes Search Packs as an option beyond the free tier, so exceeding 30 requests per minute does not by itself establish that an enterprise contract is required. Confirm the pack’s rate limit, included usage, overage charges, and activation process before changing your traffic allocation.

Use your existing Google search costs and quotas as a baseline and discuss production capacity with TinyFish before cutover.

After validating the migration, evaluate additional capabilities against a specific application need:

  • News search: Use domain_type=news for news-oriented results.
  • Research-paper search: Use domain_type=research_paper, with pub_year_min and pub_year_max for publication-year bounds.
  • Calendar windows: Use after_date and before_date for supported search types. Research-paper searches use year filters instead.
  • Multiple domains: Include or exclude several domains in one request.
  • Search intent: Add purpose to supply context about how the results will be used.
  • Page retrieval: Follow TinySearch discovery with TinyFetch when your application needs page content beyond snippets.

Introduce these changes separately from the initial cutover so their effects remain measurable.

Migration guide conclusion

Make the switch to TinySearch before January 1, 2027

A successful migration preserves the search experience your application depends on. Map your existing requests, resolve feature gaps, and test real queries before moving production traffic. Use the migration checklist to track what’s complete and what still needs attention.

Start with the technical migration guide for parameter mappings and adapter examples. If you need help choosing capacity or planning the rollout, talk to the TinyFish team about your workload and requirements.

AI disclosure

Content on this website may be created or refined with the assistance of AI tools and is subject to human editorial review.

FAQ

Questions, answered.

Is TinySearch a drop-in replacement for Google Custom Search JSON API?

How long does it take to migrate from Google Custom Search API?

Do I need a Google search engine ID to use TinySearch?

Does TinySearch return the same search results as Google?

Can I increase my TinySearch rate limit without an enterprise contract?

Get started

Start building.

No credit card. No setup. Run your first operation in under a minute.

Get $8 in Wallet fundsRead the docs