Google AI Mode API
The Autom Google AI Mode API returns Google's AI Mode answer and its cited sources as structured JSON.
- Google AI Mode API — Query Google AI Mode via API.
Use it to monitor how AI search talks about your brand (GEO), track cited sources or benchmark AI answers.
Table of contents
How it works
- Create a Autom account and copy your API key from the dashboard.
- Call
https://api.autom.dev with the header x-api-key: YOUR_API_KEY.
- Use the result in your app — no infrastructure to run.
export AUTOM_API_KEY="your-api-key"
pip install requests # Python
# TypeScript: Node.js 18+ (native fetch), run with `npx tsx file.ts`
Google AI Mode API
Query Google AI Mode via API. JSON with text_blocks, references, and shopping_results.
GET https://api.autom.dev/v1/google/search/ai · 3 credits per request · API reference
Request parameters
| Parameter |
In |
Type |
Required |
Description |
query |
query |
string |
✅ |
The question or search query you want Google AI Mode to answer (supports advanced operators like site:, inurl:, intitle:). |
location |
query |
string |
— |
Human-readable location to originate the search from (e.g. New York, NY, Paris, France). If several locations match, the most popular one is used. Note: location and uule cannot be used together. |
uule |
query |
string |
— |
Google encoded location parameter. Use for precise geo targeting. Note: uule and location cannot be used together. |
google_domain |
query |
string |
— |
Google domain to use for the search. Defaults to google.com. |
gl |
query |
string |
— |
Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France). |
hl |
query |
string |
— |
Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419). |
cr |
query |
string |
— |
Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE). |
lr |
query |
string |
— |
Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de). |
Python example
import os
import requests
API_KEY = os.environ["AUTOM_API_KEY"]
HEADERS = {"x-api-key": API_KEY}
response = requests.get(
"https://api.autom.dev/v1/google/search/ai",
headers=HEADERS,
params={
"query": "what is mozilla firefox",
},
timeout=120,
)
response.raise_for_status()
data = response.json()
print(data)
TypeScript example
type GoogleAiModeApi = {
references?: {
link?: string;
index?: number;
title?: string;
source?: string;
snippet?: string;
thumbnail?: string;
source_icon?: string;
}[];
text_blocks?: {
type?: string;
snippet?: string;
}[];
shopping_results?: unknown[];
search_parameters?: {
q?: string;
gl?: string;
hl?: string;
engine?: string;
};
reconstructed_markdown?: string;
};
const headers = { "x-api-key": process.env.AUTOM_API_KEY!, "Content-Type": "application/json" };
const params = new URLSearchParams({
"query": "what is mozilla firefox",
});
const response = await fetch(`https://api.autom.dev/v1/google/search/ai?${params}`, { headers });
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const data = (await response.json()) as GoogleAiModeApi;
console.log(data);
Output example
Example response from the API reference, abridged.
{
"references": [
{
"link": "https://www.mozilla.org/firefox/",
"index": 0,
"title": "Firefox Browser",
"source": "mozilla.org",
"snippet": "Official Firefox download and overview.",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcFirefoxThumb",
"source_icon": "https://www.google.com/s2/favicons?domain=mozilla.org&sz=128"
},
{
"link": "https://en.wikipedia.org/wiki/Firefox",
"index": 1,
"title": "Firefox - Wikipedia",
"source": "en.wikipedia.org"
}
],
"text_blocks": [
{
"type": "paragraph",
"snippet": "Mozilla Firefox is a free, open-source web browser developed by the Mozilla Foundation. It is available on desktop and mobile, supports e…"
},
{
"type": "heading",
"level": 3,
"snippet": "Key features"
}
],
"shopping_results": [],
"search_parameters": {
"q": "what is mozilla firefox",
"gl": "us",
"hl": "en",
"engine": "google_ai_mode"
},
"reconstructed_markdown": "Mozilla Firefox is a free, open-source web browser developed by the Mozilla Foundation. It is available on desktop and mobile, supports e…"
}
Response fields
| Field |
Type |
Description |
references[] |
object[] |
|
references[].link |
string |
|
references[].index |
integer |
|
references[].title |
string |
|
references[].source |
string |
|
references[].snippet |
string |
|
references[].thumbnail |
string |
|
references[].source_icon |
string |
|
text_blocks[] |
object[] |
|
text_blocks[].type |
string |
|
text_blocks[].snippet |
string |
|
shopping_results |
any[] |
|
search_parameters |
object |
|
search_parameters.q |
string |
|
search_parameters.gl |
string |
|
search_parameters.hl |
string |
|
search_parameters.engine |
string |
|
reconstructed_markdown |
string |
|
Code examples in other languages
Ready-to-run examples live in examples/; each reads your key from AUTOM_API_KEY.
Use cases
- Generative Engine Optimization — See which sources AI Mode cites for your topics.
- Brand monitoring — Track how AI answers describe your brand and competitors.
Why Autom?
- Every SERP in one API — Google Search, AI Mode, Maps, News, Shopping, Images, Videos, Jobs, Autocomplete, plus Bing and Brave.
- Structured JSON — documented fields instead of brittle HTML parsing.
- Geo & language targeting — search like a user from the country and language you need.
- One API key, one header —
x-api-key on every request.
- Copy-paste examples — Python and TypeScript in each README, 7 more languages in
examples/.
FAQ
How do I authenticate?
Create an account on Autom, copy your API key and send it in the x-api-key header of every request to https://api.autom.dev.
How much does a request cost?
Credits per call: /v1/google/search/ai 3. See Autom pricing.
Which languages are supported?
Any language that can make an HTTP request. This README shows Python and TypeScript; the examples/ folder contains cURL, PHP, C#, Go, Java, Ruby and Node.js.
Official SDKs
Use Autom from your own language with a typed client:
Related repositories
Support