AI-generated Key Takeaways
- 
          Google's Text Search API helps find places using text queries, like "pizza in New York", handling ambiguous addresses and non-address searches. 
- 
          Requests require a textQueryand aFieldMaskspecifying desired data fields to manage cost and response size.
- 
          Optional parameters include location bias, language, and place type filtering for refining search results. 
- 
          Responses are in JSON format, containing an array of Placeobjects with details about each matching location.
- 
          Billing is based on requested data fields, and location biasing influences results but can be overridden by explicit query mentions. 
Introduction
Text Search (New) returns information about a set of places based on a string (for example, "pizza in New York" or "shoe stores near Ottawa" or "123 Main Street"). The service responds with a list of places matching the text string and any location bias that has been set.
In addition to required parameters, Text Search (New) supports refining queries using optional parameters for better results.
The APIs Explorer lets you make live requests so that you can get familiar with the API and the API options:
Text Search (New) requests
A Text Search (New) request is an HTTP POST request of the following form:
https://places.googleapis.com/v1/places:searchText
Pass all parameters in the JSON request body or in headers as part of the POST request. For example:
curl -X POST -d '{
  "textQuery" : "Spicy Vegetarian Food in Sydney, Australia"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress,places.priceLevel' \
'https://places.googleapis.com/v1/places:searchText'Text Search (New) responses
Text Search (New) returns a JSON object as a response. In the response:
- The placesarray contains all matching places.
- Each place in the array is represented by a
  Placeobject. ThePlaceobject contains detailed information about a single place.
- The FieldMask passed in the request specifies the
  list of fields returned in the Placeobject.
- The list of places returned is not guaranteed to be consistent for identical requests.
The complete JSON object is in the form:
{
  "places": [
    {
      object (Place)
    }
  ]
}Required parameters
- 
    FieldMaskSpecify the list of fields to return in the response by creating a response field mask. Pass the response field mask to the method by using the URL parameter $fieldsorfields, or by using the HTTP headerX-Goog-FieldMask. There is no default list of returned fields in the response. If you omit the field mask, the method returns an error.Field masking is a good design practice to ensure that you don't request unnecessary data, which helps to avoid unnecessary processing time and billing charges. Specify a comma-separated list of place data types to return. For example, to retrieve the display name and the address of the place. X-Goog-FieldMask: places.displayName,places.formattedAddress Use *to retrieve all fields.X-Goog-FieldMask: * Specify one or more of the following fields: - The following fields trigger the Text Search Essentials ID Only SKU: - places.attributions
 - places.id
 - places.name*
 - nextPageToken
 - places.movedPlace
 - places.movedPlaceId- * The - places.namefield contains the place resource name in the form:- places/PLACE_ID. Use- places.displayNamein the Pro SKU to access the text name of the place.
- The following fields trigger the Text Search Pro SKU: - places.accessibilityOptions
 - places.addressComponents
 - places.addressDescriptor*
 - places.adrFormatAddress
 - places.businessStatus
 - places.containingPlaces
 - places.displayName
 - places.formattedAddress
 - places.googleMapsLinks
 - places.googleMapsUri
 - places.iconBackgroundColor
 - places.iconMaskBaseUri
 - places.location
 - places.photos
 - places.plusCode
 - places.postalAddress
 - places.primaryType
 - places.primaryTypeDisplayName
 - places.pureServiceAreaBusiness
 - places.shortFormattedAddress
 - places.searchUri
 - places.subDestinations
 - places.types
 - places.utcOffsetMinutes
 - places.viewport
 * Address descriptors are generally available for customers in India and are experimental elsewhere.
 
- The following fields trigger the Text Search Enterprise SKU: - places.currentOpeningHours
 - places.currentSecondaryOpeningHours
 - places.internationalPhoneNumber
 - places.nationalPhoneNumber
 - places.priceLevel
 - places.priceRange
 - places.rating
 - places.regularOpeningHours
 - places.regularSecondaryOpeningHours
 - places.userRatingCount
 - places.websiteUri
