logo

AI Mode

View as Markdown

Get AI-generated answers with references and shopping results from Google AI Mode

Google AI Mode is a conversational search mode that returns a full AI-generated response as the primary content, rather than traditional search results. Instead of a list of links, you get structured text blocks with inline references, shopping results, and detailed answers.

The endpoint fetches Google's AI Mode async payload directly, so JavaScript rendering is not required. There is no render fee, and latency is lower than a full-browser scrape.


Endpoint

GET https://api.scrape.do/plugin/google/search/ai-mode

Credit cost: 10 credits per successful AI Mode response. If Google does not return AI Mode content for the query, the response contains empty arrays and is not charged.

How It Works

AI Mode is a two-step flow on Google's side. The first Google response carries short-lived tokens, and the AI-generated content is returned by a follow-up async endpoint. Scrape.do handles both hops internally and retries transient upstream failures with a fresh session before returning an error.

Not every query is eligible for AI Mode. Google A/B-tests this surface heavily, so the same query can return AI Mode content on one request and no AI Mode content on another.


Request Parameters

Required

ParameterTypeDescription
tokenstringYour Scrape.do API authentication token
qstringSearch query. URL-encode spaces and special characters. best+noise+cancelling+headphones+2025

General

ParameterTypeDefaultDescription
devicestringdesktopDevice type. Accepted values: desktop, mobile
include_htmlbooleanfalseWhen true, the raw HTML is included in the response html field

Localization & Geo-targeting

ParameterTypeDefaultDescription
hlstringenHost Language. Controls the language of the Google UI. ISO 639-1 codes. Examples: tr, de, fr, ja. Full list →
glstringusGeo Location. Country perspective for results. ISO 3166-1 alpha-2 codes. Examples: tr, de, gb. Full list →
google_domainstringgoogle.comGoogle domain to query. Examples: google.com.tr, google.de, google.co.uk. Full list →
locationstring-Location name in Google's canonical format. Examples: Istanbul,Istanbul,Turkey, New York,New York,United States
uulestring-Google UULE-encoded location string. Auto-generated from location when not provided

Filtering

ParameterTypeDefaultDescription
safestring-SafeSearch. Send active to filter adult content

Example Usage

Step 1: Define Your Search Query

AI Mode works best with informational and research-oriented queries:

  • Product research: best noise cancelling headphones 2025
  • Explanations: how does mRNA vaccine work
  • Comparisons: python vs javascript for beginners

For this example, we'll search for "best noise cancelling headphones 2025":

Step 2: Send the API Request

curl --location --request GET 'https://api.scrape.do/plugin/google/search/ai-mode?token=<SDO-token>&q=best+noise+cancelling+headphones+2025'
import requests
import json

token = "<SDO-token>"
query = "best+noise+cancelling+headphones+2025"

url = f"https://api.scrape.do/plugin/google/search/ai-mode?token={token}&q={query}"

response = requests.request("GET", url)

print(json.dumps(response.json(), indent=2))
const axios = require('axios');

const token = "<SDO-token>";
const query = "best+noise+cancelling+headphones+2025";

const url = `https://api.scrape.do/plugin/google/search/ai-mode?token=${token}&q=${query}`;

axios.get(url)
  .then(response => {
    console.log(JSON.stringify(response.data, null, 2));
  })
  .catch(error => {
    console.error(error);
  });
package main

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

