SerpBase
Back to Blog

Google Autocomplete API: Search Suggestions as JSON for Keyword Research

Google has no official autocomplete API. One POST returns the search box suggestions as JSON, in order. Includes a script that expands one seed into a keyword list.

November 24, 2026
By SerpBase Team2 min read

Short answer: POST the first few characters to /google/autocomplete and you get the suggestions Google shows in its search box as JSON — in order, with Google's own relevance score.

Google has never offered an official autocomplete API. The suggestions are valuable because they are real queries people type, ranked by how often — the cheapest source of long-tail keyword ideas there is.

The request

curl -X POST 'https://api.serpbase.dev/google/autocomplete' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{"q":"how to learn py","gl":"us","hl":"en"}'

What comes back

We ran this on 24 November 2026: 15 suggestions in 0.6 seconds.

{
  "status": 0,
  "query": "how to learn py",
  "suggestions": [
    {"rank": 1, "value": "how to learn python", "relevance": 1251}
  ]
}

rank is the order in the dropdown; relevance is the score Google attaches to each suggestion, useful for comparing suggestions within one response.

Python: expand one seed into a keyword list

The standard trick is to append each letter of the alphabet to a seed and collect everything Google suggests:

import requests, string, time

def suggest(q):
    r = requests.post(
        "https://api.serpbase.dev/google/autocomplete",
        headers={"X-API-Key": "YOUR_API_KEY"},
        json={"q": q, "gl": "us", "hl": "en"},
        timeout=20,
    ).json()
    return [s["value"] for s in r.get("suggestions", [])]

seed = "serp api"
found = set(suggest(seed))
for letter in string.ascii_lowercase:
    found.update(suggest(f"{seed} {letter}"))
    time.sleep(0.5)

print(len(found), "keywords")
for kw in sorted(found):
    print(kw)

That is 27 requests, 27 credits, and up to a few hundred distinct phrases for one seed.

Getting more out of it

  • Use question prefixes. how to <seed>, why does <seed>, <seed> vs and <seed> for each pull a different set.
  • Set the market. Suggestions depend on gl and hl; the same prefix returns different phrases in the UK or in Spanish.
  • Do not read relevance as search volume. It orders suggestions; it is not a monthly count. Pair it with Google Trends if you need demand over time.
  • Short prefixes are broad. Three or four characters return generic head terms; longer prefixes return the specific phrases worth targeting.

What people build with it

Keyword research tools, content calendars built from real questions, search boxes that suggest as the user types, and brand monitoring (what Google completes after your product's name).

Cost and limits

Each request costs 1 credit. Requests that fail are not charged. The response is always HTTP 200 with a status field: 0 means success, anything else comes with an error string, so check status rather than the HTTP code. New accounts get 500 free credits without a card.