Google Search Scraper or API: What You Get
A Google Search scraper, or SERP scraper, is code that requests a results page for a query and parses each block on it: organic links, local results, related questions, related searches, filters and paging. You maintain a parser per block type, the request options that shape the page, and the monitoring that catches silent breakage. The alternative is seven Google Search endpoints that return those blocks as named JSON at 1 to 3 credits a call. This post maps each part of a scraper to an endpoint, prices a keyword set, and gives a verdict per use case.
What does a Google Search scraper have to parse?
A Google Search scraper has to parse a page that is a stack of different blocks, each with its own markup, and which blocks appear depends on the query. Your scraper needs a parser for every block you care about and a rule for blocks it doesn't recognise.
The recorded response shows how many blocks one ordinary query produces. For best restaurants in Berlin, the page carried organic results, a local pack with two modules, related questions, related searches, a "people also search for" list, filter chips and links to further pages. A scraper that only reads organic links would miss most of it, and one that reads all of it has eight parsers to keep working.
Then there's order. Knowing a link is "result 1" isn't enough if a local pack sits above it, so a scraper also has to record where each block sits on the page. That means walking the page top to bottom and numbering blocks as it goes, which breaks whenever a new block type appears between the ones it knows.
What else does a SERP scraper maintain?
Beyond parsing, a SERP scraper maintains its request options, request pacing and monitoring. Results depend on country, language, device and location, so the scraper has to set those on every request and keep them consistent between runs. Search engines have to tell people apart from automated traffic, so a scraper running many queries a day should expect slow responses, challenge pages and blocks. When that happens, stop rather than work around it with rotating proxies or CAPTCHA solvers. Read Google's terms of service before you build one. Monitoring compares each run with the last and alerts when a block that was always there comes back empty.
Which endpoint replaces which part of a scraper?
Each of the seven endpoints on the Google Search API covers part of what a SERP scraper does, so you pick by the blocks you need rather than writing parsers for all of them. The full results page comes from search or search-advanced; lighter jobs such as plain result lists, suggestions or an AI overview have their own 1-credit endpoints. All are GET.
| Scraper job | Endpoint | Credits | Required | Optional parameters you'll use first |
|---|---|---|---|---|
| Full results page, every block | /v1/google-search/search |
1–2 | query |
location, gl, hl, device, tbm, start, page |
| Full page plus an AI overview | /v1/google-search/search-advanced |
1–3 | query |
As search, plus fetch_ai_overview |
| A lighter result list | /v1/google-search/search-light |
1 | query |
num, start, page, hl, gl, dateRestrict, sort |
| Query suggestions | /v1/google-search/search-light-autocomplete |
1 | query |
hl, limit |
| The AI overview alone | /v1/google-search/search-ai-overview |
1 | query |
hl, gl, google_domain, uule |
| AI mode answers | /v1/google-search/google-ai-mode-search |
1 | q |
hl, gl, follow_up_token |
| One place's details | /v1/google-search/search-advanced-place |
1 | none | detail_url, svid, hl, gl |
Some parameters take a fixed set of values: device is desktop, tablet or mobile; tbm is isch, vid, nws, lcl, shop or pts; safe is active or off. No defaults or page sizes are documented, so set the ones you depend on on every call. That's the request-options job of a scraper, reduced to query parameters.
What does one full-page call return?
This is the recorded call to search, with the key in the X-API-Key header as the authentication docs describe:
curl "https://api.perceptlayer.com/v1/google-search/search?query=best+restaurants+in+Berlin&hl=en&safe=off" \
-H "X-API-Key: $API_KEY"
The recorded response, trimmed to the parts that replace a scraper's parsers and its page-order logic:
{
"search_information": {
"query_displayed": "best restaurants in Berlin",
"organic_results_count": 6
},
"organic_results": [
{
"position": 1,
"title": "The Best Restaurants in Berlin - Food Guide & Map",
…
"rank_group": 1,
"rank_absolute": 4
},
…
],
…
"local_results": {
"places": [
{
"position": 1,
"title": "BLESS Restaurant",
"rating": 4.8,
"reviews": 2400,
"price": "€20–70",
"type": "Asian",
…
"rank_absolute": 1
},
…
],
"modules": [
{
"title": "Local results",
"place_indexes": [
0
],
"rank_group": 1,
"rank_absolute": 1
},
…
]
},
…
"pagination": [
{
"start": 10,
"link": "https://www.google.com/search?q=best+restaurants+in+Berlin&safe=off&gl=us&hl=en&complete=0&pws=0&nfpr=1&start=10&sstk=…"
},
…
],
…
"serp_results": [
{
"type": "local_results",
"module_index": 0,
"rank_group": 1,
"rank_absolute": 1
},
{
"type": "local_results",
"module_index": 1,
"rank_group": 2,
"rank_absolute": 2
}
],
…
}
How does the response replace page-order logic?
The response records order for you, so you don't number blocks yourself. serp_results lists blocks by type with a rank_absolute, and in this recording its two entries have module_index 0 and 1 and rank_absolute 1 and 2, the same values as the two entries in local_results.modules. Each module's place_indexes holds 0 or 1, matching the positions of the two entries in places. Organic results carry their own rank_absolute, so you can sort every block into one page order.
Paging works the same way: the pagination entries carry start values of 10 and 20, and search takes a start parameter, so the names match. Try the next page in the playground before you rely on it.
How do a SERP scraper and the endpoints compare?
A SERP scraper costs engineering time per block type and carries blocking and terms risk; the endpoints cost 1 to 3 credits per call and return named blocks with their positions. The table compares them for a recurring job, such as tracking a keyword set daily.
| DIY Google Search scraper | Google Search endpoints | |
|---|---|---|
| Setup | Fetcher, one parser per block type, page-order logic, monitoring | API key in the X-API-Key header |
| Blocks | Whatever you write parsers for | organic_results, local_results, related_questions, related_searches, people_also_search_for, filters, pagination |
| Page order | Numbered by your own code | rank_absolute on results and modules, plus serp_results |
| Country, language, device | Rebuilt into every request URL | gl, hl, location, uule, device |
| When the page changes | Parsers return empty values until you fix them | You read named JSON fields; no parser of yours to fix |
| Blocks and challenges | Yours to handle, more likely at volume | Not yours; a failed call returns an error code and costs 0 |
| Speed | As fast as you can fetch without being blocked | 1 request a second free, at least 5 a second paid |
| Cost | Hosting and your time | 1 to 3 credits per successful call by endpoint |
What does a keyword cost to track?
Cost follows calls, one per keyword per check. On search at 1 to 2 credits, 50 keywords once a day is 50 to 100 credits a day, or 1,500 to 3,000 credits over 30 days, inside the Starter pack's 10,000. On search-light at 1 credit, the same set is 50 credits a day, 1,500 over 30 days. Check the search endpoint page for the cost of the calls you plan before you size a pack.
The 100 free credits granted once on signup cover at least 50 full-page searches, which is enough to check the blocks you need for your own queries. Adding a second page for each keyword with start doubles the call count. See pricing for what credits cost and the credits docs for how they're debited.
Reading the blocks in Python
This script makes the recorded call and prints the page in order. It reads only fields that appear in the recording, and treats every block as optional because the mix changes with the query:
import os
import requests
resp = requests.get(
"https://api.perceptlayer.com/v1/google-search/search",
params={"query": "best restaurants in Berlin", "hl": "en", "safe": "off"},
headers={"X-API-Key": os.environ["API_KEY"]},
timeout=60,
)
resp.raise_for_status()
data = resp.json()
print("credits used:", resp.headers.get("X-Credits-Used"))
rows = []
for r in data.get("organic_results", []):
rows.append((r.get("rank_absolute"), "organic", r.get("title"), r.get("link")))
for p in data.get("local_results", {}).get("places", []):
rows.append((p.get("rank_absolute"), "local", p.get("title"), p.get("rating")))
for rank, kind, title, extra in sorted(rows, key=lambda x: x[0] or 999):
print(rank, kind, title, extra)
for q in data.get("related_questions", []):
print("question:", q.get("question"))
Which route should you choose?
Choose by the blocks you need and how often, because that decides whether parser upkeep or per-call credits dominate. For a few searches by hand, use a browser and skip both. The verdicts below assume recurring work.
- Daily rank tracking for a keyword set:
searchwith fixedgl,hlanddevice, storingpositionandrank_absoluteper run. 1 to 2 credits per keyword per day. - Local visibility (who appears in the local pack):
searchwithlocation, readinglocal_results.placesandmodules. Same cost. - Plain result lists at the lowest cost:
search-light, 1 credit per call. - Keyword research from suggestions:
search-light-autocompletewithlimit, 1 credit per query. - Watching AI overviews for your topics:
search-ai-overviewat 1 credit, orsearch-advancedwithfetch_ai_overviewwhen you want the full page in the same call. - Learning how parsing works: build a scraper against a practice site, not a search engine.
- An agent that needs live search: give it these endpoints through the MCP server, as the AI agents docs describe.
call_endpointspends credits on success only.
For another engine's results, Bing Scraper or API covers the same trade-off, and the search engine APIs page lists the rest. To see the blocks for your own queries, run search in the playground on the Google Search API page, then get a free API key when it fits.
APIs in this post
Frequently asked questions
Is scraping Google Search allowed?
That depends on Google's terms of service, how you collect the results and the law where you operate, so read the terms and get legal advice for commercial use. Don't get around blocks, challenges or other protections. The endpoints return data collected from publicly available sources, as found at the time of the call.
What is the difference between a SERP scraper and a SERP API?
A SERP scraper is code you run that fetches a results page and parses each block itself. A SERP API returns the parsed blocks as JSON. Here, search returns organic_results, local_results, related_questions and other blocks, each with a rank_absolute, for 1 to 2 credits per successful call, and you maintain no parser.
Which Google Search endpoint costs least?
search-light, search-light-autocomplete, search-ai-overview, google-ai-mode-search and search-advanced-place each cost 1 credit per successful call. search costs 1 to 2 credits and search-advanced 1 to 3, depending on the call. Failed calls on any of them cost nothing and return X-Credits-Used: 0.
How do I get results for a specific country or device?
Pass gl and hl (two characters each) for country and language, location or uule for a place, and device as desktop, tablet or mobile. Keep them the same on every run if you compare results over time. search-light takes gl and hl but not device or location.
What happens when a search call fails?
You get an HTTP status and a JSON body with an error object holding a code, a message and a request_id, plus X-Credits-Used: 0. A rate-limited call returns 429 with a Retry-After header giving the seconds to wait. The errors docs and rate limits docs cover each case.