Back to Blog

Google Search Results API Guide for Developers 2026

Choosing and using a Google Search Results API. Endpoints, response formats, geo-targeting, and integration patterns for Python, Node.js, and Go.

May 23, 2026
By SerpBase Teamgoogle search results apiserp apideveloper guideapi integration

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:

EndpointReturnsCredit Cost
/google/searchOrganic web results1 credit
/google/imagesImage search results2 credits
/google/newsNews/top stories1 credit
/google/videosVideo results2 credits
/google/mapsLocal business listings2 credits
/google/shoppingProduct listings1 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):

Marketglhl
United Statesusen
United Kingdomgben
Japanjpja
Germanydede
Brazilbrpt
Francefrfr

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:

  1. Price per 1K — compounds at scale
  2. Geo coverage — critical for international SEO
  3. Response consistency — stable JSON schema
  4. Latency — sub-2s for real-time applications
  5. 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.