serpix

google-autocomplete-api

Google Autocomplete API

The suggestions Google offers while a query is being typed, as JSON. Useful for keyword research, for query expansion, and for seeing what Google thinks a partial phrase is heading towards.

Endpoint

One credit per request. Send the partial query as q; the response is the dropdown Google would have shown, in order.

GET/v1/autocomplete
bash
curl -G "https://api.serpix.io/v1/autocomplete" \
  --data-urlencode "q=how to make ch" \
  -H "Authorization: Bearer $SERPIX_API_KEY"

The same parameters are accepted as a JSON body on POST /v1/autocomplete:

post variant
curl -X POST "https://api.serpix.io/v1/autocomplete" \
  -H "Authorization: Bearer $SERPIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "how to make ch"}'

Parameters

Query
fieldtypedescription
qrequiredstringThe partial query to complete.
cpintegerCursor position within q, when completing mid-phrase rather than at the end.

Surface and locale

Surface and locale
fieldtypedescription
clientstringWhich Google surface to ask as. Different clients return differently shaped dropdowns, because Chrome's omnibox, the mobile app and the web box do not suggest identically.
glstringCountry to suggest for, two-letter code. Defaults to us.
hlstringLanguage of the suggestions, two-letter code.

Rejected parameters

Unknown parameters are never silently ignored. A request carrying one is rejected with 422 before anything runs, so a typo can't bill you for results you didn't ask for. Common parameters from raw Google URLs and other SERP APIs get a pointed message naming the equivalent here:

Rejected aliases
fieldtypedescription
ds422Chosen by client: youtube, img and products-cc address their own vertical for you.
num422Google decides how many suggestions each client serves.
keyword422Use q.
cursor_pointer422Use cp.
location / uule / lat / lon422Suggestions localize by gl and hl.
device422Each client is one suggest surface; there is no device variant.
google_domain422Suggestions are served from google.com in every locale; pick the locale with gl and hl.
xssi422Not needed. Responses are parsed for you.
callback / jsonp422Not supported. Responses are plain JSON.
engine422Not needed. This endpoint is Google Autocomplete.
api_key422Authenticate with the Authorization header, never the query string.
422 · rejected parameter
HTTP/2 422
content-type: application/json

{
  "detail": [
    {
      "type": "value_error",
      "loc": ["query"],
      "msg": "Value error, `ds` is not supported: chosen by `client` — youtube, img and products-cc address their own vertical for you",
      "input": { "q": "how to make ch", "ds": "yt", ... }
    }
  ]
}

Response

A request returns one JSON object: two envelope objects that are always present (search_metadata, search_parameters), the dropdown as suggestions, and verbatim_relevance. A field that wasn't served is omitted entirely, never null, never [], so a presence check is all you need before reading one.

200 · trimmed
{
  "search_metadata": {
    "id": "srx_5SIKB8BtevtpZzrr",
    "status": "success",
    "created_at": "2026-07-28T18:57:48Z",
    "took_ms": 455,
    "parser_version": "2026.07.1",
    "google_url": "https://www.google.com/complete/search?client=chrome&q=how+to+make+ch&hl=en&gl=us",
    "html_url": "https://api.serpix.io/searches/srx_5SIKB8BtevtpZzrr/bHOhaozWIL74pWpm.html",
    "json_url": "https://api.serpix.io/searches/srx_5SIKB8BtevtpZzrr/bHOhaozWIL74pWpm.json"
  },
  "search_parameters": {
    "q": "how to make ch",
    "client": "chrome",
    "gl": "us",
    "hl": "en"
  },
  "suggestions": [
    { "position": 1, "value": "how to make chicken salad", "relevance": 601, "type": "query" },
    { "position": 2, "value": "how to make chimichurri", "relevance": 600, "type": "query" },
    { "position": 3, "value": "how to make chocolate chip cookies", "relevance": 562, "type": "query" },
    { "position": 4, "value": "how to make cheese", "relevance": 561, "type": "query" },
    ...
  ],
  "verbatim_relevance": 851
}

Every response also reports its cost in the X-Serpix-Credits-Charged and X-Serpix-Credits-Remaining headers.

search_metadata

search_metadata fields
fieldtypedescription
idstringUnique id of this request, srx_ prefixed.
statusstringsuccess on every 200.
created_atstringWhen the request ran, ISO 8601 UTC.
took_msintegerEnd-to-end time to serve this response, in milliseconds.
parser_versionstringDated version of the autocomplete parser that produced this response, so any response can be tied to the parsing behaviour that made it. Each vertical carries its own.
google_urlstringThe exact Google URL fetched.
html_urlstringArchived copy of Google's own response. Included when available.
json_urlstringArchived copy of this JSON response. Included when available.

search_parameters

The parameters the request actually ran with, defaults filled in.

search_parameters fields
fieldtypedescription
qstringThe partial query as received.
clientstringSuggest surface used.
glstringCountry suggested for.
hlstringLanguage used.
cpintegerCursor position used. Present when sent.

suggestions

Each suggestion carries a relevance score, which is Google's own ranking weight rather than anything we compute. Higher means Google ranked it above its neighbour.

suggestions entry fields
fieldtypedescription
positionintegerRank in the dropdown, starting at 1.
valuestringThe suggested query, exactly as Google would display it.
relevanceintegerGoogle's own ranking weight for the suggestion.
typestringWhat kind of suggestion it is. Usually query, but Google also suggests ENTITIES, and those carry the four fields below.
titlestringEntity suggestions only: the entity's name.
subtitlestringEntity suggestions only: Google's one-line description, like American singer-songwriter.
thumbnailstringEntity suggestions only: a picture of the entity.
entity_idstringEntity suggestions only: Google's knowledge identifier for it.

A plain-query suggestion carries only the first four fields. The sample above is all queries, which is the common case; ask about a person or a place and Google mixes in entity suggestions that fill the rest. verbatim_relevance is the weight Google gives the query as actually typed, against which the suggestions compete.

Errors

A rejected request answers with detail, naming the parameter and what to send in its place. A request that could not be completed answers with error and a search_id you can quote. No error is ever charged.

Status codes
fieldtypedescription
401unauthorizedMissing, malformed, or revoked key. See Authentication.
402payment requiredThe balance can't cover a request. See Credits & billing.
422invalid requestUnknown or invalid parameter. The detail names the parameter and what to send in its place.
502search_failedThe request could not be completed. Retry it; you were not charged.
503search_unavailableGoogle did not serve a usable response. Retry it; you were not charged.
502 · search failed
HTTP/2 502
content-type: application/json
x-serpix-credits-charged: 0

{ "error": { "code": "search_failed", "search_id": "srx_kq3v9tR2xLw8mA1c" } }