Skip to content
Scrappa Get API key
Google Search API 1-3 credits / request

Google Search Advanced

GET https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile

Fetch a modern Google SERP and return richer structured modules including organic results, ads, People Also Ask, knowledge panels, local packs, news, videos, images, shopping blocks, answer boxes, related searches, spelling corrections, filters, and pagination when present. gl=us and hl=en are used when omitted. page is 0-based: page=0 is the first page and page=1 is the second; start is the preferred explicit result offset. total_results is Google's estimate when exposed and may be null; organic_results_count is the number of returned organic rows. Scrappa does not impose fixed per-key concurrency or requests-per-minute limits. Transient capacity responses include Retry-After, and failed responses including 503 are never charged. External text is returned as valid UTF-8; malformed byte sequences are replaced with the Unicode replacement character (�), while valid Unicode is preserved. Account balance and recent usage are available from GET /api/account/usage and in the dashboard. Explicit empty SERPs return immediately without provider retries, and tbs and as_qdr date filters use bounded retries. Source links are resolved when Google exposes their destinations; unavailable question source links are omitted. Video cards are returned in inline_videos; YouTube cards include channel, raw views and date text, normalized view_count, and publication_age when Google provides the metadata. AI Overview extraction is best effort: ai_overview is populated only when the module is present in the captured HTML. By default the endpoint does not wait for asynchronously inserted AI Overviews, make a secondary Google AI Overview request, or expand the module. Many queries get an AI Overview that Google loads after the page, so ai_overview is null for them. Set fetch_ai_overview=1 to fetch it: when the page has no AI Overview but has the loading placeholder of Google, the endpoint sends one extra Google request and fills ai_overview from the answer. It costs 1 extra credit when that request is sent and answered with HTTP 200, whether or not it returns an AI Overview. It costs nothing extra when the AI Overview was already on the page, when there is no placeholder, when the extra request fails or runs out of time, and for cached responses. search_information.ai_overview_async then shows what happened: not_needed (the AI Overview was already on the page), no_placeholder (Google gave no placeholder, no extra request), fetched (the extra request returned an AI Overview), empty (the extra request was answered but held no AI Overview), failed (the extra request failed or timed out) or skipped (not enough request time left). fetch_ai_overview cannot be combined with udm or tbm. Results from the browser fallback make no extra request and report not_needed or no_placeholder. When captured, cited sources are returned in ai_overview.references (organic citations only; a title is null when Google gives none, never an ID), shopping cards of the AI Overview in ai_overview.products (name, price, rating, reviews, source, link, image) and sponsored cards in ai_overview.ads. Answer tables are text_blocks of type table with table.headers and table.rows, and are part of ai_overview.markdown. Null means the module was absent from the captured response, not that Google never displays one for the query. With tbm=nws, articles are returned in news_results with position, title, link (resolved article URL), redirect_link, source, snippet, date (Google's text), iso_date (UTC ISO 8601) and thumbnail (only when Google exposes a real image URL); organic_results is empty. With tbm=isch, images are returned in images_results with position, title, link (the page that hosts the image), source (site name), original (full image URL), original_width, original_height and thumbnail (only a real http(s) URL, never a data: URI); organic_results is empty. Local-pack-only responses are returned with empty organic_results and remain unbilled; they do not substitute for missing site-filtered results. Responses for a different query and non-definitive responses without usable result modules after retries return an unbilled 503. Local places include an optional website field only for safe external business URLs. When no business website is available, detail_url may contain a sanitized Google /searchviewer link to that place; it is not a business-owned website. Google now answers anonymous detail_url requests with 429 or a /sorry page, so resolve it with GET /api/search-advanced/place?detail_url=..., a separately billed request that returns the website, phone, address, business_id and place_id. Places with a detail_url also carry kgmid, the Knowledge Graph ID read from the link at no extra cost. search_url contains the sanitized Google SERP URL that produced the response. The serp_results collection preserves the DOM order of supported paid cards, local modules, and organic cards. rank_group is the 1-based position within one type; rank_absolute is the 1-based position across those supported types. A multi-place local module occupies one rank_absolute slot, and every nested local_results.places item inherits that rank so clients can merge local and organic results and sort by rank_absolute. Organic links: every organic result has link_resolved. true means link is the destination page. false means link is not a confirmed destination: in the default mode it is still a Google /goto link, which stays valid only for a short time and which you should not store; with links=complete it is the URL shown in the result line of the result. By default (links=fast) the response returns as soon as the page and its instant links are ready, usually in 2 to 4 seconds. When rows are still open the response carries links_pending: {resolve_id, count, resolve_url, retry_after_seconds}. Call GET /api/search-advanced/resolve/{resolve_id} with the same API key to read the destinations: it returns {status, links: [{position, title, link, link_resolved}], pending}. status is pending while the lookups run (ask again after retry_after_seconds, usually 10 to 50 seconds in total), complete when they ended, or failed when they could not run. A row that Google gave no destination for keeps its /goto link and link_resolved false. The resolve endpoint is not billed. A resolve_id works for 24 hours and only for the account that ran the search; any other id returns 404. Add links=complete to get the final links in one response; it waits for them and takes longer, often 10 to 30 seconds.Queries with one OR group of 3 or more terms, especially together with site:, are often blocked by Google, for example site:linkedin.com/in "Company" (CEO OR "Managing Director" OR Inhaber). Scrappa sends such a query to Google unchanged and never rewrites it. A blocked request can answer 503, and failed requests are never charged. Tip: split the terms into OR groups of at most 2 terms, or send separate queries.

