Stay organized with collections Save and categorize content based on your preferences.
AutocompleteRequest interfacegoogle.maps.places.AutocompleteRequest
interface
Request interface for AutocompleteSuggestion.fetchAutocompleteSuggestions
.
input
Type: string
The text string on which to search.
includedPrimaryTypes optional
Type: Array<string> optional
Included primary
Place type(for example, "restaurant" or "gas_station").
A Place is only returned if its primary type is included in this list. Up to 5 values can be specified. If no types are specified, all Place types are returned.
includedRegionCodes optional
Type: Array<string> optional
Only include results in the specified regions, specified as up to 15 CLDR two-character region codes. An empty set will not restrict the results. If both locationRestriction
and includedRegionCodes
are set, the results will be located in the area of intersection.
inputOffset optional
Type: number optional
A zero-based Unicode character offset of input
indicating the cursor position in input
. The cursor position may influence what predictions are returned. If not specified, defaults to the length of input
.
language optional
Type: string optional
The language in which to return results. Will default to the browser's language preference. The results may be in mixed languages if the language used in input
is different from language
, or if the returned Place does not have a translation from the local language to language
.
locationBias optional
Type: LocationBias optional
At most one of locationBias
or locationRestriction
should be set. If neither are set, the results will be biased by IP address, meaning the IP address will be mapped to an imprecise location and used as a biasing signal.
locationRestriction optional
Type: LocationRestriction optional
At most one of locationBias
or locationRestriction
should be set. If neither are set, the results will be biased by IP address, meaning the IP address will be mapped to an imprecise location and used as a biasing signal.
origin optional
Type: LatLng|LatLngLiteral optional
The origin point from which to calculate geodesic distance to the destination (returned as
PlacePrediction.distanceMeters
). If this value is omitted, geodesic distance will not be returned.
region optional
Type: string optional
The region code, specified as a CLDR two-character region code. This affects address formatting, result ranking, and may influence what results are returned. This does not restrict results to the specified region.
sessionToken optional
Type: AutocompleteSessionToken optional
A token which identifies an Autocomplete session for billing purposes. Generate a new session token via
AutocompleteSessionToken
.
The session begins when the user starts typing a query, and concludes when they select a place and call Place.fetchFields
. Each session can have multiple queries, followed by one fetchFields
call. The credentials used for each request within a session must belong to the same Google Cloud Console project. Once a session has concluded, the token is no longer valid; your app must generate a fresh token for each session. If the sessionToken
parameter is omitted, or if you reuse a session token, the session is charged as if no session token was provided (each request is billed separately).
When a session token is provided in the request to AutocompleteSuggestion.fetchAutocompleteSuggestions
, the same token will automatically be included in the first call to fetchFields on a Place
returned by calling PlacePrediction.toPlace
on one of the resulting AutocompleteSuggestion
s.
We recommend the following guidelines:
google.maps.places.AutocompleteSessionToken
class
Represents a session token used for tracking an autocomplete session.
Access by calling const {AutocompleteSessionToken} = await google.maps.importLibrary("places")
.
See Libraries in the Maps JavaScript API.
AutocompleteSessionToken
AutocompleteSessionToken()
Parameters: None
Creates a new instance of AutocompleteSessionToken
.
google.maps.places.StringRange
class
Identifies a substring within a given text.
Access by calling const {StringRange} = await google.maps.importLibrary("places")
.
See Libraries in the Maps JavaScript API.
endOffset
Type: number
Zero-based offset of the last Unicode character of the substring (exclusive).
startOffset
Type: number
Zero-based offset of the first Unicode character of the substring (inclusive).
FormattableText classgoogle.maps.places.FormattableText
class
Text representing a Place prediction. The text may be used as is or formatted.
Access by calling const {FormattableText} = await google.maps.importLibrary("places")
.
See Libraries in the Maps JavaScript API.
matches
Type: Array<StringRange>
A list of string ranges identifying where the input request matched in
FormattableText.text
. The ranges can be used to format specific parts of
text
. The substrings may not be exact matches of
AutocompleteRequest.input
if the matching was determined by criteria other than string matching (for example, spell corrections or transliterations). These values are Unicode character offsets of
FormattableText.text
. The ranges are guaranteed to be ordered in increasing offset values.
text
Type: string
Text that may be used as is or formatted with
FormattableText.matches
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-09 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4