- The following fields trigger the Text Search Enterprise + Atmosphere SKU: - places.allowsDogs
 - places.curbsidePickup
 - places.delivery
 - places.dineIn
 - places.editorialSummary
 - places.evChargeAmenitySummary
 - places.evChargeOptions
 - places.fuelOptions
 - places.generativeSummary
 - places.goodForChildren
 - places.goodForGroups
 - places.goodForWatchingSports
 - places.liveMusic
 - places.menuForChildren
 - places.neighborhoodSummary
 - places.parkingOptions
 - places.paymentOptions
 - places.outdoorSeating
 - places.reservable
 - places.restroom
 - places.reviews
 - places.reviewSummary
 - routingSummaries*
 - places.servesBeer
 - places.servesBreakfast
 - places.servesBrunch
 - places.servesCocktails
 - places.servesCoffee
 - places.servesDessert
 - places.servesDinner
 - places.servesLunch
 - places.servesVegetarianFood
 - places.servesWine
 - places.takeout
 * Text Search and Nearby Search only
 
- 
    textQueryThe text string on which to search. For example, "restaurant", "123 Main Street", or "Best place to visit in San Francisco". The API returns candidate matches based on this string and orders the results based on their perceived relevance. Text Search (New) is not intended for ambiguous queries, including the following: Query type Example Too many concepts or constraints, such as the names of multiple places, roads, or cities in a single query "Market Street San Francisco San Jose Airport" Postal address elements not represented on Google Maps "C/O John Smith 123 Main Street" 
 "P.O. Box 13 San Francisco"Names of businesses, chains, or categories combined with locations where these entities are not available "Tesco near Dallas, Texas" Ambiguous queries with multiple interpretations "Charger drop-off" Historical names no longer in use "Middlesex United Kingdom" Non-geospatial elements or intent "How many boats are in Ventura Harbor?" Unofficial or vanity names "The Jenga" 
 "The Helter Skelter"Latitude and longitude coordinates "37.422131,-122.084801" 
Optional parameters
- includedType- Biases the results to places matching the specified type defined by Table A. Only one type may be specified. For example: - "includedType":"bar"
- "includedType":"pharmacy"
 - Text Search (New) applies type filtering for certain queries, depending on applicability. For example, type filtering may not be applied to queries for specific addresses ("123 Main Street"), but type filtering is almost always applied to categorical queries ("stores nearby" or "shopping malls"). - To apply type filtering to all queries, set - strictTypeFilteringto- true.
- 
    includePureServiceAreaBusinessesIf set to true, the response includes businesses that visit or deliver to customers directly, but don't have a physical business location. If set tofalse, the API returns only businesses with a physical business location.
- languageCode- The language in which to return results. - See the list of supported languages. Google often updates the supported languages, so this list may not be exhaustive.
- 
        If languageCodeis not supplied, the API defaults toen. If you specify an invalid language code, the API returns anINVALID_ARGUMENTerror.
- The API does its best to provide a street address that is readable for both the user and locals. To achieve that goal, it returns street addresses in the local language, transliterated to a script readable by the user if necessary, observing the preferred language. All other addresses are returned in the preferred language. Address components are all returned in the same language, which is chosen from the first component.
- If a name is not available in the preferred language, the API uses the closest match.
- The preferred language has a small influence on the set of results that the API chooses to return, and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another.
 
- locationBias- Specifies an area to search. This location serves as a bias which means results around the specified location can be returned, including results outside the specified area. - You can specify - locationRestrictionor- locationBias, but not both. Think of- locationRestrictionas specifying the region which the results must be within, and- locationBiasas specifying the region that the results will likely be inside or near but can be outside of the area.- Specify the region as a rectangular Viewport or as a circle. - A circle is defined by center point and radius in meters. The radius must be between 0.0 and 50000.0, inclusive. The default radius is 0.0. For example: - "locationBias": { "circle": { "center": { "latitude": 37.7937, "longitude": -122.3965 }, "radius": 500.0 } } 
- A rectangle is a latitude-longitude viewport, represented as two diagonally opposite low and high points. The low point marks the southwest corner of the rectangle, and the high point represents the northeast corner of the rectangle. - A viewport is considered a closed region, meaning it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive: - If low=high, the viewport consists of that single point.
- If low.longitude>high.longitude, the longitude range is inverted (the viewport crosses the 180 degree longitude line).
- If low.longitude= -180 degrees andhigh.longitude= 180 degrees, the viewport includes all longitudes.
- If low.longitude= 180 degrees andhigh.longitude= -180 degrees, the longitude range is empty.
- If low.latitude>high.latitude, the latitude range is empty.
 - Both low and high must be populated, and the represented box cannot be empty. An empty viewport results in an error. - For example, this viewport fully encloses New York City: - "locationBias": { "rectangle": { "low": { "latitude": 40.477398, "longitude": -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } } } 
