# Google AI Mode Scraper — Answers & Citations (`khadinakbar/google-ai-mode-scraper`) Actor

Scrape structured Google AI Mode responses for prompts, including answer text, citation references, related questions, image/product modules, and optional multi-turn follow-ups.

- **URL**: https://apify.com/khadinakbar/google-ai-mode-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** AI, SEO tools, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $25.00 / 1,000 google ai mode prompts

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Google AI Mode Scraper — Answers & Citations

Send one or more natural-language prompts to Google AI Mode and receive a structured dataset with the answer text, text blocks, cited sources, related questions, image/product modules, provenance, and optional multi-turn follow-ups.

The Actor uses SerpApi's `google_ai_mode` engine as the retrieval layer. Google AI Mode is a conversational search surface that can fan out a question into related searches and return supporting web links; the structured provider preserves those answer and citation fields. Direct browser access to Google is challenge-prone in automated environments, so the provider path is the reliability boundary for this build.

### Best for

- GEO/AEO teams auditing which sources Google AI Mode cites for a prompt
- Researchers exporting cited answers and related questions for analysis
- AI agents that need one narrow prompt-in, structured answer-out tool
- Conversation tests that compare an initial prompt with ordered follow-ups

### Focused standalone workflow

This Actor is designed as a focused standalone workflow for Google AI Mode answer extraction. Choose it for prompt-level answer and citation records; continue with a GEO report, source review, or research export after the run.

This Actor is designed as a focused standalone workflow for Google AI Mode answer and citation extraction. A citation is provenance evidence for the returned response; it is interpreted alongside the source page and the fetch timestamp.

### Workflow story

An SEO analyst starts with a fixed prompt set, chooses a country and language, and runs the Actor. Each answer row keeps the prompt, turn, text blocks, citations, related questions, provider search ID, and fetch time together. The analyst then exports the `citations` view to review source coverage, or sends the answer rows to a GEO report, alert, or research notebook. With `followUpQueries`, the same workflow continues from the initial response through each ordered question while `conversationId` keeps separate prompts isolated.

### Input

```json
{
  "queries": [
    "Compare the best project management tools for a five-person team."
  ],
  "followUpQueries": ["Which option is best for a bootstrapped team?"],
  "countryCode": "us",
  "languageCode": "en",
  "device": "desktop",
  "continuable": true
}
```

`queries` is required and accepts up to 25 prompts. `followUpQueries` is optional and accepts up to five ordered prompts; the same sequence is applied to every initial prompt. The Actor uses the continuation token returned by Google AI Mode for each next turn. `location`, `imageUrl`, `noCache`, and `maxRetries` are optional. For image prompts, provide a public HTTPS image URL.

Authentication is handled by the Actor's secret `SERPAPI_KEY`. An optional `serpApiKey` input can be used for BYOK testing and overrides the managed secret; never place a key in a public task, README example, source file, or dataset.

### Output

One record is written for each successful prompt turn:

| Field                           | Meaning                                                                  |
| ------------------------------- | ------------------------------------------------------------------------ |
| `query`                         | Prompt sent to Google AI Mode                                            |
| `conversationId` / `turn`       | Run-scoped conversation and one-based turn number                        |
| `responseText`                  | Normalized response text, preferring reconstructed Markdown              |
| `textBlocks`                    | Ordered answer blocks with citation reference indexes                    |
| `citations`                     | Ordered title, URL, domain, source, snippet, and reference index records |
| `relatedQuestions`              | Suggested Google AI Mode follow-up questions                             |
| `subsequentRequestToken`        | Opaque continuation state for the next turn                              |
| `serpApiSearchId` / `fetchedAt` | Provider provenance and freshness fields                                 |

```json
{
  "query": "Compare the best project management tools for a five-person team.",
  "conversationId": "conversation-1",
  "turn": 1,
  "isFollowUp": false,
  "responseText": "...",
  "reconstructedMarkdown": "... [0] ...",
  "textBlocks": [
    { "type": "paragraph", "text": "...", "referenceIndexes": [0, 1] }
  ],
  "citations": [
    {
      "position": 1,
      "title": "Example guide",
      "url": "https://example.com/guide",
      "domain": "example.com",
      "source": "Example",
      "snippet": "...",
      "referenceIndex": 0
    }
  ],
  "relatedQuestions": [{ "question": "Which tool is best for a small team?" }],
  "referenceCount": 1,
  "subsequentRequestToken": "opaque-provider-token",
  "serpApiSearchId": "provider-search-id",
  "source": "serpapi",
  "fetchedAt": "2026-08-09T00:00:00.000Z",
  "warnings": []
}
```

The opaque continuation token is retained for provenance and debugging. Treat it as transient provider state, not as a credential. Run-level `SUMMARY`, `OUTPUT`, and `RUN_SUMMARY` records include the terminal outcome and charged event counts.

### Pricing and usage

- Pay per event: Actor start is `$0.00005` and one Google AI Mode prompt is `$0.025` per persisted prompt turn.
- Example: a run with 4 initial prompts and 1 follow-up per prompt writes up to 8 turns, for `$0.20` in prompt events plus the Actor-start event.
- Apify platform compute and provider usage are passed through according to the live pricing configuration. The Apify Pricing tab is the current source of truth for prices and platform usage.

