Google AI Mode SERP API provides search results from the AI Mode feature of Google Search. The results are specific to the specified location (see the List of Locations) and language (see the List of Languages) parameters.
Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access
# Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
login="login"
password="password"
cred="$(printf ${login}:${password} | base64)"
curl --location --request POST "https://api.dataforseo.com/v3/serp/google/ai_mode/live/advanced" \
--header "Authorization: Basic ${cred}" \
--header "Content-Type: application/json" \
--data-raw '[
{
"language_code": "en",
"location_code": 2840,
"keyword": "what is google ai mode"
}
]'
<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
try {
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
$client = new RestClient($api_url, null, 'login', 'password');
} catch (RestClientException $e) {
echo "n";
print "HTTP code: {$e->getHttpCode()}n";
print "Error code: {$e->getCode()}n";
print "Message: {$e->getMessage()}n";
print $e->getTraceAsString();
echo "n";
exit();
}
$post_array = array();
// You can set only one task at a time
$post_array[] = array(
"language_code" => "en",
"location_code" => 2840,
"keyword" => mb_convert_encoding("what is google ai mode", "UTF-8")
);
if (count($post_array) > 0) {
try {
// POST /v3/serp/google/ai_mode/live/advanced
// in addition to 'google' and 'ai_mode' you can also set other search engine and type parameters
// the full list of possible parameters is available in documentation
$result = $client->post('/v3/serp/google/ai_mode/live/advanced', $post_array);
print_r($result);
// do something with post result
} catch (RestClientException $e) {
echo "n";
print "HTTP code: {$e->getHttpCode()}n";
print "Error code: {$e->getCode()}n";
print "Message: {$e->getMessage()}n";
print $e->getTraceAsString();
echo "n";
}
$client = null;
?>
from client import RestClient
# You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip
client = RestClient("login", "password")
post_data = dict()
# You can set only one task at a time
post_data[len(post_data)] = dict(
language_code="en",
location_code=2840,
keyword="what is google ai mode"
)
# POST /v3/serp/google/ai_mode/live/advanced
# in addition to 'google' and 'ai_mode' you can also set other search engine and type parameters
# the full list of possible parameters is available in documentation
response = client.post("/v3/serp/google/ai_mode/live/advanced", post_data)
# you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
if response["status_code"] == 20000:
print(response)
# do something with result
else:
print("error. Code: %d Message: %s" % (response["status_code"], response["status_message"]))
const axios = require('axios');
axios({
method: 'post',
url: 'https://api.dataforseo.com/v3/serp/google/ai_mode/live/advanced',
auth: {
username: 'login',
password: 'password'
},
data: [{
"language_code": "en",
"location_code": 2840,
"keyword": encodeURI("what is google ai mode")
}],
headers: {
'content-type': 'application/json'
}
}).then(function (response) {
var result = response['data']['tasks'];
// Result data
console.log(result);
}).catch(function (error) {
console.log(error);
});
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace DataForSeoDemos
{
public static partial class Demos
{
public static async Task serp_live_advanced()
{
var httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.dataforseo.com/"),
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
// DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) }
};
var postData = new List<object>();
// You can set only one task at a time
postData.Add(new
{
language_code = "en",
location_code = 2840,
keyword = "what is google ai mode"
});
// POST /v3/serp/google/ai_mode/live/advanced
// in addition to 'google' and 'ai_mode' you can also set other search engine and type parameters
// the full list of possible parameters is available in documentation
var taskPostResponse = await httpClient.PostAsync("/v3/serp/google/ai_mode/live/advanced", new StringContent(JsonConvert.SerializeObject(postData)));
var result = JsonConvert.DeserializeObject<dynamic>(await taskPostResponse.Content.ReadAsStringAsync());
// you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
if (result.status_code == 20000)
{
// do something with result
Console.WriteLine(result);
}
else
Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}");
}
}
}
The above command returns JSON structured like this:
{
"version": "0.1.20250526",
"status_code": 20000,
"status_message": "Ok.",
"time": "12.1502 sec.",
"cost": 0.008,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "06241736-1535-0139-0000-5b6a4f9d38ca",
"status_code": 20000,
"status_message": "Ok.",
"time": "12.0385 sec.",
"cost": 0.008,
"result_count": 1,
"path": [
"v3",
"serp",
"google",
"ai_mode",
"live",
"advanced"
],
"data": {
"api": "serp",
"function": "live",
"se": "google",
"se_type": "ai_mode",
"language_code": "en",
"location_code": 2840,
"keyword": "what is google ai mode",
"calculate_rectangles": true,
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "what is google ai mode",
"type": "ai_mode",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=what%20is%20google%20ai%20mode&num=1&hl=en&gl=US&udm=50&uule=w+CAIQIFISCQs2MuSEtepUEUK33kOSuTsc",
"datetime": "2025-06-24 14:36:54 +00:00",
"spell": null,
"refinement_chips": null,
"item_types": [
"ai_overview"
],
"se_results_count": 0,
"items_count": 1,
"items": [
{
"type": "ai_overview",
"rank_group": 1,
"rank_absolute": 1,
"position": "left",
"xpath": "/html[1]/body[1]/div[3]/div[1]/div[12]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]",
"asynchronous_ai_overview": false,
"markdown": " The BMW M4 F82 is a high-performance coupe known for its aggressive styling and powerful engine. Key specs include a 3.0-liter twin-turbo inline-six engine producing 425 hp (or 444 hp with the Competition Package), a 6-speed manual or 7-speed M DCT transmission, and rear-wheel drive. [[1]](https://www.autoevolution.com/cars/bmw-m4-f82-2014.html#:~:text=The%20load%20capacity%20was%20more,4%20GASOLINE%20Engines) [[2]](https://www.pistonheads.com/news/ph-driven/2014-bmw-m3-and-m4-f80-f82--review/29973) [[3]](https://www.bmw-m.com/en/topics/magazine-article-pool/bmw-m3-f80-and-bmw-m4-f82.html#:~:text=Towards%20the%20end%20of%20the,strong%20engine%20were%20also%20standard.) [[4]](https://www.newcenturybmw.com/bmw-research/bmw-m4-0-60/#:~:text=2023%20BMW%20M4%20Coupe,60%20time%20of%204.1%20seconds.)",
"items": [
{
"type": "ai_overview_element",
"rank_group": 1,
"rank_absolute": 1,
"position": "left",
"title": null,
"text": "The BMW M4 F82 is a high-performance coupe known for its aggressive styling and powerful engine. Key specs include a 3.0-liter twin-turbo inline-six engine producing 425 hp (or 444 hp with the Competition Package), a 6-speed manual or 7-speed M DCT transmission, and rear-wheel drive.",
"markdown": "",
"links": [
{
"type": "link_element",
"title": "according to Bankrate",
"description": null,
"url": "https://www.bankrate.com/home-equity/heloc-rates/",
"domain": "www.bankrate.com"
}
],
"images": [
{
"type": "images_element",
"alt": "BMW M4 Coupe (F82) Specs, Performance & Photos - 2014, 2015 ...",
"url": null,
"image_url": "https://api.dataforseo.com/cdn/i/06170329-5643-0066-0000-4f9b0f8172ba:1"
}
],
"references": [
{
"type": "ai_overview_reference",
"rank_group": 1,
"rank_absolute": 1,
"position": "left",
"source": "autoevolution",
"domain": "www.autoevolution.com",
"url": "https://www.autoevolution.com/cars/bmw-m4-f82-2014.html#:~:text=The%20load%20capacity%20was%20more,4%20GASOLINE%20Engines",
"title": "BMW M4 Coupe (F82) (2014-2020) Photos, engines & full specs",
"text": "The load capacity was more than enough for two big luggages, as well as the cabin being equipped with lots of storage spaces – not..."
},
{
"type": "ai_overview_reference",
"rank_group": 2,
"rank_absolute": 2,
"position": "left",
"source": "PistonHeads",
"domain": "www.pistonheads.com",
"url": "https://www.pistonheads.com/news/ph-driven/2014-bmw-m3-and-m4-f80-f82--review/29973",
"title": "2014 BMW M3 and M4 (F80/F82) | Review - PistonHeads UK",
"text": "May 12, 2014 — SPECIFICATION | 2014 BMW M4 F82. Engine: 2,979cc 6-cyl twin-turbo. Transmission: 6-speed manual/7-speed dual-clut..."
}
]
},
{
"type": "ai_overview_expanded_element",
"position": "left",
"title": "Step 4",
"text": "Calculate Springfield Division sales for Quarter 2",
"components": [
{
"type": "ai_overview_expanded_component",
"rank_group": 0,
"rank_absolute": 0,
"title": null,
"text": "Springfield Division sales in Quarter 1 are $1,500,000. Growth rate is 3%. Sales in Quarter 2 are $1,545,000.",
"markdown": "- Springfield Division sales in Quarter 1 are $1,500,000.\n- Growth rate is 3%.\n- Sales in Quarter 2 are $1,545,000.",
"images": null,
"links": null,
"references": null
}
],
"references": null
},
{
"type": "ai_overview_video_element",
"position": "left",
"title": "Anwar And Cars",
"snippet": "Start time is 11 minutes. Segment duration is 59 seconds",
"url": "https://www.youtube.com/watch?v=HmyTDeZMgFA&t=684",
"domain": "www.youtube.com",
"image_url": "https://i.ytimg.com/vi/HmyTDeZMgFA/mqdefault.jpg?sqp=-oaymwEGCPgEEOQC&rs=AMzJL3k9gZe_ujVtsk34XtwaOmPw3Cw0pg",
"source": "YouTube",
"date": "Apr 26, 2024",
"timestamp": "2024-04-26 00:00:00 +00:00"
},
{
"type": "ai_overview_table_element",
"position": "left",
"markdown": "| Aspect | Sanity Testing | Regression Testing |\n|---|---|---|\n| **Scope** | Narrow and focused | Broad and thorough |\n| **Depth** | Surface-level | Deep testing |\n| **Objective** | Quick validation | Detect regressions |",
"table": {
"table_header": null,
"table_content": [
["Aspect", "Sanity Testing", "Regression Testing"],
["Scope", "Narrow and focused", "Broad and thorough"],
["Depth", "Surface-level", "Deep testing"],
["Objective", "Quick validation", "Detect regressions"]
]
},
"references": null
}
],
"references": [
{
"type": "ai_overview_reference",
"rank_group": 1,
"rank_absolute": 21,
"position": "right",
"source": "autoevolution",
"domain": "www.autoevolution.com",
"url": "https://www.autoevolution.com/cars/bmw-m4-f82-2014.html#:~:text=The%20load%20capacity%20was%20more,4%20GASOLINE%20Engines",
"title": "BMW M4 Coupe (F82) (2014-2020) Photos, engines & full specs",
"text": "The load capacity was more than enough for two big luggages, as well as the cabin being equipped with lots of storage spaces – not..."
},
{
"type": "ai_overview_reference",
"rank_group": 2,
"rank_absolute": 22,
"position": "right",
"source": "PistonHeads",
"domain": "www.pistonheads.com",
"url": "https://www.pistonheads.com/news/ph-driven/2014-bmw-m3-and-m4-f80-f82--review/29973",
"title": "2014 BMW M3 and M4 (F80/F82) | Review - PistonHeads UK",
"text": "May 12, 2014 — SPECIFICATION | 2014 BMW M4 F82. Engine: 2,979cc 6-cyl twin-turbo. Transmission: 6-speed manual/7-speed dual-clut..."
}
],
"rectangle": null
}
]
}
]
}
]
}
All POST data should be sent in the JSON format (UTF-8 encoding). The task setting is done using the POST method. When setting a task, you should send all task parameters in the task array of the generic POST array. You can send up to 2000 API calls per minute, each Live SERP API call can contain only one task.
Below you will find a detailed description of the fields you can use for setting a task.
Description of the fields for setting a task:
Field name
Type
Description
keyword
string
keyword required field
you can specify up to 700 characters in the keyword field
all %## will be decoded (plus character ‘+’ will be decoded to a space character)
if you need to use the “%” character for your keyword, please specify it as “%25”;
if you need to use the “+” character for your keyword, please specify it as “%2B”
learn more about rules and limitations of keyword and keywords fields in DataForSEO APIs in this Help Center article
priority
integer
task priority
optional field
can take the following values:
1 – normal execution priority (set by default)
2 – high execution priority
location_name
string
full name of search engine location required field if you don’t specifylocation_code or location_coordinate if you use this field, you don’t need to specify location_code or location_coordinate
you can receive the list of available locations of the search engine with their location_name by making a separate request to the https://api.dataforseo.com/v3/serp/google/locations
example: London,England,United Kingdom
location_code
integer
search engine location code required field if you don’t specifylocation_name or location_coordinate if you use this field, you don’t need to specify location_name or location_coordinate
you can receive the list of available locations of the search engines with their location_code by making a separate request to the https://api.dataforseo.com/v3/serp/google/locations
example: 2840
location_coordinate
string
GPS coordinates of a location required field if you don’t specifylocation_name or location_code if you use this field, you don’t need to specify location_name or location_code location_coordinate parameter should be specified in the “latitude,longitude,zoom” format
if “zoom” is not specified, 9z will be applied as a default value
the maximum number of decimal digits for “latitude” and “longitude”: 7
the minimum value for “zoom”: 4z
the maximum value for “zoom”: 18z
example: 52.6178549,-155.352142,18z
language_name
string
full name of search engine language
required field if you don’t specify language_code;
if you use this field, you don’t need to specify language_code;
you can receive the list of available languages of the search engine with their language_name by making a separate request to the https://api.dataforseo.com/v3/serp/google/ai_mode/languages; Note: currently, the only supported value is English
language_code
string
search engine language code
required field if you don’t specify language_name;
if you use this field, you don’t need to specify language_name;
you can receive the list of available languages of the search engine with their language_code by making a separate request to the https://api.dataforseo.com/v3/serp/google/ai_mode/languages Note: currently, the only supported value is en
device
string
device type
optional field
can take the values:desktop, mobile
default value: desktop
os
string
device operating system
optional field
if you specify desktop in the device field, choose from the following values: windows, macos
default value: windows
if you specify mobile in the device field, choose from the following values: android, ios
default value: android
calculate_rectangles
boolean
calcualte pixel rankings for SERP elements in advanced results
optional field
pixel ranking refers to the distance between the result snippet and top left corner of the screen; Visit Help Center to learn more>>
by default, the parameter is set to false Note: if set to true, the charge per task will be multiplied by 2
browser_screen_width
integer
browser screen width
optional field
you can set a custom browser screen width to calculate pixel rankings for a particular device;
by default, the parameter is set to: 1920 for desktop; 360 for mobile on android; 375 for mobile on iOS; Note: to use this parameter, set calculate_rectangles to true
browser_screen_height
integer
browser screen height
optional field
you can set a custom browser screen height to calculate pixel rankings for a particular device;
by default, the parameter is set to: 1080 for desktop; 640 for mobile on android; 812 for mobile on iOS; Note: to use this parameter, set calculate_rectangles to true
browser_screen_resolution_ratio
integer
browser screen resolution ratio
optional field
you can set a custom browser screen resolution ratio to calculate pixel rankings for a particular device;
by default, the parameter is set to: 1 for desktop; 3 for mobile on android; 3 for mobile on iOS; Note: to use this parameter, set calculate_rectangles to true
tag
string
user-defined task identifier
optional field the character limit is 255
you can use this parameter to identify the task and match it with the result
you will find the specified tag value in the data object of the response
As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.
Description of the fields in the results array:
Field name
Type
Description
version
string
the current version of the API
status_code
integer
general status code
you can find the full list of the response codes here Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions
status_message
string
general informational message
you can find the full list of general informational messages here
time
string
execution time, seconds
cost
float
total tasks cost, USD
tasks_count
integer
the number of tasks in the tasks array
tasks_error
integer
the number of tasks in the tasks array returned with an error
tasks
array
array of tasks
id
string
task identifier unique task identifier in our system in the UUID format
status_code
integer
status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here
status_message
string
informational message of the task
you can find the full list of general informational messages here
time
string
execution time, seconds
cost
float
cost of the task, USD
result_count
integer
number of elements in the result array
path
array
URL path
data
object
contains the same parameters that you specified in the POST request
result
array
array of results
keyword
string
keyword received in a POST array the keyword is returned with decoded %## (plus symbol ‘+’ will be decoded to a space character)
type
string
search engine type in a POST array
se_domain
string
search engine domain in a POST array
location_code
integer
location code in a POST array
language_code
string
language code in a POST array
check_url
string
direct URL to search engine results you can use it to make sure that we provided exact results
datetime
string
date and time when the result was received
in the UTC format: “yyyy-mm-dd hh-mm-ss +00:00”
example: 2019-11-15 12:57:46 +00:00
spell
object
autocorrection of the search engine
if the search engine provided results for a keyword that was corrected, we will specify the keyword corrected by the search engine and the type of autocorrection
keyword
string
keyword obtained as a result of search engine autocorrection
the results will be provided for the corrected keyword
type
string
type of autocorrection
possible values: did_you_mean, showing_results_for, no_results_found_for, including_results_for
group rank in SERP
position within a group of elements with identical type values
positions of elements with different type values are omitted from rank_group
rank_absolute
integer
absolute rank in SERP
absolute position among all the elements in SERP
position
string
the alignment of the element in SERP
can take the following values: left, right
indicates whether the element is loaded asynchronically
if true, the ai_overview element is loaded asynchronically;
if false, the ai_overview element is loaded from cache
markdown
string
content of the element in markdown format
the text of the ai_overview formatted in the markdown markup language
items
array
items present in the element
type
string
type of element = ‘ai_overview_element‘
rank_group
integer
group rank in SERP
position within a group of elements with identical type values
positions of elements with different type values are omitted from rank_group
rank_absolute
integer
absolute rank in SERP
absolute position among all the elements in SERP
position
string
the alignment of the element in SERP
can take the following values: left, right
title
string
title of the element
text
string
text or description of the element in SERP
markdown
string
content of the element in markdown format
links
array
website links featured in the element
type
string
type of element = ‘link_element‘
title
string
link anchor text
description
string
link description
url
string
link URL
domain
string
domain in SERP
images
array
images of the element
if there are none, equals null
type
string
type of element = ‘images_element‘
alt
string
alt tag of the image
url
string
relevant URL
image_url
string
URL of the image
the URL leading to the image on the original resource or DataForSEO storage (in case the original source is not available)
references
array
references relevant to the element
includes references to webpages that were used to generate the ai_overview_element
type
string
type of element = ‘ai_overview_reference‘
source
string
reference source name or title
domain
string
domain name of the reference
url
string
reference page URL
title
string
reference page title
text
string
reference text
text snippet from the page that was used to generate the ai_overview_element
type
string
type of element = ‘ai_overview_video_element‘
position
string
the alignment of the element in SERP
can take the following values: left, right
title
string
title of the element
snippet
string
additional information for the video
url
string
URL of the link to the video
domain
string
domain of the website hosting the video
image_url
string
URL to the image thumbnail of the video
source
string
name of the source of the video
date
string
date when the video was published or indexed
example: Apr 26, 2024
timestamp
string
date and time when the video was published or indexed
in the UTC format: “yyyy-mm-dd hh-mm-ss +00:00”
example: 2019-11-15 12:57:46 +00:00
type
string
type of element = ‘ai_overview_table_element‘
position
string
the alignment of the element in SERP
can take the following values: left, right
markdown
string
content of the element in markdown format
table
object
table present in the element
the header and content of the table present in the element
table_header
array
content in the header of the table
table_content
array
array of contents of the table present in the element
each array represents the table row
references
array
references relevant to the element
includes references to webpages that were used to generate the ai_overview_element
type
string
type of element = ‘ai_overview_reference‘
source
string
reference source name or title
domain
string
domain name of the reference
url
string
reference page URL
title
string
reference page title
text
string
reference text
text snippet from the page that was used to generate the ai_overview_element
type
string
type of element = ‘ai_overview_expanded_element‘
position
string
the alignment of the element in SERP
can take the following values: left, right
title
string
title of the element in SERP
text
string
additional text of the element in SERP
components
array
array of components of the element
type
array
type of component = ‘ai_overview_expanded_component‘
rank_group
integer
group rank in SERP
position within a group of elements with identical type values
positions of elements with different type values are omitted from rank_group
rank_absolute
integer
absolute rank in SERP
absolute position among all the elements in SERP
title
string
title of the element in SERP
text
string
text of the component
markdown
string
text of the component in the markdwon format
images
array
images of the component
if there are none, equals null
type
string
type of element = ‘images_element‘
alt
string
alt tag of the image
url
string
relevant URL
image_url
string
URL of the image
the URL leading to the image on the original resource or DataForSEO storage (in case the original source is not available)
links
array
sitelinks
the links shown below some of Google’s search results
if there are none, equals null
type
string
type of element = ‘link_element‘
title
string
title of the link
description
string
description of the link
url
string
URL in link
domain
string
domain in link
references
array
additional references relevant to the item
includes references to webpages that may have been used to generate the ai_overview
type
string
type of element = ‘ai_overview_reference‘
source
string
reference source name or title
domain
string
domain name of the reference
url
string
reference page URL
title
string
reference page title
text
string
reference text
text snippet from the page that was used to generate the ai_overview_element
references
array
additional references relevant to the item
includes references to webpages that may have been used to generate the ai_overview
type
string
type of element = ‘ai_overview_reference‘
source
string
reference source name or title
domain
string
domain name of the reference
url
string
reference page URL
title
string
reference page title
text
string
reference text
text snippet from the page that was used to generate the ai_overview_element
rectangle
object
rectangle parameters
contains cartesian coordinates and pixel dimensions of the result’s snippet in SERP
equals null if calculate_rectangles in the POST request is not set to true
x
float
x-axis coordinate
x-axis coordinate of the top-left corner of the result’s snippet, where top-left corner of the screen is the origin
y
float
y-axis coordinate
y-axis coordinate of the top-left corner of the result’s snippet, where top-left corner of the screen is the origin