- If 
 
- locationRestriction- Specifies an area to search. Results outside the specified area are not returned. - Specify the region as a rectangular Viewport. For an example of defining the Viewport, see the description of - locationBias.- You can specify - locationRestrictionor- locationBias, but not both. Think of- locationRestrictionas specifying the region which the results must be within, and- locationBiasas specifying the region that the results will likely be inside or near but can be outside of the area.
- 
    maxResultCount (deprecated)Specifies the number of results (between 1 and 20) to display per page. For example, setting a maxResultCountvalue of 5 will return up to 5 results on the first page. If there are more results that can be returned from the query, the response includes anextPageTokenthat you can pass into a subsequent request to access the next page.
- evOptions- Specifies parameters for identifying available electric vehicle (EV) charging connectors and charging rates. - connectorTypes- Filters by the type of EV charging connector available at a place. A place that does not support any of the connector types will be filtered out. Supported EV charging connector types include combined (AC and DC) chargers, Tesla chargers, GB/T-compliant chargers (for EV fast charging in China), and wall outlet chargers. For more information, see the reference documentation. - To filter results for a specific supported connector, set connectorTypesto that value. For example, to find J1772 type 1 connectors, setconnectorTypestoEV_CONNECTOR_TYPE_J1772.
- To filter results for unsupported connectors, set connectorTypestoEV_CONNECTOR_TYPE_OTHER.
- To filter results for any connector type that is a wall outlet, set connectorTypestoEV_CONNECTOR_TYPE_UNSPECIFIED_WALL_OUTLET.
- To filter results for any connector type, either set connectorTypestoEV_CONNECTOR_TYPE_UNSPECIFIEDor don't set a value forconnectorTypes.
 
- To filter results for a specific supported connector, set 
- minimumChargingRateKw- Filters places by minimum EV charging rate in kilowatts (kW). Any places with charging a rate less than the minimum charging rate are filtered out. For example, to find EV chargers with charging rates that are at least 10 kW, you can set this parameter to "10." 
 
- minRating- Restricts results to only those whose average user rating is greater than or equal to this limit. Values must be between 0.0 and 5.0 (inclusive) in increments of 0.5. For example: 0, 0.5, 1.0, ... , 5.0 inclusive. Values are rounded up to the nearest 0.5. For example, a value of 0.6 eliminates all results with a rating less than 1.0. 
- openNow- If - true, return only those places that are open for business at the time the query is sent. If- false, return all businesses regardless of open status. Places that don't specify opening hours in the Google Places database are returned if you set this parameter to- false.
- pageSize- Specifies the number of results (between 1 and 20) to display per page. For example, setting a - pageSizevalue of 5 will return up to 5 results on the first page. If there are more results that can be returned from the query, the response includes a- nextPageTokenthat you can pass into a subsequent request to access the next page.
- pageToken- Specifies the - nextPageTokenfrom the response body of the previous page.
- 
    priceLevelsRestrict the search to places that are marked at certain price levels. The default is to select all price levels. Price levels can be expected for places of the following types: Places of non-supported types won't be included in the response if priceLevelsis specified.Specify an array of one or more of values defined by PriceLevel.For example: "priceLevels":["PRICE_LEVEL_INEXPENSIVE", "PRICE_LEVEL_MODERATE"] 
- rankPreference- Specifies how the results are ranked in the response based on the type of query: - For a categorical query such as "Restaurants in New York City",
      RELEVANCE(rank results by search relevance) is the default. You can setrankPreferencetoRELEVANCEorDISTANCE(rank results by distance).
- For a non-categorical query such as "Mountain View, CA", we recommend
      that you leave rankPreferenceunset.
 
- For a categorical query such as "Restaurants in New York City",
      
