Make your first request

This document walks you through making a basic request to the Places Insights API and understanding the response, which includes a count of matching places. A sample is provided for reference.

To use Place Insights, send an HTTP POST request to the computeInsights endpoint as follows:

https://areainsights.googleapis.com/v1:computeInsights

Refine your request by providing region and type parameters in the JSON body. This example shows a request to find the number of restaurants in San Francisco that are operational, moderately priced, and rated between 4 and 5 stars.

curl --location 'https://areainsights.googleapis.com/v1:computeInsights' \
--header 'X-Goog-Api-Key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{
   "insights":[
      "INSIGHT_COUNT"
   ],
   "filter":{
      "location_filter":{
         "region":{
            "place":"places/ChIJIQBpAG2ahYAR_6128GcTUEo"
         }
      },
      "type_filter":{
         "included_types":[
            "restaurant"
         ]
      },
      "operating_status":[
         "OPERATING_STATUS_OPERATIONAL"
      ],
      "price_levels":[
         "PRICE_LEVEL_INEXPENSIVE"
      ],
      "rating_filter":{
         "min_rating":4.0,
         "max_rating":5.0
      }
   }
}'

Compute insights response

The following response from the example request above shows the count of restaurants that match the criteria.

{
  "count": "846"
}

What's next