Products / SERP API
Search Parameters
Every option for Google web search: query, pagination, device and filters.
Basics
| Parameter | Description | Default |
|---|---|---|
source | Use google. Required. | – |
query | Search text. Google operators like site: work. Required. | – |
parse | true returns structured JSON. false returns the results page HTML. | false |
render | Set to html to load the page in a browser first. Needed for AI Overviews. | – |
user_agent_type | Device and browser, for example desktop, desktop_chrome, mobile_ios or tablet. All presets. | desktop |
Localization
| Parameter | Description | Default |
|---|---|---|
domain | Google domain, for example com, de, co.uk. | com |
geo_location | Location to search from: country, city, coordinates or Criteria ID. See Localization. | – |
locale | Language of the Google interface, for example en-US. | – |
context:results_language | Language of the results, for example de. | – |
Pagination
| Parameter | Description | Default |
|---|---|---|
start_page | First page to fetch. | 1 |
pages | Number of pages to fetch. | 1 |
limit | Results per page. Google decides the real count. | 10 |
context:limit_per_page | Results per page for each page, as [{"page": 1, "limit": 10}]. All pages use the same IP and cookies. | – |
Filtering
| Parameter | Description | Default |
|---|---|---|
context:filter | 0 shows similar results Google would hide. | 1 |
context:safe_search | true turns on SafeSearch. | false |
context:nfpr | true turns off spelling correction. | false |
context:tbs | Google filter string, for example date ranges. | – |
context:tbm | Result tab, for example nws (news) or isch (images). Can't be combined with udm. | – |
context:udm | Newer result tab selector, for example 2 (images). Can't be combined with tbm. | – |
context:fpstate | aig loads more results. Needs render. | – |
i
context: parameters go inside the context array as {"key": "filter", "value": 0}.
Paginated search
curl -X POST https://api.crawlhub.ai/v1/queries \
-u "USERNAME:PASSWORD" \
-H "Content-Type: application/json" \
--max-time 180 \
-d '{"source":"google","query":"public web data","geo_location":"United States","parse":true,"start_page":1,"pages":2,"user_agent_type":"desktop","context":[{"key":"safe_search","value":true}]}'import requests
payload = {
"source": "google",
"query": "public web data",
"geo_location": "United States",
"parse": True,
"start_page": 1,
"pages": 2,
"user_agent_type": "desktop",
"context": [
{
"key": "safe_search",
"value": True
}
]
}
response = requests.post(
"https://api.crawlhub.ai/v1/queries",
auth=("USERNAME", "PASSWORD"),
json=payload,
timeout=180,
)
print(response.json())const payload = {
"source": "google",
"query": "public web data",
"geo_location": "United States",
"parse": true,
"start_page": 1,
"pages": 2,
"user_agent_type": "desktop",
"context": [
{
"key": "safe_search",
"value": true
}
]
};
const res = await fetch("https://api.crawlhub.ai/v1/queries", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + Buffer.from("USERNAME:PASSWORD").toString("base64"),
},
body: JSON.stringify(payload),
signal: AbortSignal.timeout(180000),
});
console.log(await res.json());<?php
$payload = '{"source":"google","query":"public web data","geo_location":"United States","parse":true,"start_page":1,"pages":2,"user_agent_type":"desktop","context":[{"key":"safe_search","value":true}]}';
$ch = curl_init("https://api.crawlhub.ai/v1/queries");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_USERPWD => "USERNAME:PASSWORD",
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 180,
]);
echo curl_exec($ch);package main
import (
"bytes"
"fmt"
"io"
"net/http"
"time"
)
func main() {
payload := []byte(`{"source":"google","query":"public web data","geo_location":"United States","parse":true,"start_page":1,"pages":2,"user_agent_type":"desktop","context":[{"key":"safe_search","value":true}]}`)
req, _ := http.NewRequest("POST", "https://api.crawlhub.ai/v1/queries", bytes.NewReader(payload))
req.SetBasicAuth("USERNAME", "PASSWORD")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 180 * time.Second}
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.*;
import java.time.Duration;
import java.util.Base64;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"source": "google",
"query": "public web data",
"geo_location": "United States",
"parse": true,
"start_page": 1,
"pages": 2,
"user_agent_type": "desktop",
"context": [
{
"key": "safe_search",
"value": true
}
]
}
""";
String auth = Base64.getEncoder().encodeToString("USERNAME:PASSWORD".getBytes());
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.crawlhub.ai/v1/queries"))
.header("Content-Type", "application/json")
.header("Authorization", "Basic " + auth)
.timeout(Duration.ofSeconds(180))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
System.out.println(HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString()).body());
}
}using System.Net.Http.Headers;
using System.Text;
var payload = """
{
"source": "google",
"query": "public web data",
"geo_location": "United States",
"parse": true,
"start_page": 1,
"pages": 2,
"user_agent_type": "desktop",
"context": [
{
"key": "safe_search",
"value": true
}
]
}
""";
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(180) };
var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes("USERNAME:PASSWORD"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth);
var res = await client.PostAsync("https://api.crawlhub.ai/v1/queries",
new StringContent(payload, Encoding.UTF8, "application/json"));
Console.WriteLine(await res.Content.ReadAsStringAsync());require "net/http"
require "json"
uri = URI("https://api.crawlhub.ai/v1/queries")
req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
req.basic_auth("USERNAME", "PASSWORD")
req.body = {
"source" => "google",
"query" => "public web data",
"geo_location" => "United States",
"parse" => true,
"start_page" => 1,
"pages" => 2,
"user_agent_type" => "desktop",
"context" => [
{
"key" => "safe_search",
"value" => true
}
]
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 180) do |http|
http.request(req)
end
puts res.bodyResult counts
Google decides how many links each page has. A higher limit doesn't force more results. Record page and positions, and keep requested and returned counts separate.
Search type
These examples are Google web search. tbm and udm select other tabs and can't be combined in one request.