# Google Autocomplete Scraper (`searchapi/google-autocomplete-scraper`) Actor

Scrapes Google Autocomplete suggestions for any seed query. Extracts the full set of autocomplete fields: suggestion text + HTML, vertical (web/people/products/news/...), highlighted flag, completion, replacement, locale, client, and more.

- **URL**: https://apify.com/searchapi/google-autocomplete-scraper.md
- **Developed by:** [Search API](https://apify.com/searchapi) (community)
- **Categories:** AI, Developer tools, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 search results

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/actors/running/actors-in-store.md#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 Autocomplete Scraper

Collect live Google autocomplete suggestions for one seed or a batch of seeds. The Actor uses Google's public structured autocomplete response first and opens a real Google textbox/listbox session only when every structured request fails.

### Input

- `query`: one seed phrase.
- `queries`: multiple seed phrases; `keywords` remains a backward-compatible alias.
- `mode`: `exact`, `questions`, `prepositions`, `comparisons`, `alphabet`, or `all`.
- `maxItems` and `maxItemsPerQuery`: global and fair per-seed limits.
- `language` and `country`: Google `hl` and `gl` localization.
- `minLength`, `maxLength`, and `containsKeyword`: optional filters. Prefix the substring with `!` to exclude matches.
- `outputFormat`: flat suggestion records or one nested tree per seed.
- `maxConcurrency`, retry, and timeout inputs: bounded performance controls.
- `useBrowserFallback`: enable the actual autocomplete textbox/listbox fallback.
- `proxyConfiguration`: optional Residential or custom proxy for the browser fallback.

The public autocomplete endpoint normally works directly and does not require a proxy. Apify's `GOOGLE_SERP` group is designed for HTTP Google Search/Shopping result requests; it cannot tunnel the Playwright fallback and is rejected there. Use Residential or custom proxy URLs only if the browser fallback needs them.

### Output

Flat records include a stable ID, seed/query/request positions, suggestion and source text, Google relevance/type/subtype metadata when returned, expansion provenance, text statistics, localization, public search/source URLs, retrieval method, connection/profile information, timestamps, and normalized search metadata. Optional values Google does not return are omitted—never filled with nulls or invented data.

Tree mode returns one record per seed with the same clean flat records nested in `suggestions`.

The run summary is saved as `OUTPUT` and includes record counts, request failures, runtime, per-query counts, and dataset audits for duplicates, empty values, and malformed URLs.

### Safety and limitations

- CAPTCHA and unusual-traffic pages fail closed and are never saved.
- The Actor does not solve CAPTCHAs or bypass authentication/access controls.
- Google controls suggestion availability, ordering, and metadata; some seeds legitimately return an empty dataset.
- Structured responses are status/content-type checked and malformed JSON/JSONP is rejected safely.

# Actor input Schema

## `query` (type: `string`):

A single seed phrase. Leave empty when using Queries.

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

Multiple seed phrases processed with fair interleaving.

## `mode` (type: `string`):

Exact queries only, or expand using question, preposition, comparison, alphabet, or every pattern.

## `maxItems` (type: `integer`):

Global dataset limit across every query.

## `maxItemsPerQuery` (type: `integer`):

Fair per-seed cap before the global limit is applied.

## `maxConcurrency` (type: `integer`):

Concurrent structured autocomplete requests.

## `language` (type: `string`):

Google hl language code.

## `country` (type: `string`):

Google gl country code, or ALL to omit localization.

## `minLength` (type: `integer`):

Drop suggestions shorter than this many characters.

## `maxLength` (type: `integer`):

Drop suggestions longer than this many characters.

## `containsKeyword` (type: `string`):

Keep suggestions containing this text. Prefix with ! to exclude matching suggestions.

## `outputFormat` (type: `string`):

Return one record per suggestion or one nested group per seed.

## `maxRequestRetries` (type: `integer`):

Retries only temporary network, rate-limit, and server failures.

## `requestTimeoutSecs` (type: `integer`):

Structured request timeout in seconds.

## `navigationTimeoutSecs` (type: `integer`):

Maximum seconds for browser fallback navigation.

## `requestHandlerTimeoutSecs` (type: `integer`):

Maximum seconds for one browser fallback query.

## `useBrowserFallback` (type: `boolean`):

If every structured request fails, enter the seed in Google's homepage and read its autocomplete listbox.

## `proxyConfiguration` (type: `object`):

Optional Residential or custom proxy for browser fallback. GOOGLE\_SERP is HTTP-only and is not compatible with a Playwright autocomplete session.

## Actor input object example

```json
{
  "query": "how to",
  "mode": "exact",
  "maxItems": 50,
  "maxItemsPerQuery": 50,
  "maxConcurrency": 10,
  "language": "en",
  "country": "US",
  "outputFormat": "flat",
  "maxRequestRetries": 1,
  "requestTimeoutSecs": 30,
  "navigationTimeoutSecs": 45,
  "requestHandlerTimeoutSecs": 90,
  "useBrowserFallback": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `output` (type: `string`):

No description

# 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 = {
    "query": "how to"
};

// Run the Actor and wait for it to finish
const run = await client.actor("searchapi/google-autocomplete-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 = { "query": "how to" }

# Run the Actor and wait for it to finish
run = client.actor("searchapi/google-autocomplete-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 '{
  "query": "how to"
}' |
apify call searchapi/google-autocomplete-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,searchapi/google-autocomplete-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/5cwAyLfBlMGN7ApRW/builds/TkjCUnfMezjVwcqjS/openapi.json