The prompt event is charged only after a provider response has been normalized and immediately before it is saved. A provider issue is reported in the run summary and receives no successful-result charge.

### API example

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("khadinakbar/google-ai-mode-scraper").call(run_input={
    "queries": ["How does Google AI Mode differ from AI Overviews?"],
    "countryCode": "us",
    "languageCode": "en"
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["query"], item["referenceCount"])
```

### MCP and agent prompt card

Connect the Actor through Apify MCP and give an agent this prompt:

> Use Google AI Mode Scraper for a current Google AI Mode answer to a specific prompt. Return the answer text, citation URLs and domains, related questions, `fetchedAt`, and the run outcome. Use `followUpQueries` when the next question depends on the previous turn. Treat generated text as an answer to inspect and citations as provenance links to read back.

Agents can read the dataset for row-level answers and `RUN_SUMMARY` for completion, partial-result, valid-empty, configuration, or upstream outcomes. Each row includes `serpApiSearchId` and `fetchedAt` for provenance and freshness.

### Practical guidance

- Use informational, comparison, and research prompts when you want rich answer text and citations.
- Keep localization fixed when comparing runs; changing `countryCode`, `languageCode`, `location`, or `device` can change the response.
- Use `noCache: true` only when freshness matters enough to justify a new provider request.
- Keep follow-ups concise and dependent on the initial question so the conversation boundary remains clear.
- A valid empty answer is preserved as a successful row with `responseText: null` and a warning; an upstream/configuration outcome is reported separately in `RUN_SUMMARY`.

### Builder's note

I built the normalization layer around Google AI Mode's structured response shape: text blocks keep their reference indexes, citations derive their domain from the URL, and continuation tokens stay attached to the conversation row. This keeps the dataset useful when the answer includes prose, related questions, shopping modules, or a follow-up turn in the same run.

### Best results and responsible use

Google AI Mode responses, citations, availability, and localization can change. SerpApi notes that some languages may return an incomplete or unexpected response shape. Use public, authorized search workflows and comply with Google's terms, SerpApi's terms, Apify policies, and applicable law.

### Related tools

- `google-ai-overviews-scraper` for Google AI Overview-specific extraction
- `ai-search-visibility-tracker` for cross-engine domain citation tracking
- `google-scholar-scraper` for scholarly Google results

### Support

Use the Apify Actor Issues tab for reproducible problems. Include the prompt shape, country/language/device, run ID, and warning fields; never include API keys or continuation tokens.

# Actor input Schema

## `queries` (type: `array`):

Prompts to send to Google AI Mode. One dataset record is returned per prompt, plus one record per follow-up prompt. Use natural-language questions rather than Google result-page URLs.

## `followUpQueries` (type: `array`):

Follow-up prompts applied in order to every initial prompt using Google AI Mode continuation tokens. Results include conversationId, turn, and isFollowUp so multi-turn answers remain separable.

## `countryCode` (type: `string`):

Two-letter Google country code such as us, gb, ca, or au. Defaults to us.

## `languageCode` (type: `string`):

Two- or three-letter Google language code such as en, es, fr, or ur. Defaults to en.

## `location` (type: `string`):

Optional city, region, or country location passed to Google AI Mode for localized results, for example New York, United States.

## `device` (type: `string`):

Google device profile used by the structured provider.

## `imageUrl` (type: `string`):

Optional public HTTPS image URL to include with the first prompt. Google AI Mode uses the image as additional prompt context.

## `continuable` (type: `boolean`):

Ask the provider to return a continuation token and related follow-up links. Required for followUpQueries and defaults to false when there are no follow-ups.

## `noCache` (type: `boolean`):

Force SerpApi to fetch a fresh Google AI Mode response instead of using its one-hour cache. Fresh requests may cost more.

## `maxRetries` (type: `integer`):

Additional attempts after a provider error. Defaults to 2; maximum 3.

## `serpApiKey` (type: `string`):

Optional secret override. Leave blank to use the Actor's managed SERPAPI\_KEY secret when configured.

## Actor input object example

```json
{
  "queries": [
    "Compare the best project management tools for a five-person team.",
    "How does Google AI Mode differ from AI Overviews?"
  ],
  "followUpQueries": [
    "Which option is best for a bootstrapped team?",
    "Give me a short implementation checklist."
  ],
  "countryCode": "us",
  "languageCode": "en",
  "device": "desktop",
  "continuable": false,
  "noCache": false,
  "maxRetries": 2
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `usage` (type: `string`):

No description

## `runOutput` (type: `string`):

No description

## `runSummary` (type: `string`):

Machine-readable terminal outcome, result counts, provider status, and charged event counts.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "What are the best ways to improve technical SEO for a small SaaS website?"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/google-ai-mode-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "queries": ["What are the best ways to improve technical SEO for a small SaaS website?"] }

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/google-ai-mode-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "What are the best ways to improve technical SEO for a small SaaS website?"
  ]
}' |
apify call khadinakbar/google-ai-mode-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khadinakbar/google-ai-mode-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/W3HEPu9dfgBDhbbDv/builds/XiomqPjkQqnQjtFAo/openapi.json
