Skip to main content
POST
Place Autocomplete

Overview

Backs the planner place search (packages/shared/components/planner/lib/googlePlaces.ts). The server fans out two Google Places API (New) places:autocomplete calls in parallel — one unrestricted (biased to a 50 km circle around origin when provided) and, when bbox is present, one hard-bounded to that rectangle — and returns both prediction lists. The client compares the two to flag results in/out of the operating city’s service area. The Google API key lives only on the server (GOOGLE_PLACES_API_KEY function secret, API-scoped to Places API (New), no application restriction). Clients carry no Google key. Predictions carry no geometry — resolve a picked prediction with Place Details, which also closes the billing session.

Authentication

Any authenticated caller (user session, publishable key, or service key):
Rate limited per user (signed-in) or IP (anonymous): 120 / 60 requests per 60s shared with /place-search/details. Breaches return 429 with a Retry-After header.

Body Parameters

string
required
The typed query. Non-empty, at most 256 characters.
string
required
UUID minted by the client on the first keystroke of a typing interaction and reused for every subsequent autocomplete call, then passed to the details call. Google bills the whole interaction as one Autocomplete session. At most 128 characters.
object
{ latitude, longitude } — the map center. Enables distanceMeters on predictions (straight-line meters from this point) and the 50 km locationBias circle on the unrestricted call.
number[]
[minLng, minLat, maxLng, maxLat] — the active service-area rectangle. When present, the second (bounded) Google call runs with this as a locationRestriction. Values must be valid lng/lat with min < max.

Response

Prediction[]
Predictions from the unbounded call, in Google’s ranking order. Each prediction is slimmed to exactly the fields the client reads — nothing else survives the proxy:placeId (string) · text.text (string, the full prediction text, e.g. "Waterloo Station, London, UK") · structuredFormat.mainText.text / structuredFormat.secondaryText.text (strings) · types (string[], Google’s underscored types) · distanceMeters (number, only when origin was sent — may be absent on e.g. route rows).Absent fields are omitted, never null. Suggestions without a placePrediction (query predictions) are dropped.
Prediction[] | null
Predictions from the bbox-bounded call, same slimming. null when no bbox was sent or when the bounded call failed — the bounded leg only powers the in/outside-service-area partition, so its failure degrades to a flat list rather than failing the search. Clients must treat null as “no partition available”.

Example

Errors