- regionCode- The region code used to format the response, specified as a two-character CLDR code value. This parameter can also have a bias effect on the search results. There is no default value. - If the country name of the - formattedAddressfield in the response matches the- regionCode, the country code is omitted from- formattedAddress. This parameter has no effect on- adrFormatAddress, which always includes the country name when available, or on- shortFormattedAddress, which never includes it.- Most CLDR codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland"). The parameter can affect results based on applicable law. 
- strictTypeFiltering- Used with the - includedTypeparameter. When set to- true, only places that match the specified types specified by- includedTypeare returned. When false, the default, the response can contain places that don't match the specified types.
Text Search (New) examples
Find a place by query string
The following example shows a Text Search (New) request for "Spicy Vegetarian Food in Sydney, Australia":
curl -X POST -d '{
  "textQuery" : "Spicy Vegetarian Food in Sydney, Australia"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress' \
'https://places.googleapis.com/v1/places:searchText'
Note that the X-Goog-FieldMask header specifies that the
response
contains the following data fields: places.displayName,places.formattedAddress.
The response is then in the form:
{ "places": [ { "formattedAddress": "367 Pitt St, Sydney NSW 2000, Australia", "displayName": { "text": "Mother Chu's Vegetarian Kitchen", "languageCode": "en" } }, { "formattedAddress": "175 First Ave, Five Dock NSW 2046, Australia", "displayName": { "text": "Veggo Sizzle - Vegan & Vegetarian Restaurant, Five Dock, Sydney", "languageCode": "en" } }, { "formattedAddress": "29 King St, Sydney NSW 2000, Australia", "displayName": { "text": "Peace Harmony", "languageCode": "en" } }, ... ] }
Add more data types to the field mask to return additional information.
For example, add places.types,places.websiteUri to include the
restaurant type and Web address in the
response:
curl -X POST -d '{
  "textQuery" : "Spicy Vegetarian Food in Sydney, Australia"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress,places.types,places.websiteUri' \
'https://places.googleapis.com/v1/places:searchText'The response is now in the form:
{ "places": [ { "types": [ "vegetarian_restaurant", "vegan_restaurant", "chinese_restaurant", "restaurant", "food", "point_of_interest", "establishment" ], "formattedAddress": "367 Pitt St, Sydney NSW 2000, Australia", "websiteUri": "http://www.motherchusvegetarian.com.au/", "displayName": { "text": "Mother Chu's Vegetarian Kitchen", "languageCode": "en" } }, { "types": [ "vegan_restaurant", "thai_restaurant", "vegetarian_restaurant", "indian_restaurant", "italian_restaurant", "american_restaurant", "restaurant", "food", "point_of_interest", "establishment" ], "formattedAddress": "175 First Ave, Five Dock NSW 2046, Australia", "websiteUri": "http://www.veggosizzle.com.au/", "displayName": { "text": "Veggo Sizzle - Vegan & Vegetarian Restaurant, Five Dock, Sydney", "languageCode": "en" } }, ... ] }
Filter places by price level
Use the priceLevel option to filter the results to restaurants
defined as inexpensive or moderately expensive:
curl -X POST -d '{
  "textQuery" : "Spicy Vegetarian Food in Sydney, Australia",
  "priceLevels":["PRICE_LEVEL_INEXPENSIVE", "PRICE_LEVEL_MODERATE"]
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress,places.priceLevel' \
'https://places.googleapis.com/v1/places:searchText'This example also uses the X-Goog-FieldMask header to add the
places.priceLevel data field to the
response
so it is in the form:
{ "places": [ { "formattedAddress": "367 Pitt St, Sydney NSW 2000, Australia", "priceLevel": "PRICE_LEVEL_MODERATE", "displayName": { "text": "Mother Chu's Vegetarian Kitchen", "languageCode": "en" } }, { "formattedAddress": "115 King St, Newtown NSW 2042, Australia", "priceLevel": "PRICE_LEVEL_MODERATE", "displayName": { "text": "Green Mushroom", "languageCode": "en" } }, ... ] }
Add additional options to refine your search, such as includedType,
minRating, rankPreference, openNow,
and other parameters described in
Optional parameters.
Restrict search to a specified area
Use locationRestriction or locationBias,
but not both, to restrict a search to an area. Think of locationRestriction
as specifying the region which the results must be within, and locationBias
as specifying the region that the results must be near but can be outside of
the area.
Restrict area using locationRestriction
Use the locationRestriction parameter to restrict query results to a
specified region. In your request body, specify the low and
high latitude and longitude values that define the region
boundary.
The following example shows a Text Search (New) request for "vegetarian food" in New York City. This request only returns the first 10 results for places that are open.
curl -X POST -d '{
  "textQuery" : "vegetarian food",
  "pageSize" : "10",
  "locationRestriction": {
    "rectangle": {
      "low": {
        "latitude": 40.477398,
        "longitude": -74.259087
      },
      "high": {
        "latitude": 40.91618,
        "longitude": -73.70018
      }
    }
  }
}' \
  -H 'Content-Type: application/json' \
  -H 'X-Goog-Api-Key: API_KEY' \
  -H 'X-Goog-FieldMask: places.id,places.formattedAddress' \
  'https://places.googleapis.com/v1/places:searchText'
