NAVNavbar
cURL php NodeJS Python cSharp

Get Google AI Mode SERP Advanced Results by id

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access

<?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();
}
try {
	$result = array();
	// #1 - using this method you can get a list of completed tasks
	// GET /v3/serp/google/ai_mode/tasks_ready
	// 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
	$tasks_ready = $client->get('/v3/serp/google/ai_mode/tasks_ready');
	// you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
	if (isset($tasks_ready['status_code']) AND $tasks_ready['status_code'] === 20000) {
		foreach ($tasks_ready['tasks'] as $task) {
			if (isset($task['result'])) {
				foreach ($task['result'] as $task_ready) {
					// #2 - using this method you can get results of each completed task
					// GET /v3/serp/google/ai_mode/task_get/advanced/$id
					if (isset($task_ready['endpoint_advanced'])) {
						$result[] = $client->get($task_ready['endpoint_advanced']);
					}
					// #3 - another way to get the task results by id
					// GET /v3/serp/google/ai_mode/task_get/advanced/$id
					/*
					if (isset($task_ready['id'])) {
						$result[] = $client->get('/v3/serp/google/ai_mode/task_get/advanced/' . $task_ready['id']);
					}
					*/
				}
			}
		}
	}
	print_r($result);
	// do something with 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;
?>

The above command returns JSON structured like this:

{
  "version": "0.1.20250526",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "1.1269 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "06232022-1535-0066-0000-93ec1fb33ad0",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "1.0616 sec.",
      "cost": 0,
      "result_count": 1,
      "path": [
        "v3",
        "serp",
        "google",
        "ai_mode",
        "task_get",
        "advanced",
        "06232022-1535-0066-0000-93ec1fb33ad0"
      ],
      "data": {
        "api": "serp",
        "function": "task_get",
        "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": "![BMW M4 Coupe (F82) Specs, Performance & Photos - 2014, 2015 ...](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/) 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": "![BMW M4 Coupe](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/...)",
                  "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",
                      "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",
                      "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",
                      "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",
                  "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",
                  "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
            }
          ]
        }
      ]
    }
  ]
}

Description of the fields for sending a request:

Field name Type Description
id string task identifier
a universally unique identifier (UUID)
unique task identifier in our system
you will be able to use it within 30 days to request the results of the task at any time


‌‌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.

You can also get all available SERP features and possible extra elements by making a request to the following Sandbox URL:
https://sandbox.dataforseo.com/v3/serp/google/ai_mode/task_get/advanced/00000000-0000-0000-0000-000000000000
The response will include all available items in the Google Local Finder SERP Advanced endpoint with the fields containing dummy data.
You won’t be charged for using Sandbox endpoints.

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
            refinement_chips object search refinement chips
                type string type of element = ‘refinement_chips’
                xpath string the XPath of the element
                items array items of the element
                    type string type of element = ‘refinement_chips_element’
                    title string title of the element
                    url string search URL with refinement parameters
                    domain string domain in SERP
                    options array further search refinement options
                       type string type of element = ‘refinement_chips_option’
                       title string title of the element
                       url string search URL with refinement parameters
                       domain string domain in SERP
            item_types array types of search results in SERP
contains types of search results (items) found in SERP.
possible item types:
ai_overview
            se_results_count integer total number of results in SERP
            items_count integer the number of results returned in the items array
            items array elements of search results found in SERP
            ‘ai_overview’ element in SERP
                type string type of element = ‘ai_overview’
                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
                xpath string the XPath of the element
                asynchronous_ai_overview boolean 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/td>

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
                        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
                    width float width of the element in pixels
                    height float height of the element in pixels

‌‌