Skip to content

Google Maps API: /textsearch

Text Search query (/textsearch endpoint) retrieves information about locations based on a given search string — such as “pizza in New York,” “shoe stores near Ottawa,” or even a specific address like “123 Main Street.” The service then returns a list of places that match the query, factoring in any location bias that may have been applied to refine the results.

The search response will provide a list of places. For additional details about any specific place in the list, you can send a Place Details request.

Request:
curl -L -X GET 'https://[api.domain.com]/textsearch/?query=restaurants%20in%20Sydney&radius=1000'

Return:
{
  "html_attributions": [],
  "results":
    [
      {
        "formatted_address": "Main St, Denver, CO 80238, USA",
        "geometry":
          {
            "location": { "lat": 39.782267, "lng": -104.8919341 },
            "viewport":
              {
                "northeast":
                  { "lat": 39.78361682989273, "lng": -104.8905842701073 },
                "southwest":
                  { "lat": 39.78091717010729, "lng": -104.8932839298927 },
              },
          },
        "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/geocode-71.png",
        "icon_background_color": "#7B9EB0",
        "icon_mask_base_uri": "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet",
        "name": "Main St",
        "place_id": "ChIJIS85_gd7bIcRJIGEPue1cJI",
        "reference": "ChIJIS85_gd7bIcRJIGEPue1cJI",
        "types": ["route"],
      },
    ],
  "status": "OK",
}

Leave a Reply

Your email address will not be published. Required fields are marked *