What a Google Search Results API Returns
A Google Search Results API transforms raw search result pages into structured JSON. Instead of maintaining proxy farms and HTML parsers, you get clean data with fields like position, title, URL, snippet, sitelinks, and SERP features.
Core API Endpoints
Most SERP APIs expose multiple endpoints:
| Endpoint | Returns | Credit Cost |
|---|---|---|
/google/search | Organic web results | 1 credit |
/google/images | Image search results | 2 credits |
/google/news | News/top stories | 1 credit |
/google/videos | Video results | 2 credits |
/google/maps | Local business listings | 2 credits |
/google/shopping | Product listings | 1 credit |
Request Parameters
Standard parameters across most SERP APIs:
{
"q": "best SEO tools",
"gl": "us",
"hl": "en",
"page": 1,
"num": 10
}
- q: Your search query
- gl: Country code (geolocation)
- hl: Interface language
- page: Pagination (results beyond first page)
- num: Results per page (usually 10-100)
Sample Response Structure
{
"credits_charged": 1,
"elapsed_ms": 1234,
"organic": [
{
"position": 1,
"title": "Best SEO Tools 2026",
"link": "https://example.com/best-seo-tools",
"snippet": "Comprehensive guide to the best SEO tools...",
"display_link": "example.com › best-seo-tools",
"icon": "https://..."
}
],
"related_searches": ["seo tools free", "seo tools list"],
"ai_overview": { "summary": "...", "sources": [...] }
}
Integration Examples
Python
import requests
api_key = "your-key"
resp = requests.post(
"https://api.serpbase.dev/google/search",
headers={"X-API-Key": api_key, "Content-Type": "application/json"},
json={"q": "python web framework", "gl": "us"}
)
data = resp.json()
for r in data.get("organic", []):
print(f"{r['position']}. {r['title']} - {r['link']}")
Node.js
const resp = await fetch('https://api.serpbase.dev/google/search', {
method: 'POST',
headers: { 'X-API-Key': process.env.API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ q: 'node.js tutorial', gl: 'us' })
});
const data = await resp.json();
data.organic?.forEach(r => console.log(`${r.position}. ${r.title}`));
Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload := map[string]interface{}{"q": "golang", "gl": "us"}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.serpbase.dev/google/search",
bytes.NewBuffer(body))
req.Header.Set("X-API-Key", "your-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
Geo-Targeting for International Results
Proper geo-targeting requires both gl (country) and hl (language):
| Market | gl | hl |
|---|---|---|
| United States | us | en |
| United Kingdom | gb | en |
| Japan | jp | ja |
| Germany | de | de |
| Brazil | br | pt |
| France | fr | fr |
Error Handling Best Practices
try:
resp = requests.post(url, json=payload, headers=headers, timeout=10)
resp.raise_for_status()
data = resp.json()
except requests.exceptions.Timeout:
print("Request timed out, retrying...")
except requests.exceptions.HTTPError as e:
print(f"HTTP error: {e}")
except json.JSONDecodeError:
print("Invalid JSON response")
Rate Limiting and Optimization
- Respect QPS limits (typically 5-50 queries per second)
- Cache results for keywords checked hourly
- Use batch requests where available
- Monitor credit usage via dashboard logs
Choosing the Right Provider
For most developer workflows, prioritize:
- Price per 1K — compounds at scale
- Geo coverage — critical for international SEO
- Response consistency — stable JSON schema
- Latency — sub-2s for real-time applications
- No monthly minimum — flexibility to scale slowly
SerpBase delivers $0.30/1k with 1.4s average latency, geo-targeting in 200+ countries, and no monthly commitment.