Query Google and get structured results - rank, title, URL, snippet, and domain - as JSON. This page shows a Google search in the JavaScript and Python SDKs and with plain curl, plus the parameters that matter most for Google: region, lang, and the site, file, and date filters.
Examples run against OpenSERP Cloud at https://api.openserp.org with a Cloud API key. The identical request works on a self-hosted open-source OpenSERP server by pointing the SDK at your own baseUrl instead of passing apiKey.
export OPENSERP_API_KEY="osk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Basic query
JavaScript / TypeScript
npm install @openserp/sdk
import { OpenSERP } from "@openserp/sdk";
const client = new OpenSERP({ apiKey: process.env.OPENSERP_API_KEY });
const { results } = await client.search({
engine: "google",
text: "golang tutorial",
limit: 10,
region: "US",
lang: "EN",
});
for (const r of results) {
console.log(r.rank, r.title, r.url);
}
Python
pip install openserp
import os
from openserp import OpenSERP
with OpenSERP(api_key=os.environ["OPENSERP_API_KEY"]) as client:
response = client.search(engine="google", text="golang tutorial", limit=10, region="US", lang="EN")
for r in response.results:
print(r.rank, r.title, r.url)
curl
curl "https://api.openserp.org/v1/google/search?text=golang+tutorial&limit=10®ion=US&lang=EN" \
-H "Authorization: Bearer $OPENSERP_API_KEY"
Prefer to see it first? Run the same query in the Search Playground and copy the generated
curl.
Region and language
Google localizes heavily, so region and lang change the ranking you get back. Pass an ISO country code for region and a language code for lang:
# Google results as seen from Germany, in German
curl "https://api.openserp.org/v1/google/search?text=beste+kopfhoerer®ion=DE&lang=DE" \
-H "Authorization: Bearer $OPENSERP_API_KEY"
Common values: region = US, GB, DE, FR, RU, JP; lang = EN, DE, FR, ES, RU, ZH. If you track rankings, always pin region - the default US result set differs from what a user in another country sees.
Filters
Google supports the full filter set. Combine them freely:
# PDF files about transformers on arxiv.org, published in 2025
curl "https://api.openserp.org/v1/google/search?text=transformers&site=arxiv.org&file=pdf&date=20250101..20251231" \
-H "Authorization: Bearer $OPENSERP_API_KEY"
| Parameter | Example | Effect |
|---|---|---|
site |
github.com |
Restrict to one domain. |
file |
pdf |
Restrict to a file type. |
date |
20250101..20251231 |
Restrict to a published-date range. |
start |
10 |
Page offset for deeper results. |
Check a domain’s Google rank
A common use case - find where your site ranks for a keyword:
import os
from openserp import OpenSERP
target = "go.dev"
with OpenSERP(api_key=os.environ["OPENSERP_API_KEY"]) as client:
response = client.search(engine="google", text="go programming language", region="US", limit=20)
hit = next((r for r in response.results if r.domain and r.domain.endswith(target)), None)
print(hit.rank if hit else "not in top 20")
To compare that same rank across Google, Bing, and Yandex in one call, see megasearch & ranking diff.
Next steps
- Create an API key and run your first Google query.
- Bing Search API example - the closest alternative engine.
- Endpoints reference - every parameter and the full response envelope.