Google Search Advanced 1-3 credits / request

Endpoint

Request preview
GET
https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile
Auth header
x-api-key
Cost
1-3 credits / request
query = best restaurants in Berlin
Response preview
200 OK
{
    "search_information": {
        "query_displayed": "best restaurants in Berlin",
        "total_results": 428000000
    },
    "search_url": "https://www.google.de/search?q=best+restaurants+in+Berlin&hl=en&gl=de&complete=0&pws=0&nfpr=1",
    "organic_results": [
        {
            "position": 1,
            "rank_group": 1,
            "rank_absolute": 3,
            "title": "The 38 Best Restaurants in Berlin",
            "link": "https://www.example.com/berlin/best-restaurants",
            "displayed_link": "www.example.com > berlin > best-restaurants",
...

Parameters

Start with the required fields, then add optional filters only when your use case needs them.

Runnable path

1 required parameter needed before sending a request.

30 optional filters available.

query string Required

Search query

Example value best restaurants in Berlin
location string Optional

Location for results (currently ignored by backend)

Example value Austin, Texas
uule string Optional

Encoded location (deprecated; supported)

Example value example
google_domain string Optional

Google domain (e.g., google.de)

Example value example
gl string Optional

Country code (e.g., us, de, fr; default: us, or none with proxy_country)

Example value de
cr string Optional

Restrict results to countries (e.g., countryUS|countryDE)

Example value countryUS
hl string Optional

Interface language code (default: en)

Example value en
lr string Optional

Restrict results to language (e.g., lang_en)

Example value lang_en
device string Optional

Device used to fetch Google results: desktop (default), tablet, or mobile.

Example value mobile
tbs string Optional

Advanced search filters (dates, patents, etc.)

Example value example
as_qdr string Optional

Simple time range filter (e.g., d, w, m, y)

Example value example
safe string Optional

Safe search mode (active, off)

Example value off
nfpr integer Optional

Exclude auto-corrected results (default: 1). Set 0 to allow auto-correction; results for a different query are rejected.

Example value 10
filter integer Optional

Enable/disable similar/omitted filters (0 or 1)

Example value 1
tbm string Optional

Search type (isch, vid, nws, lcl, shop, pts)

Example value example
include_thumbnails boolean Optional

Set 1 to add images that Google only ships inline as a base64 data: URI in thumbnail_base64 (about 2-6 KB each): news card images (tbm=nws) and organic result images without an image URL. Off by default.

Example value true
udm integer Optional

Set 14 to request Google's Web tab: plain web results only, without AI overview, related questions, related searches, ads and other modules. Recommended when you only need the organic results (rank tracking, link lists, research): Web tab pages are the most reliable, because Google swaps the organic results of the default tab for other sites far more often. Also use it for site: searches. Cannot be combined with tbm.

Example value 10
start integer Optional

Result offset for pagination (0-indexed)

Example value 0
page integer Optional

0-based page number: 0 is the first page and 1 is the second. Prefer start for new integrations.

Example value 1
amount integer Optional

Results per page (1-10, may return fewer)

Example value 10
proxy_country string Optional

Run the search from an exit IP in this country. Only pl (Poland) is supported; any other value returns 422. The search uses Polish IPs only and never falls back to another country: when no Polish route is available the request fails with 503 and is not charged. Without gl, Google picks the country from the IP (no default gl=us is added). Requests with this parameter use more credits than a standard search. Available on request, contact support to enable it for your account.

Example value example
fetch_ai_overview boolean Optional

Set 1 to fetch an AI Overview that Google loads after the page. For many queries the page holds only a loading placeholder, so ai_overview is null. With this parameter the endpoint then sends one extra Google request and fills ai_overview from the answer. It costs 1 extra credit when that request is sent and answered with HTTP 200, even if the answer holds no AI Overview. There is no extra cost when the AI Overview was already on the page, when there is no placeholder, when the extra request fails or runs out of time, or for cached responses. search_information.ai_overview_async shows the outcome: not_needed, no_placeholder, fetched, empty, failed or skipped. Cannot be combined with udm or tbm. Off by default.

Example value true
lsig string Optional

Google local listing signature, used with ludocid to target one listing.

Example value example
kgmid string Optional

Google Knowledge Graph machine ID of the entity to target (e.g. /m/0dr90d).

Example value example
si string Optional

Opaque Google search context token, passed through unchanged.

Example value example
ibp string Optional

Opaque Google interface parameter, passed through unchanged.

Example value example
uds string Optional

Opaque Google filter token from a previous result page, passed through unchanged.

Example value example
oq string Optional

Original Google query value, passed through and encoded once in the upstream URL.

Example value example
sclient string Optional

Google search client identifier, passed through and encoded once in the upstream URL.

Example value example
gs_lp string Optional

Opaque Google SERP context value, passed through and encoded once in the upstream URL.

Example value example

Request Examples

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_KEY_HERE"
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
PHP
<?php

use Illuminate\Support\Facades\Http;

$response = Http::timeout(30)
    ->withHeaders(['x-api-key' => 'YOUR_API_KEY_HERE'])
    ->get('https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile');

if ($response->successful()) {
    echo $response->body();
} else {
    echo "Error: " . $response->status();
}
JavaScript
const options = {
    method: 'GET',
    headers: {
        'x-api-key': 'YOUR_API_KEY_HERE'
    }
};

fetch('https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile', options)
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.text();
    })
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
JavaScript
const axios = require('axios');

const options = {
    method: 'GET',
    url: 'https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile',
    headers: {
        x-api-key: 'YOUR_API_KEY_HERE',
    }
};

try {
    const response = await axios(options);
    console.log(response.data);
} catch (error) {
    console.error('Error:', error.message);
}
Ruby
require 'net/http'
require 'uri'

uri = URI.parse("https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'

request = Net::HTTP::Get.new(uri.request_uri)
request['x-api-key'] = 'YOUR_API_KEY_HERE'

begin
    response = http.request(request)
    puts response.body
rescue => e
    puts "Error: #{e.message}"
end
Python
import http.client
import json

conn = http.client.HTTPSConnection("scrappa.co")

headers = {
    'x-api-key': 'YOUR_API_KEY_HERE',
}

try:
    conn.request("GET", "/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile", headers=headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
except Exception as e:
    print(f"Error: {e}")
finally:
    conn.close()
Python
import requests

headers = {
    'x-api-key': 'YOUR_API_KEY_HERE',
}

try:
    response = requests.get('https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile', headers=headers)
    response.raise_for_status()
    print(response.text)
except requests.exceptions.RequestException as e:
    print(f"Error: {e}")
Java
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;

public class ApiExample {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
            .url("https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile")
        .addHeader("x-api-key", "YOUR_API_KEY_HERE")
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                System.out.println(response.body().string());
            } else {
                System.out.println("Error: " + response.code());
            }
        } catch (IOException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}
Go
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile", nil)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }
    req.Header.Set("x-api-key", "YOUR_API_KEY_HERE")

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error making request:", err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response:", err)
        return
    }

    fmt.Println(string(body))
}
Terminal
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile"
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY_HERE");

        try
        {
            var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile"));
            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }
}
TypeScript
import axios from 'axios';

