---
description: Get the Google Autocomplete suggestions with the help our Autocomplete API.
---

# Google Autocomplete API

Here is the list of default parameters you can use with this API :\
\


|                           Parameters                           |                                                                                                          Description                                                                                                         |
| :------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| <p>api_key<br><br><mark style="color:red;">required</mark></p> |                                                                                                     This is your API key.                                                                                                    |
|    <p>q<br><br><mark style="color:red;">required</mark></p>    |                                                                                    <p>Type: <code>String</code><br>Google Search Query</p>                                                                                   |
|                               gl                               | <p>Type: <code>String</code></p><p></p><p>Default: <code>"us"</code><br>  Name of the country. The name should be in <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes">ISO 3166 Alpha-2</a> format.</p> |
|                               hl                               |                                                      <p>Type: <code>String</code></p><p><br>Default: <code>"en_US"</code> <br>The language of the requested results.</p>                                                     |

### API Example:

{% tabs %}
{% tab title="cURL" %}
```json
cURL "https://api.serpdog.io/autocomplete?api_key=APIKEY&q=football&gl=us"
```


{% endtab %}

{% tab title="Node JS" %}
```javascript
const axios = require('axios');

axios.get('https://api.serpdog.io/autocomplete?api_key=APIKEY&q=football&gl=us')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });
```


{% endtab %}

{% tab title="Python" %}
```python
import requests
payload = {'api_key': 'APIKEY', 'q':'football' , 'gl':'us'}
resp = requests.get('https://api.serpdog.io/autocomplete', params=payload)
print (resp.text)
```


{% endtab %}

{% tab title="Java" %}
```java
try {
 String url = "https://api.serpdog.io/autocomplete?api_key=APIKEY&q=football&gl=us";
 URL urlForGetRequest = new URL(url);
 String readLine = null;
 HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
 conection.setRequestMethod("GET");
 int responseCode = conection.getResponseCode();
 if (responseCode == HttpURLConnection.HTTP_OK) {
 BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
 StringBuffer response = new StringBuffer();
 while ((readLine = in.readLine()) != null) {
 response.append(readLine);
 }
 in.close();
 System.out.println(response.toString());
} else {
 throw new Exception("Error in API Call");
 }
} catch (Exception ex) {
 ex.printStackTrace();
}
```


{% endtab %}

{% tab title="Ruby" %}
```ruby
require 'net/http'
require 'json'
params = {
 :api_key => "APIKEY",
 :q => "football",
 :gl => "us"
}
uri = URI('https://api.serpdog.io/autocomplete')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
```


{% endtab %}

{% tab title="PHP" %}
```php
<?php
$url = "https://api.serpdog.io/autocomplete?api_key=APIKEY&q=footbal&gl=us";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
```


{% endtab %}
{% endtabs %}

```json
{
  "meta": {
    "api_key": "APIKEY",
    "q": "football",
    "gl": "us"
  },
  "suggestions": [
    {
      "value": "football cleats",
      "relevance": 601,
      "type": "QUERY"
    },
    {
      "value": "football games",
      "relevance": 600,
      "type": "QUERY"
    },
    {
      "value": "football wordle",
      "relevance": 555,
      "type": "QUERY"
    },
    {
      "value": "football today",
      "relevance": 554,
      "type": "QUERY"
    },
    {
      "value": "football gloves",
      "relevance": 553,
      "type": "QUERY"
    },
    {
      "value": "football field",
      "relevance": 552,
      "type": "QUERY"
    },
    {
      "value": "football movies",
      "relevance": 551,
      "type": "QUERY"
    },
    {
      "value": "football positions",
      "relevance": 550,
      "type": "QUERY"
    }
  ],
  "verbatim_relevance": 1300
}
```

