SERP
Google Autocomplete
Real-time Google Autocomplete suggestions — search predictions and query completions.
POST
$0.01/call/v1/serp/google-autocompleteUsage
const res = await fetch('https://api.yepapi.com/v1/serp/google-autocomplete', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ query: 'how to build a', depth: 10 }),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/serp/google-autocomplete \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "how to build a", "depth": 10}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
query | string | Yes | Partial search query to get autocomplete suggestions for | — |
depth | number | No | Number of suggestions to return | 10 |
location_code | number | No | Target country code (e.g., 2840 for US). See Location Codes. | 2840 |
language | string | No | ISO language code (e.g., en, es) | "en" |
Response
{
"ok": true,
"data": {
"query": "how to build a",
"totalResults": 0,
"results": [
{
"position": 1,
"type": "autocomplete",
"title": "",
"url": "",
"description": "",
"domain": ""
},
{
"position": 2,
"type": "autocomplete",
"title": "",
"url": "",
"description": "",
"domain": ""
},
{
"position": 3,
"type": "autocomplete",
"title": "",
"url": "",
"description": "",
"domain": ""
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.query | string | The partial query that was sent for autocomplete |
data.totalResults | number | Total number of suggestions returned (typically 0 as autocomplete does not report totals) |
data.results | object[] | Array of autocomplete suggestion items |
data.results[].position | number | Position of the suggestion (1-indexed) |
data.results[].type | string | Result type (typically autocomplete) |
data.results[].title | string | The suggested search query completion |
data.results[].url | string | URL for the suggestion (typically empty) |
data.results[].description | string | Additional context for the suggestion (typically empty) |
data.results[].domain | string | Associated domain (typically empty for autocomplete) |
Under the Hood
Under the hood, this queries our SERP engine. We normalize the response format and flatten nested structures for consistency.