Products / SERP API
SERP API
Get Google Search results, Ads and AI Overviews by query, location and device, as structured JSON or HTML.
i
API credentials are separate from your proxy login and dashboard sign-in. Get them from the product page in the dashboard.
Endpoint and authentication
| Setting | Value |
|---|---|
| Endpoint | POST https://api.crawlhub.ai/v1/queries |
| Authentication | HTTP Basic with your API username and password |
| Request body | JSON, sent with Content-Type: application/json |
| Response | JSON with parse: true, otherwise the results page HTML |
| Client timeout | 180 seconds. Pages with JavaScript rendering are slower. |
Basic request
Search Google in the US and get parsed results.
curl -X POST https://api.crawlhub.ai/v1/queries \
-u "USERNAME:PASSWORD" \
-H "Content-Type: application/json" \
--max-time 180 \
-d '{"source":"google","query":"running shoes","geo_location":"United States","parse":true}'import requests
payload = {
"source": "google",
"query": "running shoes",
"geo_location": "United States",
"parse": 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": "running shoes",
"geo_location": "United States",
"parse": 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":"running shoes","geo_location":"United States","parse":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":"running shoes","geo_location":"United States","parse":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": "running shoes",
"geo_location": "United States",
"parse": 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": "running shoes",
"geo_location": "United States",
"parse": 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" => "running shoes",
"geo_location" => "United States",
"parse" => 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.bodyExample response
Values below are illustrative. The response has three blocks: paid (ads), ai_overviews and organic. AI Overviews need render: "html", see AI Overviews. Without parse: true, the response is the results page HTML.
JSON
{
"results": [
{
"content": {
"url": "https://www.google.com/search?q=running+shoes",
"page": 1,
"results": {
"paid": [
{
"pos": 1,
"pos_overall": 1,
"title": "Running Shoes Sale – Up to 40% Off",
"url": "https://shop.example.com/running",
"url_shown": "shop.example.com › running",
"desc": "Free delivery on orders over $50. Shop the new season range."
}
],
"ai_overviews": [
{
"pos_overall": 2,
"answer_text": "Good running shoes match your foot type, running surface and distance. Cushioned shoes suit long road runs, while trail shoes add grip and protection.",
"source_panel": [
{
"title": "How to choose running shoes",
"url": "https://www.example.org/guide"
},
{
"title": "Running shoe types explained",
"url": "https://www.example.net/types"
}
]
}
],
"organic": [
{
"pos": 1,
"pos_overall": 3,
"title": "The Best Running Shoes of 2026",
"url": "https://www.example.org/best-running-shoes",
"url_shown": "example.org › best-running-shoes",
"desc": "We tested 40 pairs on road and trail to find the best running shoes for every runner."
},
{
"pos": 2,
"pos_overall": 4,
"title": "Running Shoes for Men and Women",
"url": "https://www.example.net/running",
"url_shown": "example.net › running",
"desc": "Browse cushioned, stability and trail running shoes from top brands."
}
]
},
"parse_status_code": 12000
},
"page": 1,
"job_id": "1234567890",
"status_code": 200
}
]
}Main parameters
| Parameter | Description |
|---|---|
source | Required. Use google. |
query | Required. Search text, operators allowed. |
parse | true for JSON, false for HTML (default). |
geo_location | Country, city, coordinates or Criteria ID |
domain | Google domain, com by default |
locale | Interface language |
user_agent_type | Device, desktop by default |
start_page / pages | Pagination, both default to 1 |
All options: Search Parameters.
Learn more
Search ParametersPagination, filters and device.LocalizationCountry, city, coordinates, language.Structured ResultsOrganic, paid and other modules.AI OverviewsCollect Google's AI answer.
Delivery
Requests are Realtime by default: the result comes back on the same connection. For larger workloads, use async jobs.
Push-PullSubmit jobs, poll status, fetch results.Batch RequestsMany searches in one request.CallbacksGet notified when a job is done.