
A SERP API takes a search query, runs it against a search engine the way a real browser would, and hands you back the results as structured JSON — ranked organic results, ads, People Also Ask, local packs, knowledge panels — instead of a page of HTML you have to parse yourself.
That sounds like a thin wrapper. It isn't, and the reason is worth understanding before you pick one.
Why you cannot just fetch google.com
The obvious implementation is two lines:
import requests
html = requests.get("https://www.google.com/search?q=serp+api").textThis works exactly once, from your laptop, while you are watching it. In production it fails in four distinct ways, and each one fails differently:
- You get a consent interstitial instead of results. Google serves a cookie wall before results in most regions. Your parser sees a page, finds no results, and reports "0 results found" rather than an error.
- You get a soft block. A
429, a redirect to/sorry/index, or a CAPTCHA page — often returned with HTTP200, so naive code treats the block page as a successful empty result. - The layout changes. Google ships SERP markup changes constantly. Class names are obfuscated and rotate. A CSS selector that worked in March returns nothing in April, silently.
- Results are personalised. Without pinned location, language and device, two identical queries return different rankings, which makes your data non-reproducible — fatal if you are tracking positions over time.
Points 1 and 2 are the expensive ones. A scraper that returns an empty list on a block looks healthy on every dashboard you have. You find out weeks later when someone asks why a competitor disappeared from your rank tracker.
The failure mode that costs the most money is not the request that errors. It
is the request that returns 200 OK with a block page in the body. Whatever
you build, make it distinguish "served" from "refused" explicitly.
What a SERP API gives you
A SERP API moves four concerns off your side of the line:
Exit addresses. Requests leave from addresses that look like ordinary users, rotated so that your volume does not concentrate on one IP. This is the part people underestimate — in our own audit of production failures, the exit address, not the browser fingerprint, was the cause in the large majority of cases.
Consent and interstitial handling. The cookie wall, the regional redirect, the "did you mean" bounce — all resolved before you see a response.
Parsing. Google's markup becomes a stable schema. When Google reshuffles their DOM, the provider's parser changes; your code does not.
Pinned context. Location, language, device and domain are explicit request parameters, so the same query returns comparable results tomorrow.
With ScrapEngine that is a single GET:
curl -X GET "https://api.scrapengine.io/api/v1/google/search?q=best%20coffee%20shops&gl=us&num=10" \
-H "Authorization: Bearer YOUR_API_KEY"Pin the context explicitly when you are tracking rankings rather than exploring:
curl -X GET "https://api.scrapengine.io/api/v1/google/search?q=restaurants&location=New%20York%2C%20USA&device=mobile" \
-H "Authorization: Bearer YOUR_API_KEY"The parameters that matter most for reproducibility are gl (country), hl
(interface language), location (the geographic point results are served from),
device (desktop or mobile) and googleDomain. Set them on every call. A
rank you cannot reproduce is not a rank, it is an anecdote.
For large jobs, pass async=true and collect the result by job ID rather than
holding a connection open:
const params = new URLSearchParams({ q: "serp api", gl: "us", num: "10" });
const response = await fetch(
`https://api.scrapengine.io/api/v1/google/search?${params}`,
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
const data = await response.json();How to choose one
Most SERP APIs describe themselves identically. These five questions separate them:
1. What happens on a block?
Ask for the exact response shape when the engine refuses. A provider that returns an empty results array on a block is pushing a silent-failure bug into your codebase. You want a distinct, machine-readable refusal — and you want to know whether you are billed for it. We are not: a wall we could not get through is not a result, so it is not charged.
2. Can you pin location to a real place?
"Country" is not enough for local intent. If you cannot specify a city, the local pack you get back is not the one your customer sees.
3. What is the latency distribution, not the average?
Averages hide the retries. Ask for p50 and p95. Across our own 59-site benchmark corpus the median response is 4.1 seconds; a provider that quotes only "fast" is quoting nothing.
4. Is the schema versioned?
If the provider reshapes their JSON when Google reshapes their DOM, your pipeline breaks anyway and you have bought nothing.
5. Does it cover more than organic results?
Ads, People Also Ask, local packs, shopping, images, news. tbm selects the
vertical. If you only need ten blue links today, you will need the rest within a
quarter.
When you need a scraper instead
A SERP API answers "what does the engine return for this query". It does not fetch the pages behind those results. If your workflow is search, then read the top results, you need both — the search endpoint for the ranking, and a general scraping endpoint for the destination pages:
curl -X POST "https://api.scrapengine.io/api/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/the-ranked-page",
"render": true,
"format": "markdown"
}'format: "markdown" is the one to use when the consumer is a language model —
it strips navigation, scripts and styling down to the prose. We wrote about that
pipeline in HTML to Markdown.
Start here
Pull one query, inspect the shape, then decide:
curl -X GET "https://api.scrapengine.io/api/v1/google/search?q=your%20query&gl=us&num=10" \
-H "Authorization: Bearer YOUR_API_KEY"Full parameter reference is at docs.scrapengine.io, and you can get a key from dashboard.scrapengine.io.
Frequently asked questions
A SERP API runs a query against a search engine from a real browser context and returns the results page as structured JSON — organic results, ads, People Also Ask, local packs — rather than raw HTML you have to parse yourself.
Related guides
- HTTP7 min read403 Forbidden: Why a Scraper Gets One and What Actually Fixes ItWe audited every 403 in our production corpus. The browser fingerprint was almost never the cause — the exit address was. Here is how to tell which one you have.
- HTTP7 min read429 Too Many Requests: Reading Retry-After and Backing Off ProperlyA 429 is the one refusal that tells you how to fix it. Most clients ignore half the instruction — here is how to parse it, and when a 429 is not about rate at all.
- HTTP7 min read503 Service Unavailable: What It Means and How to Get the Page AnywayA 503 can mean a server is overloaded, in maintenance, or quietly refusing you. Here is how to tell the three apart, and what to do about each.