Bias to an area using locationBias
The following example shows a Text Search (New) request for "vegetarian food" biased to a location within 500 meters of a point in downtown San Francisco. This request only returns the first 10 results for places that are open.
curl -X POST -d '{
  "textQuery" : "vegetarian food",
  "openNow": true,
  "pageSize": 10,
  "locationBias": {
    "circle": {
      "center": {"latitude": 37.7937, "longitude": -122.3965},
      "radius": 500.0
    }
  },
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress' \
'https://places.googleapis.com/v1/places:searchText'
Search for EV chargers with a minimum charging rate
Use minimumChargingRateKw and connectorTypes to
search for places with available chargers that are compatible with your EV.
The following example shows a request for Tesla and J1772 type 1 EV charging connectors with a minimum charging rate of 10 kW in Mountain View, CA. Only four results are returned.
curl -X POST -d '{
    "textQuery": "EV Charging Station Mountain View",
    "pageSize": 4,
    "evOptions": {
      "minimumChargingRateKw": 10,
      "connectorTypes": ["EV_CONNECTOR_TYPE_J1772","EV_CONNECTOR_TYPE_TESLA"]
    }
  }' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H "X-Goog-FieldMask: places.displayName,places.evChargeOptions" \
'https://places.googleapis.com/v1/places:searchText'
The request returns the following response:
{ "places": [ { "displayName": { "text": "EVgo Charging Station", "languageCode": "en" }, "evChargeOptions": { "connectorCount": 16, "connectorAggregation": [ { "type": "EV_CONNECTOR_TYPE_CHADEMO", "maxChargeRateKw": 100, "count": 8, "availableCount": 5, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" }, { "type": "EV_CONNECTOR_TYPE_CCS_COMBO_1", "maxChargeRateKw": 100, "count": 2, "availableCount": 2, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" }, { "type": "EV_CONNECTOR_TYPE_CCS_COMBO_1", "maxChargeRateKw": 350, "count": 6, "availableCount": 3, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" } ] } }, { "displayName": { "text": "EVgo Charging Station", "languageCode": "en" }, "evChargeOptions": { "connectorCount": 6, "connectorAggregation": [ { "type": "EV_CONNECTOR_TYPE_CCS_COMBO_1", "maxChargeRateKw": 100, "count": 4, "availableCount": 3, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" }, { "type": "EV_CONNECTOR_TYPE_CCS_COMBO_1", "maxChargeRateKw": 350, "count": 2, "availableCount": 0, "outOfServiceCount": 2, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" } ] } }, { "displayName": { "text": "EVgo Charging Station", "languageCode": "en" }, "evChargeOptions": { "connectorCount": 5, "connectorAggregation": [ { "type": "EV_CONNECTOR_TYPE_J1772", "maxChargeRateKw": 3.5999999046325684, "count": 1, "availableCount": 0, "outOfServiceCount": 1, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" }, { "type": "EV_CONNECTOR_TYPE_CHADEMO", "maxChargeRateKw": 50, "count": 2, "availableCount": 0, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" }, { "type": "EV_CONNECTOR_TYPE_CCS_COMBO_1", "maxChargeRateKw": 50, "count": 2, "availableCount": 0, "outOfServiceCount": 0, "availabilityLastUpdateTime": "2024-01-10T19:10:00Z" } ] } }, { "displayName": { "text": "Electric Vehicle Charging Station", "languageCode": "en" }, "evChargeOptions": { "connectorCount": 10, "connectorAggregation": [ { "type": "EV_CONNECTOR_TYPE_OTHER", "maxChargeRateKw": 210, "count": 10 } ] } } ] }
Search for service area businesses
Use the includePureServiceAreaBusinesses parameter to search for
businesses without a physical service address (for example, a mobile cleaning
service or a food truck).
The following example shows a request for plumbers in San Francisco:
curl -X POST -d '{
  "textQuery" : "plumber San Francisco",
  "includePureServiceAreaBusinesses": true
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H 'X-Goog-FieldMask: places.displayName,places.formattedAddress' \
'https://places.googleapis.com/v1/places:searchText'
In the response, businesses without a physical service address don't include
the formattedAddress field:
{ "places": [ { "formattedAddress": "3450 Sacramento St #204, San Francisco, CA 94118, USA", "displayName": { "text": "Advanced Plumbing & Drain", "languageCode": "en" } }, { "formattedAddress": "1455 Bancroft Ave, San Francisco, CA 94124, USA", "displayName": { "text": "Magic Plumbing Heating & Cooling", "languageCode": "en" } }, /.../ { "displayName": { "text": "Starboy Plumbing Inc.", "languageCode": "en" } }, { "formattedAddress": "78 Dorman Ave, San Francisco, CA 94124, USA", "displayName": { "text": "Cabrillo Plumbing, Heating & Air", "languageCode": "en" } }, { "formattedAddress": "540 Barneveld Ave # D, San Francisco, CA 94124, USA", "displayName": { "text": "Mr. Rooter Plumbing of San Francisco", "languageCode": "en" } }, /.../ { "displayName": { "text": "Pipeline Plumbing", "languageCode": "en" } }, { "formattedAddress": "350 Bay St #100-178, San Francisco, CA 94133, USA", "displayName": { "text": "One Source Plumbing and Rooter", "languageCode": "en" } }, /.../ ] }
Specify a number of results to return per page
Use the pageSize parameter to specify a number of results to
return per page. The nextPageToken parameter in the response body
provides a token that can be used in subsequent calls to access the next page of
results.
The following example shows a request for "pizza in New York" limited to 5 results per page:
 curl -X POST -d '{
  "textQuery": "pizza in New York",
  "pageSize": 5
  }' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H "X-Goog-FieldMask: places.id,nextPageToken" \
'https://places.googleapis.com/v1/places:searchText'
{ "places": [ { "id": "ChIJifIePKtZwokRVZ-UdRGkZzs" }, { "id": "ChIJPxPd_P1YwokRfzLhSiACEoU" }, { "id": "ChIJrXXKn5NZwokR78g0ipCnY60" }, { "id": "ChIJ6ySICVZYwokR9rIK8HjXhzE" }, { "id": "ChIJ6xvs94VZwokRnT1D2lX2OTw" } ], "nextPageToken": "AeCrKXsZWzNVbPzO-MRWPu52jWO_Xx8aKwOQ69_Je3DxRpfdjClq8Ekwh3UcF2h2Jn75kL6PtWLGV4ecQri-GEUKN_OFpJkdVc-JL4Q" }
To access the next page of results, use pageToken to pass in the
nextPageToken in the request body:
 curl -X POST -d '{
  "textQuery": "pizza in New York",
  "pageSize": 5,
  "pageToken": "AeCrKXsZWzNVbPzO-MRWPu52jWO_Xx8aKwOQ69_Je3DxRpfdjClq8Ekwh3UcF2h2Jn75kL6PtWLGV4ecQri-GEUKN_OFpJkdVc-JL4Q"
  }' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \
-H "X-Goog-FieldMask: places.id,nextPageToken" \
'https://places.googleapis.com/v1/places:searchText'
{ "places": [ { "id": "ChIJL-LN1N1ZwokR8K2jACu6Ydw" }, { "id": "ChIJjaD94kFZwokR-20CXqlpy_4" }, { "id": "ChIJ6ffdpJNZwokRmcafdROM5q0" }, { "id": "ChIJ8Q2WSpJZwokRQz-bYYgEskM" }, { "id": "ChIJ8164qwFZwokRhplkmhvq1uE" } ], "nextPageToken": "AeCrKXvPd6uUy-oj96W2OaqEe2pUD8QTxOM8-sKfUcFsC9t2Wey5qivrKGoGSxcZnyc7RPmaFfAktslrKbUh31ZDTkL0upRmaxA7c_c" }
Get address descriptors
Address descriptors provide relational information about a place's location, including nearby landmarks and containing areas.
The following example shows a Text Search (New) request for places near a
mall in San Jose. In this example, you include addressDescriptors in the field
mask:
curl -X POST -d '{
  "textQuery": "clothes",
  "maxResultCount": 5,
  "locationBias": {
    "circle": {
      "center": {
        "latitude": 37.321328,
        "longitude": -121.946275
      }
    }
  },
  "rankPreference":"RANK_PREFERENCE_UNSPECIFIED"
}' \
-H 'Content-Type: application/json' \
-H "X-Goog-Api-Key: API_KEY" \
-H "X-Goog-FieldMask: places.displayName,places.addressDescriptor" \
https://places.googleapis.com/v1/places:searchText
The response includes the place specified in the request, a list of nearby landmarks and their distance from the place, and a list of areas and their containment relationship to the place:
{ "places": [ { "displayName": { "text": "Urban Outfitters", "languageCode": "en" }, "addressDescriptor": { "landmarks": [ { "name": "places/ChIJVVVVUB7Lj4ARXyb4HFVDV8s", "placeId": "ChIJVVVVUB7Lj4ARXyb4HFVDV8s", "displayName": { "text": "Westfield Valley Fair", "languageCode": "en" }, "types": [ "clothing_store", "department_store", "establishment", "food", "movie_theater", "point_of_interest", "restaurant", "shoe_store", "shopping_mall", "store" ], "spatialRelationship": "WITHIN", "straightLineDistanceMeters": 133.72855 }, { "name": "places/ChIJ62_oCR7Lj4AR_MGWkSPotD4", "placeId": "ChIJ62_oCR7Lj4AR_MGWkSPotD4", "displayName": { "text": "Nordstrom", "languageCode": "en" }, "types": [ "clothing_store", "department_store", "establishment", "point_of_interest", "shoe_store", "store" ], "straightLineDistanceMeters": 250.99161 }, { "name": "places/ChIJ8WvuSB7Lj4ARFyHppkxDRQ4", "placeId": "ChIJ8WvuSB7Lj4ARFyHppkxDRQ4", "displayName": { "text": "Macy's", "languageCode": "en" }, "types": [ "clothing_store", "department_store", "establishment", "point_of_interest", "store" ], "straightLineDistanceMeters": 116.24196 }, { "name": "places/ChIJ9d3plB_Lj4ARzyaU5bn80WY", "placeId": "ChIJ9d3plB_Lj4ARzyaU5bn80WY", "displayName": { "text": "Bank of America Financial Center", "languageCode": "en" }, "types": [ "bank", "establishment", "finance", "point_of_interest" ], "straightLineDistanceMeters": 121.61515 }, { "name": "places/ChIJaXCjxvXLj4ARCPmQpvJ52Lw", "placeId": "ChIJaXCjxvXLj4ARCPmQpvJ52Lw", "displayName": { "text": "Bloomingdale's", "languageCode": "en" }, "types": [ "clothing_store", "department_store", "establishment", "furniture_store", "home_goods_store", "point_of_interest", "shoe_store", "store" ], "straightLineDistanceMeters": 81.32396 } ], "areas": [ { "name": "places/ChIJb3F-EB7Lj4ARnHApQ_Hu1gI", "placeId": "ChIJb3F-EB7Lj4ARnHApQ_Hu1gI", "displayName": { "text": "Westfield Valley Fair", "languageCode": "en" }, "containment": "WITHIN" }, { "name": "places/ChIJXYuykB_Lj4AR1Ot8nU5q26Q", "placeId": "ChIJXYuykB_Lj4AR1Ot8nU5q26Q", "displayName": { "text": "Valley Fair", "languageCode": "en" }, "containment": "WITHIN" }, { "name": "places/ChIJtYoUX2DLj4ARKoKOb1G0CpM", "placeId": "ChIJtYoUX2DLj4ARKoKOb1G0CpM", "displayName": { "text": "Central San Jose", "languageCode": "en" }, "containment": "WITHIN" } ] } }, /.../ ] }
Try it!
The APIs Explorer lets you make sample requests so that you can get familiar with the API and the API options.
- Select the API icon api on the right side of the page. 
- Optionally edit the request parameters. 
- Select the Execute button. In the dialog, choose the account that you want to use to make the request. 
- In the APIs Explorer panel, select the fullscreen icon fullscreen to expand the APIs Explorer window.