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", "position": "right", "xpath": "/html[1]/body[1]/div[2]/div[1]/div[5]/div[1]/div[2]/section[1]/div[1]/div[1]/div[1]/div[3]/div[6]/div[1]/div[1]/div[1]/div[1]/div[2]", "markdown": "Google AI Mode, also known as **AI Mode** , is a feature within Google Search. It uses generative AI, specifically the Gemini model, for a **more conversational and AI-powered search experience** . It provides users with comprehensive, AI-generated responses and allows follow-up questions to refine a search.\n\n**Here's a breakdown of Google AI Mode:** \n\n- **Conversational AI Experience:** AI Mode changes Google Search into a chatbot-like interface. Users can ask complex, multi-part questions in a natural, conversational style.\n- **AI-Powered Responses:** Instead of a list of links, AI Mode uses the Gemini model to gather information from various online sources. It then generates comprehensive, AI-powered responses to queries.\n- **\"Query Fan-Out\" Technique:** AI Mode uses \"query fan-out.\" This technique breaks down a question into related subtopics. It then issues multiple searches across different data sources. This allows for a deeper search and a more diverse range of information.\n- **Multimodal Capabilities:** AI Mode supports text, voice, and images. This allows users to interact with the search engine in an intuitive way.\n- **Follow-up Questions:** Users can ask follow-up questions to refine their search. This allows for more specific or detailed information. This makes the search experience more personalized and efficient.\n- **Integrated with Google Search:** AI Mode is integrated directly into the Google Search interface. It often appears as a new tab next to standard search results.\n- **Similar to other AI Assistants:** AI Mode is similar to other AI assistants like ChatGPT and Google's Gemini. It allows for conversational interactions and provides AI-generated responses.\n\nIn short, Google AI Mode aims to make finding and accessing information on Google Search easier. It does this by providing a powerful, AI-powered conversational experience that goes beyond traditional keyword-based searches.", "items": [ { "type": "ai_overview_element", "position": "left", "title": "AI Mode more conversational and AI-powered search experience", "text": null, "markdown": "Google AI Mode, also known as **AI Mode** , is a feature within Google Search. It uses generative AI, specifically the Gemini model, for a **more conversational and AI-powered search experience** . It provides users with comprehensive, AI-generated responses and allows follow-up questions to refine a search.", "links": null, "images": null, "references": [ { "type": "ai_overview_reference", "position": "left", "source": "Search Engine Land", "domain": "searchengineland.com", "url": "https://searchengineland.com/google-ai-mode-finally-rolling-out-to-all-users-in-the-u-s-456982#:~:text=Google%20said%20AI%20Mode%20%E2%80%9Cis,it%2C%20is%20a%20big%20deal.", "title": "Google AI Mode finally rolling out to all users in the U.S.", "text": "Jun 13, 2025 — Google announced at I/O, three weeks ago, AI Mode will roll out to all US users and now that seems to be happening. * AI Mode signed out. When you use Google wi..." }, { "type": "ai_overview_reference", "position": "left", "source": "WG Content", "domain": "wgcontent.com", "url": "https://wgcontent.com/blog/google-ai-mode-content-seo/#:~:text=What's%20Google%20AI%20Mode?,to%20ask%20follow-up%20questions.", "title": "Google AI Mode: the next big thing for your content and SEO strategy", "text": "Jun 4, 2025 — Key takeaways: * Google AI Mode transforms search into a personalized, conversational experience by enabling complex, follow-up queries within a familiar interf..." } ] }, { "type": "ai_overview_element", "position": "left", "title": "Here's a breakdown of Google AI Mode:", "text": "Conversational AI Experience: AI Mode changes Google Search into a chatbot-like interface. Users can ask complex, multi-part questions in a natural, conversational style. AI-Powered Responses: Instead of a list of links, AI Mode uses the Gemini model to gather information from various online sources. It then generates comprehensive, AI-powered responses to queries. \"Query Fan-Out\" Technique: AI Mode uses \"query fan-out.\" This technique breaks down a question into related subtopics. It then issues multiple searches across different data sources. This allows for a deeper search and a more diverse range of information. Multimodal Capabilities: AI Mode supports text, voice, and images. This allows users to interact with the search engine in an intuitive way. Follow-up Questions: Users can ask follow-up questions to refine their search. This allows for more specific or detailed information. This makes the search experience more personalized and efficient. Integrated with Google Search: AI Mode is integrated directly into the Google Search interface. It often appears as a new tab next to standard search results. Similar to other AI Assistants: AI Mode is similar to other AI assistants like ChatGPT and Google's Gemini. It allows for conversational interactions and provides AI-generated responses.", "markdown": "- **Conversational AI Experience:** AI Mode changes Google Search into a chatbot-like interface. Users can ask complex, multi-part questions in a natural, conversational style.\n- **AI-Powered Responses:** Instead of a list of links, AI Mode uses the Gemini model to gather information from various online sources. It then generates comprehensive, AI-powered responses to queries.\n- **\"Query Fan-Out\" Technique:** AI Mode uses \"query fan-out.\" This technique breaks down a question into related subtopics. It then issues multiple searches across different data sources. This allows for a deeper search and a more diverse range of information.\n- **Multimodal Capabilities:** AI Mode supports text, voice, and images. This allows users to interact with the search engine in an intuitive way.\n- **Follow-up Questions:** Users can ask follow-up questions to refine their search. This allows for more specific or detailed information. This makes the search experience more personalized and efficient.\n- **Integrated with Google Search:** AI Mode is integrated directly into the Google Search interface. It often appears as a new tab next to standard search results.\n- **Similar to other AI Assistants:** AI Mode is similar to other AI assistants like ChatGPT and Google's Gemini. It allows for conversational interactions and provides AI-generated responses.", "links": null, "images": null, "references": [ { "type": "ai_overview_reference", "position": "left", "source": "Zapier", "domain": "zapier.com", "url": "https://zapier.com/blog/google-ai-mode/#:~:text=Google's%20new%20AI%20Mode%20feature,interactive%20and%20tailored%20to%20you.", "title": "What is Google AI Mode? - Zapier", "text": "May 22, 2025 — What is Google AI Mode? ... I can't be the only person who types a question into Google, opens 12 tabs from the results, and somehow still can't find a straight..." }, { "type": "ai_overview_reference", "position": "left", "source": "WG Content", "domain": "wgcontent.com", "url": "https://wgcontent.com/blog/google-ai-mode-content-seo/#:~:text=What's%20Google%20AI%20Mode?,to%20ask%20follow-up%20questions.", "title": "Google AI Mode: the next big thing for your content and SEO strategy", "text": "Jun 4, 2025 — Key takeaways: * Google AI Mode transforms search into a personalized, conversational experience by enabling complex, follow-up queries within a familiar interf..." }, { "type": "ai_overview_reference", "position": "left", "source": "Search Engine Land", "domain": "searchengineland.com", "url": "https://searchengineland.com/google-ai-mode-finally-rolling-out-to-all-users-in-the-u-s-456982#:~:text=Google%20said%20AI%20Mode%20%E2%80%9Cis,it%2C%20is%20a%20big%20deal.", "title": "Google AI Mode finally rolling out to all users in the U.S.", "text": "Jun 13, 2025 — Google announced at I/O, three weeks ago, AI Mode will roll out to all US users and now that seems to be happening. * AI Mode signed out. When you use Google wi..." }, { "type": "ai_overview_reference", "position": "left", "source": "Google for Developers", "domain": "developers.google.com", "url": "https://developers.google.com/search/docs/appearance/ai-features#:~:text=They%20were%20designed%20to%20show,%2C%20often%20don't%20trigger.", "title": "AI Features and Your Website | Google Search Central", "text": "Jun 19, 2025 — They were designed to show up on queries where they can add additional benefits beyond what people might already get on Search. With AI Overviews, people have b..." }, { "type": "ai_overview_reference", "position": "left", "source": "Google Blog", "domain": "blog.google", "url": "https://blog.google/intl/en-in/products/google-search-introducing-ai-mode-in-india/#:~:text=Helping%20people%20explore%20the%20best,AI%20Mode%20in%20Google%20Search.", "title": "Google Search: Introducing AI Mode in India", "text": "Jun 24, 2025 — Google Search: Introducing AI Mode in India. ... * Imagine being able to ask whatever's on your mind, even a question that's very complex or multi-layered, and ..." }, { "type": "ai_overview_reference", "position": "left", "source": "Google Help", "domain": "support.google.com", "url": "https://support.google.com/websearch/answer/16011537?hl=en&co=GENIE.Platform%3DAndroid#:~:text=How%20to%20use%20AI%20Mode,.", "title": "Get AI-powered responses with AI Mode in Google Search - Android", "text": "It divides your question into subtopics and searches for each one simultaneously. This way, AI Mode can explore the web to find even more relevant content that ..." }, { "type": "ai_overview_reference", "position": "left", "source": "The New York Times", "domain": "www.nytimes.com", "url": "https://www.nytimes.com/2025/05/29/technology/personaltech/google-ai-mode-search.html#:~:text=The%20prominent%20placement%20of%20AI,Here's%20how%20it%20went.", "title": "Google AI Mode for Search Has Arrived. Proceed With Caution.", "text": "May 29, 2025 — Its list included a nearby Whole Foods, which didn't carry the item. * I wasn't doing traditional web searches on Google.com. I was testing the company's new AI..." } ] }, { "type": "ai_overview_element", "position": "left", "title": null, "text": "In short, Google AI Mode aims to make finding and accessing information on Google Search easier. It does this by providing a powerful, AI-powered conversational experience that goes beyond traditional keyword-based searches.", "markdown": "In short, Google AI Mode aims to make finding and accessing information on Google Search easier. It does this by providing a powerful, AI-powered conversational experience that goes beyond traditional keyword-based searches.", "links": null, "images": null, "references": [ { "type": "ai_overview_reference", "position": "left", "source": "Google Blog", "domain": "blog.google", "url": "https://blog.google/intl/en-in/products/google-search-introducing-ai-mode-in-india/#:~:text=Helping%20people%20explore%20the%20best,AI%20Mode%20in%20Google%20Search.", "title": "Google Search: Introducing AI Mode in India", "text": "Jun 24, 2025 — Google Search: Introducing AI Mode in India. ... * Imagine being able to ask whatever's on your mind, even a question that's very complex or multi-layered, and ..." }, { "type": "ai_overview_reference", "position": "left", "source": "Zapier", "domain": "zapier.com", "url": "https://zapier.com/blog/google-ai-mode/#:~:text=Google's%20new%20AI%20Mode%20feature,interactive%20and%20tailored%20to%20you.", "title": "What is Google AI Mode? - Zapier", "text": "May 22, 2025 — What is Google AI Mode? ... I can't be the only person who types a question into Google, opens 12 tabs from the results, and somehow still can't find a straight..." } ] }, { "type": "ai_overview_table_element", "position": "left", "markdown": "| Aspect | Sanity Testing | Regression Testing |\n|---|---|---|\n| **Scope** | Narrow and focused on recently changed functionalities or components. | Broad, covering the entire application to ensure changes don't negatively affect existing functionalities. |\n| **Depth of Testing** | Surface-level, a quick check for stability after recent changes. | Deep and thorough, testing various scenarios to ensure all functionalities work after modifications. |\n| **Objective** | To quickly validate specific functionalities after minor changes or bug fixes. | To detect defects or regressions introduced by recent code changes, ensuring stability and expected performance. |", "table": { "table_header": null, "table_content": [ [ "Aspect", "Sanity Testing", "Regression Testing" ], [ "Scope", "Narrow and focused on recently changed functionalities or components.", "Broad, covering the entire application to ensure changes don't negatively affect existing functionalities." ], [ "Depth of Testing", "Surface-level, a quick check for stability after recent changes.", "Deep and thorough, testing various scenarios to ensure all functionalities work after modifications." ], [ "Objective", "To quickly validate specific functionalities after minor changes or bug fixes.", "To detect defects or regressions introduced by recent code changes, ensuring stability and expected performance." ] ] } } ], "references": [ { "type": "ai_overview_reference", "position": "right", "source": "Search Engine Land", "domain": "searchengineland.com", "url": "https://searchengineland.com/google-ai-mode-finally-rolling-out-to-all-users-in-the-u-s-456982", "title": "Google AI Mode finally rolling out to all users in the U.S.", "text": "Jun 13, 2025 — Google announced at I/O, three weeks ago, AI Mode will roll out to all US users and now that seems to be happening. * AI Mode signed out. When you use Google wi..." }, { "type": "ai_overview_reference", "position": "right", "source": "Google Blog", "domain": "blog.google", "url": "https://blog.google/intl/en-in/products/google-search-introducing-ai-mode-in-india/", "title": "Google Search: Introducing AI Mode in India", "text": "Jun 24, 2025 — Google Search: Introducing AI Mode in India. ... * Imagine being able to ask whatever's on your mind, even a question that's very complex or multi-layered, and ..." }, { "type": "ai_overview_reference", "position": "right", "source": "Zapier", "domain": "zapier.com", "url": "https://zapier.com/blog/google-ai-mode/", "title": "What is Google AI Mode? - Zapier", "text": "May 22, 2025 — What is Google AI Mode? ... I can't be the only person who types a question into Google, opens 12 tabs from the results, and somehow still can't find a straight..." }, { "type": "ai_overview_reference", "position": "right", "source": "WG Content", "domain": "wgcontent.com", "url": "https://wgcontent.com/blog/google-ai-mode-content-seo/", "title": "Google AI Mode: the next big thing for your content and SEO strategy", "text": "Jun 4, 2025 — Key takeaways: * Google AI Mode transforms search into a personalized, conversational experience by enabling complex, follow-up queries within a familiar interf..." }, { "type": "ai_overview_reference", "position": "right", "source": "The New York Times", "domain": "www.nytimes.com", "url": "https://www.nytimes.com/2025/05/29/technology/personaltech/google-ai-mode-search.html", "title": "Google AI Mode for Search Has Arrived. Proceed With Caution.", "text": "May 29, 2025 — Its list included a nearby Whole Foods, which didn't carry the item. * I wasn't doing traditional web searches on Google.com. I was testing the company's new AI..." }, { "type": "ai_overview_reference", "position": "right", "source": "Google Help", "domain": "support.google.com", "url": "https://support.google.com/websearch/answer/16011537?hl=en&co=GENIE.Platform%3DAndroid", "title": "Get AI-powered responses with AI Mode in Google Search - Android", "text": "It divides your question into subtopics and searches for each one simultaneously. This way, AI Mode can explore the web to find even more relevant content that ..." }, { "type": "ai_overview_reference", "position": "right", "source": "Google for Developers", "domain": "developers.google.com", "url": "https://developers.google.com/search/docs/appearance/ai-features", "title": "AI Features and Your Website | Google Search Central", "text": "Jun 19, 2025 — They were designed to show up on queries where they can add additional benefits beyond what people might already get on Search. With AI Overviews, people have b..." } ], "rectangle": { "x": 300, "y": 288, "width": 652, "height": 812 } } ] } ] } ] }
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’ |
position |
string | the alignment of the element in SERP can take the following values: left , right |
xpath |
string | the XPath of the element |
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‘ |
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‘ |
position |
string | the alignment of the element in SERP can take the following values: left , right |
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_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 the text of the ai_overview formatted in the markdown markup language |
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 | 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 |