async function run(): Promise<void> {
    try {
        const response = await axios({
            method: 'GET',
            url: 'https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile',
            headers: {
        'x-api-key': 'YOUR_API_KEY_HERE',
            },
        });

        console.log(response.data);
    } catch (error) {
        console.error('Error:', error);
    }
}

void run();
RUST
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .get("https://scrappa.co/api/search-advanced?query=best+restaurants+in+Berlin&hl=en&gl=de&device=mobile")
        .header("x-api-key", "YOUR_API_KEY_HERE")
        .send()
        .await?;

    println!("{}", response.text().await?);

    Ok(())
}

Response Schema

Example response fields are illustrative; inspect the JSON before integrating.

Example response fields

Scan these fields before integrating.

search_information search_url organic_results related_questions people_also_search_for things_to_know knowledge_graph see_results_about +27 more

Common organic_results fields

position rank_group rank_absolute title
JSON Response
200 OK
{
    "search_information": {
        "query_displayed": "best restaurants in Berlin",
        "total_results": 428000000
    },
    "search_url": "https://www.google.de/search?q=best+restaurants+in+Berlin&hl=en&gl=de&complete=0&pws=0&nfpr=1",
    "organic_results": [
        {
            "position": 1,
            "rank_group": 1,
            "rank_absolute": 3,
            "title": "The 38 Best Restaurants in Berlin",
            "link": "https://www.example.com/berlin/best-restaurants",
            "displayed_link": "www.example.com > berlin > best-restaurants",
            "snippet": "A curated guide to Berlin restaurants, from modern German dining rooms to casual neighborhood favorites.",
            "source": "example.com",
            "link_resolved": true
        }
    ],
    "related_questions": [
        {
            "question": "What food is Berlin best known for?",
            "snippet": "Berlin is known for currywurst, doner kebab, and a large international restaurant scene.",
            "link": "https://www.example.com/berlin-food-guide"
        }
    ],
    "people_also_search_for": [],
    "things_to_know": [],
    "knowledge_graph": null,
    "see_results_about": null,
    "twitter_card": null,
    "local_results": {
        "places": [
            {
                "position": 1,
                "rank_absolute": 2,
                "title": "Example Berlin Bistro",
                "rating": 4.7,
                "reviews": 1842,
                "type": "Restaurant",
                "address": "Mitte, Berlin",
                "website": "https://www.example-bistro.de/"
            }
        ],
        "modules": [
            {
                "title": "Places",
                "place_indexes": [
                    0
                ],
                "rank_group": 1,
                "rank_absolute": 2
            }
        ]
    },
    "local_map": null,
    "answer_box": null,
    "ai_overview": null,
    "ads": [
        {
            "position": 1,
            "rank_group": 1,
            "rank_absolute": 1,
            "title": "Reserve a Berlin restaurant",
            "link": "https://ads.example.com/berlin-restaurants",
            "displayed_link": "ads.example.com",
            "snippet": "Find and reserve a table in Berlin.",
            "block": "top"
        }
    ],
    "shopping_ads": [],
    "top_stories": [],
    "videos": [],
    "inline_videos": [
        {
            "position": 1,
            "title": "Adobe Express Brand Kit Tutorial 2026",
            "link": "https://www.youtube.com/watch?v=example123",
            "platform": "YouTube",
            "channel": "XayLi Barclay",
            "views": "720+ views",
            "view_count": 720,
            "date": "4 months ago",
            "publication_age": "4 months ago"
        }
    ],
    "inline_images": [],
    "shopping_results": [],
    "popular_products": [],
    "perspectives": [],
    "events_results": [],
    "recipes_results": [],
    "immersive_products": [],
    "filters": [],
    "related_searches": [],
    "refine_this_search": [],
    "nutrition_information": null,
    "pagination": [],
    "serp_results": [
        {
            "type": "paid",
            "result_index": 0,
            "rank_group": 1,
            "rank_absolute": 1
        },
        {
            "type": "local_results",
            "module_index": 0,
            "rank_group": 1,
            "rank_absolute": 2
        },
        {
            "type": "organic",
            "result_index": 0,
            "rank_group": 1,
            "rank_absolute": 3
        }
    ],
    "organic_results_count": 1,
    "total_results": 428000000,
    "engine_used": "google",
    "service_used": "google"
}

Errors

Handle these documented responses before retrying or showing customer-facing failures.

422

Validation Error

One or more query parameters failed validation.

{
    "message": "The request validation failed",
    "errors": {
        "query": [
            "The query field is required."
        ]
    }
}
403

Country Parameter Not Enabled

The country parameter is not enabled for this account. Contact support to enable it.

{
    "error": "The country parameter is not enabled for your account. Contact support to enable it.",
    "code": "FORBIDDEN",
    "status": 403
}
503

The upstream service is temporarily unavailable. Please retry shortly.

The upstream service is temporarily unavailable. Please retry shortly.

{
    "error": "Google Search Advanced is temporarily unable to return a valid SERP."
}

Generate Code with AI

Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.

Related reading

Try It Live

Test this endpoint in our interactive playground with real data.