func main() {
	token := "<SDO-token>"
	query := "best+noise+cancelling+headphones+2025"

	url := fmt.Sprintf(
		"https://api.scrape.do/plugin/google/search/ai-mode?token=%s&q=%s",
		token, query,
	)

	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require 'net/http'
require 'json'

token = "<SDO-token>"
query = "best+noise+cancelling+headphones+2025"

url = URI("https://api.scrape.do/plugin/google/search/ai-mode?token=#{token}&q=#{query}")

response = Net::HTTP.get(url)

puts JSON.pretty_generate(JSON.parse(response))
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class GoogleAIMode {
    public static void main(String[] args) throws Exception {
        String token = "<SDO-token>";
        String query = "best+noise+cancelling+headphones+2025";

        String url = String.format(
            "https://api.scrape.do/plugin/google/search/ai-mode?token=%s&q=%s",
            token, query
        );

        HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
        conn.setRequestMethod("GET");

        BufferedReader reader = new BufferedReader(
            new InputStreamReader(conn.getInputStream())
        );
        String line;
        StringBuilder response = new StringBuilder();
        while ((line = reader.readLine()) != null) {
            response.append(line);
        }
        reader.close();

        System.out.println(response.toString());
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        string token = "<SDO-token>";
        string query = "best+noise+cancelling+headphones+2025";

        string url = $"https://api.scrape.do/plugin/google/search/ai-mode?token={token}&q={query}";

        using HttpClient client = new HttpClient();
        string response = await client.GetStringAsync(url);

        Console.WriteLine(response);
    }
}
<?php
$token = "<SDO-token>";
$query = "best+noise+cancelling+headphones+2025";

$url = "https://api.scrape.do/plugin/google/search/ai-mode?token={$token}&q={$query}";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
?>

Step 3: Receive AI-Generated Results

The API returns a JSON object with the AI-generated response structured into text blocks, references, and optional shopping results:

{
  "search_parameters": {
    "q": "best noise cancelling headphones 2025",
    "hl": "en",
    "gl": "us",
    "device": "desktop",
    "google_domain": "google.com"
  },
  "text_blocks": [
    {
      "type": "paragraph",
      "snippet": "For 2025, the noise-cancelling headphone market is dominated by the Sony WH-1000XM6, which launched in May 2025 as the new industry leader.",
      "snippet_links": [
        { "text": "Sony WH-1000XM6", "link": "https://example.com/sony" }
      ],
      "reference_indexes": [0, 1, 2]
    },
    {
      "type": "heading",
      "snippet": "Top Over-Ear Recommendations",
      "level": 3
    },
    {
      "type": "list",
      "list": [
        {
          "snippet": "Sony WH-1000XM6 — best overall noise cancellation",
          "reference_indexes": [0]
        },
        {
          "snippet": "Bose QuietComfort Ultra — best comfort for long wear",
          "reference_indexes": [1]
        }
      ]
    }
  ],
  "references": [
    {
      "title": "Sony WH-1000XM6 Review",
      "link": "https://example.com/sony-review",
      "snippet": "The XM6 offers industry-leading ANC...",
      "source": "TechRadar",
      "source_icon": "https://example.com/techradar-icon.png",
      "index": 0
    },
    {
      "title": "Bose QC Ultra Review",
      "link": "https://example.com/bose-review",
      "snippet": "Bose's latest flagship...",
      "source": "RTINGS",
      "index": 1
    }
  ],
  "shopping_results": [
    {
      "title": "Sony WH-1000XM6",
      "product_link": "https://example.com/buy-sony",
      "thumbnail": "https://example.com/sony.jpg",
      "price": "$399.99",
      "extracted_price": 399.99,
      "old_price": "$460.00",
      "extracted_old_price": 460.00,
      "source": "Sony",
      "rating": 4.7,
      "reviews": 5300,
      "index": 0
    }
  ]
}

Response Structure

Top-Level Fields

FieldTypeWhen EmptyDescription
search_parametersobjectalways presentEcho of the request parameters
text_blocksarray[]AI-generated content blocks (paragraphs, headings, lists, reference cards)
referencesarray[]Sources cited by the AI response
shopping_resultsarray[]Product results with pricing (when relevant)
htmlstringomittedRaw HTML. Only present when include_html=true

When Google has no AI Mode content for a query, the endpoint returns 200 with empty text_blocks, references, and shopping_results. This is not treated as an error and is not charged.


text_blocks[]

The AI response is structured as an ordered array of content blocks. Each block has a type that determines which fields are present.

FieldTypeDescription
typestring"heading", "paragraph", "list", "ordered_list", or "reference_cards"
snippetstringText content (for headings and paragraphs)
levelintegerHeading level, e.g. 3 (only when type=heading)
snippet_linksarrayInline links within the snippet (optional)
listarrayList items when type=list or type=ordered_list (optional)
cardsarrayReference preview cards when type=reference_cards (optional)
reference_indexesarray of intIndexes into the references array (optional)

ListItem Object

FieldTypeDescription
snippetstringItem text
snippet_linksarrayInline links (optional)
shopping_resultobjectEmbedded shopping result (optional)
listarrayNested sub-items (optional, recursive)
reference_indexesarray of intIndexes into the references array (optional)
FieldTypeDescription
textstringLink text
linkstringURL

ReferenceCard Object

FieldTypeDescription
titlestringCard title
linkstringURL
snippetstringPreview text (optional)

references[]

Sources cited by the AI-generated response. Each reference has an index that text blocks point to via reference_indexes.

FieldTypeDescription
titlestringPage title
linkstringURL
snippetstringDescription excerpt
sourcestringDomain or site name
source_iconstringFavicon URL (optional)
thumbnailstringPreview image URL (optional)
indexintegerPosition index

shopping_results[]

Product results with pricing and ratings. Present when the query has commercial intent.

FieldTypeDescription
titlestringProduct name
product_linkstringProduct URL
thumbnailstringImage URL (optional)
pricestringDisplay price, e.g. "$399.99" (optional)
extracted_pricefloatNumeric price (optional)
old_pricestringOriginal price before discount (optional)
extracted_old_pricefloatNumeric old price (optional)
sourcestringRetailer name (optional)
ratingfloatStar rating (optional)
reviewsintegerReview count (optional)
indexintegerPosition index

Error Responses

StatusBodyCause
400{ "error": "token is required" }Missing token parameter
400{ "error": "q (search query) is required" }Missing q parameter
400{ "error": "device must be one of: desktop, mobile" }Invalid device value
400{ "error": "invalid google_domain" }Unsupported Google domain
502{ "error": "request failed" }Transient upstream Google request failure after retries. Not charged.
502{ "error": "folwr request failed" }Transient follow-up fetch failure after retries. Not charged.
500{ "error": "failed to parse AI Mode results" }Parser error. Retry the request, and contact support if it persists.

Differences from AI Overview

AI OverviewAI Mode
TriggerAutomatic on regular SERPDedicated endpoint
Endpoint/plugin/google/search/plugin/google/search/ai-mode
ContentOptional panel within SERP resultsFull AI response (primary content)
Shopping resultsNoYes (when relevant)
HeadingsNoYes (type=heading)
Ordered listsNoYes (type=ordered_list)
Reference cardsNoYes (type=reference_cards)
CreditsSame as SERP (or 5 for deferred follow-up)10

Example Requests

Basic AI Mode search:

/plugin/google/search/ai-mode?token=TOKEN&q=best+noise+cancelling+headphones+2025

Turkish results from Turkey:

/plugin/google/search/ai-mode?token=TOKEN&q=en+iyi+kulaklık&hl=tr&gl=tr&google_domain=google.com.tr

Location-targeted search:

/plugin/google/search/ai-mode?token=TOKEN&q=best+restaurants&location=New+York,New+York,United+States

Mobile device:

/plugin/google/search/ai-mode?token=TOKEN&q=python+vs+javascript&device=mobile

SafeSearch enabled:

/plugin/google/search/ai-mode?token=TOKEN&q=family+friendly+movies&safe=active

Include raw async HTML:

/plugin/google/search/ai-mode?token=TOKEN&q=tea+vs+coffee+caffeine&include_html=true

Search queries must be URL-encoded. Treat every AI Mode field as optional because Google can vary the response shape, references, and shopping cards across requests.


Scraping an AI Mode URL Directly

If you scrape an AI Mode search URL through the standard API instead of this endpoint — anything matching google.*/search?...&udm=50 — you get the page's HTML back, with the AI Mode answer already included:

curl "https://api.scrape.do/?token=YOUR_TOKEN&url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dbest%2Brunning%2Bshoes%26gl%3Dus%26hl%3Den%26udm%3D50"

Google serves that page as a shell and loads the answer separately once the page is open, so the raw HTML Google returns first contains no answer text. The API completes that second step for you and merges the result into the HTML inside a container you can select on:

<div id="scrapedo-ai-mode" data-subtree="aimfl"> … answer markup … </div>

Points worth knowing:

  • render=true is not needed and is ignored on these URLs. The answer is retrieved without a browser, so you are not charged a render fee.
  • The answer is not always there. When Google returns no AI Mode content for the query, you get the page HTML without the scrapedo-ai-mode container. Check for it before parsing.
  • Expect the HTML to be large — roughly double the page without the answer, typically ~1 MB.
  • cache=true works on these URLs, with a shorter lifetime than usual: a cached AI Mode page expires after 1 hour, because the answer is a point-in-time synthesis that Google refreshes. A cache hit returns the merged page without re-fetching anything.
  • Use this endpoint instead when you want structured data. Scraping the URL gives you Google's raw markup, whose class names change without warning; /plugin/google/search/ai-mode returns parsed text blocks and references and is the stable contract.

On this page