google_search
Retrieve structured Google Search results as JSON, including AI Overview answers, organic results, People Also Ask, and knowledge graph data. Batch up to 1,000 queries per run for scalable SERP data collection.
Instructions
Google SERP + AI Overviews API
Google search as JSON: full AI Overview answers (lists, citations, sources) plus organic results, People Also Ask, knowledge graph, top stories and local results in one row per query. Batch up to 1,000 queries. From $1.80 per 1,000, platform costs included.
Pricing (pay per event, billed to your Apify account): Google SERP: $0.003.
Runs on Apify as subimpact/google-serp-ai-overviews.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gl | No | Two-letter country code for Google results, e.g. us, my, uk, sg. | us |
| hl | No | Two-letter language code, e.g. en, ms, zh. | en |
| udm56 | No | When true, appends &udm=56 to the search URL. Default FALSE after measurement (2026-09-07 A/B, 10 queries x 2 variants): udm=56 cut AIO coverage 8/10 to 4/10 and did not pin the classic surface (AI Mode share unchanged). Kept for control; leave off for Google's default routing. | |
| mobile | No | When true, fetches the SERP and the folsrch fragment with a mobile device header set (got-scraping header generator, devices: ['mobile']). Default FALSE. Measurement (2026-09-07 spike, 10 queries x 4 variants, gl=sg): mobile UA cut truncation 6/8 (75%) to 3/8 (37%), mean answer length 687 -> 852 chars, fetch success 15/20 -> 19/20. n=10, one market, one day — EnterRank's paired A/B (30 queries x 2, MY market) was inconclusive: zero of 29 queries were classic-with-an-overview in both arms (commercial prompt set routes to AI Mode). Do not flip the default until a classic-serving prompt set settles it. | |
| queries | Yes | List of search queries to run. Max 1000 per run. | |
| location | No | Geo target for results, e.g. "New York, NY" or "Kuala Lumpur". Empty = Google uses proxy IP geolocation. Encoded server-side via Google uule (same as SerpAPI). | |
| _maxItems | No | How many dataset items to return to the model (1-1000, default 50). Truncates the response only; it does not change what the Actor collects or charges for. | |
| maxResults | No | How many organic results to return per query (1-10, default 10). | |
| concurrency | No | Number of parallel queries (1-30, default 10). A/B measured: 20 queries at c5=34s, c10=35s, c20=65s — the SERP proxy pool is the bottleneck, so beyond ~10 workers latency balloons. 10 gives the same throughput as 5 with headroom for AI-Overview-heavy sets. | |
| _maxChargeUsd | No | Per-run spending cap in USD (default 0.5). Passed to Apify as the run option maxTotalChargeUsd, so the run stops when it reaches this charge. | |
| excludeAiMode | No | Default TRUE. When Google serves the AI Mode surface instead of a classic AI Overview (after the optional retryAiModeForClassic re-fetch, if enabled), the row carries no ai_overview. search_metadata.ai_mode_detected and search_metadata.ai_mode_excluded are true. Organic results and People Also Ask are still delivered; the row is Success and charged, the same as a query Google shows no AI Overview for. Set to false to ship the AI Mode answer as before (flagged ai_mode_detected, Success, charged). | |
| captureRawHtml | No | When true, saves the raw SERP HTML for every query to the key-value store (key: raw-<query>-<ts>.html). Used for building golden test corpora and debugging selector drift. Adds ~200-400KB per query to KV storage. Default false. | |
| retryDeferredAIO | No | Google generates AI Overviews asynchronously — the first fetch sometimes returns only a placeholder shell. When true, the actor re-fetches (up to retryDeferredMaxFetches total) and keeps the richest response. Each retry costs one extra proxy request (~$0.0025) + compute on affected queries only. Set false to always use a single fetch per query. | |
| resolveGotoTokens | No | When true (default), AI Overview citations that still carry a raw /goto? token after the resolution chain are resolved by reading the Location header of google.com/goto?url=<token> (~90ms each, ~11.5% of citations). The original token is kept in goto_url as provenance; failures stay unresolved with unresolved_citations intact. Verified 93/93 by EnterRank + 6/6 by our probe. Set false to disable. | |
| retryDeferredPoll | No | When true, re-fetches the SERP up to retryDeferredMaxFetches times when a deferred AI Overview shell is detected, keeping the richest response. Off by default: the folsrch recovery path resolves 90%+ of deferred AIOs, and the poll recovered 0/120 in the stress test while costing ~10s + extra proxy requests per shell query. Enable only if folsrch regresses. | |
| retryThinOverview | No | When true, an AI Overview that came back partly rendered (ends in a dangling heading, or has under 600 characters of answer text) gets one fresh SERP fetch; the richer answer is kept, never a poorer one. Requires retryDeferredAIO and retryDeferredMaxFetches > 1. Costs one extra proxy request on affected rows only. Set false to ship thin answers as served. | |
| retryPartialResults | No | Google intermittently serves a reduced page with other modules (People Also Ask, knowledge graph, top stories) but NO organic results. When true (default), the actor re-fetches to recover organics. Queries that stay organic-empty are marked status=Partial and NOT charged. Re-fetches are included in the price. | |
| captureFlaggedFolsrch | No | When true, and a query ends with truncation_detected true (AI Overview words missing: cut at an inline entity link, on an unclosed bracket, a trailing comma or a joining word), the answer's source HTML — the raw folsrch fragment when resolved_by is folsrch, else the shell — is saved to the default key-value store as folsrch-evidence-<query>-<ts>.html and search_metadata.folsrch_evidence points at the key. Diagnostic for studying exact cut points; best-effort, never fails a row. Adds one KV value per truncated row. Default false. | |
| retryAiModeForClassic | No | When true, an AI Mode serve triggers one re-fetch hoping for a classic AI Overview. Default FALSE after measurement (EnterRank, 2026-09-07, 101/101 answers across 4 runs): on a commercial query mix the re-fetch recovered ZERO classic serves — Google routes commercial queries to AI Mode today, so the re-fetch is a doubled SERP fetch with no recovery. Kept behind the input because routing moved once (2026-09-02: 2/2 re-fetches served classic) and can move back. When false (default), an AI Mode answer is not re-fetched: it is dropped (no ai_overview) when excludeAiMode is on (default), or shipped as-is (Success, ai_mode_detected: true, warning set, charged) when excludeAiMode is false. | |
| retryPartialMaxFetches | No | Upper bound on total fetches per query when organic results are missing (retryPartialResults=true). 1 = no re-fetch, 2 = one re-fetch, 3 = two re-fetches. Range 1-3. | |
| retryDeferredMaxFetches | No | Upper bound on total fetches per query when a deferred AI Overview shell is detected. 1 = single fetch (same as retryDeferredAIO=false). Higher = better recovery odds, more proxy usage on affected queries. Range 1-5. |