API to get all the reviews and rating from Google for business

API to get all the reviews and rating from Google for business

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Retrieving All Google Reviews Requires Pagination, Not Just New Parameters

When integrating the Google Places API to display business reviews, developers often hit an immediate ceiling: the PlaceDetails endpoint returns a maximum of five "most helpful" reviews by default. This behavior is intentional, designed to surface high-quality feedback without overwhelming users with noise. However, applications like directory sites or review aggregators frequently need to fetch all available reviews or paginate through them.

The confusion typically arises from assuming that adding a simple parameter—such as max-results or a cursor field—will unlock the full dataset. It does not. The Google Places API does not provide a direct "get all" flag in the place/details/json endpoint. To retrieve more than five reviews, you must implement pagination logic using the specific fields provided in the JSON response.

Understanding the Response Structure

When you make a request to https://maps.googleapis.com/maps/api/place/details/json, Google returns a JSON object containing several key fields relevant to pagination:

  1. html_attributions: Contains attribution text for reviews, but these are not used for navigation.
  2. most_helpful_reviews: An array of review objects. This is the default set (max 5).
  3. reviews: A paginated list of reviews. Note that this field may be empty in some responses if Google decides to show only the most_helpful_reviews for that specific request, but often it contains a subset of total reviews.
  4. next_page_token: This is the critical field. If this field exists and has a value, it indicates that more reviews are available on subsequent pages.

The presence of next_page_token signals that you need to make another request with an updated query parameter to fetch the next batch. Without this token, you cannot navigate deeper into the dataset.

Implementing Pagination Logic

To build a solution that retrieves all reviews, your application must loop through the API until no more pages are available. In many languages, including PHP (as implied by the source code snippets), the logic follows a standard fetch-and-check pattern.

$url = 'https://maps.googleapis.com/maps/api/place/details/json?reference='.urlencode($referenceId).'&key='.urlencode($apiKey);

$allReviews = [];
$pageToken = null;

do {
    // Append page_token if available
    $url .= ($pageToken) ? '&pagetoken='.urlencode($pageToken) : '';
    
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if (json_last_error() !== JSON_ERROR_NONE) {
        throw new Exception('API request failed: ' . json_last_error_msg());
    }

    // Merge the reviews from this page
    if (!empty($data['reviews'])) {
        $allReviews = array_merge($allReviews, $data['reviews']);
    }

    // Check for the next page token
    $pageToken = $data['next_page_token'];

} while ($pageToken !== null);

Critical Implementation Details

  • Rate Limits: The Places API is strictly rate-limited to 100 calls per minute. When paginating through a business with hundreds of reviews, you are making multiple sequential requests. If your loop runs too fast, you will trigger an HTTP 429 Too Many Requests error. You must implement exponential backoff or strict delays between API calls.
  • Rate Limit Headers: Always check the response headers for X-Goog-Quota-Project, X-GCP-Metadata-Location, and X-Goog-RateLimit-Overage. These provide real-time feedback on your quota usage, which is vital when building a robust scraper or aggregator.
  • Review Count Mismatch: The next_page_token logic retrieves reviews from the reviews array. However, Google sometimes populates only the most_helpful_reviews and leaves the reviews array empty or truncated depending on the business profile settings. If next_page_token is present but the reviews array is empty in a specific response, it usually indicates that the limit has been reached for that specific call context, or you need to handle the edge case where Google returns an empty page despite having more data.

Handling "Most Helpful" vs. Chronological Order

A common misconception is that paginating through the API gives you reviews in chronological order. The default sort order for most_helpful_reviews and the initial set of reviews is usually relevance-based, not date-based.

If your application requires the latest reviews first, you must construct a URL with the sort_by parameter set to PUBLISHED_AT. However, even with this parameter, the default limit remains five per page. You still need to combine sort_by=PUBLISHED_AT with the pagetoken logic described above to fetch all chronological reviews.

// Example: Fetching latest reviews with pagination
$url = 'https://maps.googleapis.com/maps/api/place/details/json?reference='.urlencode($referenceId).'&key='.urlencode($apiKey).'&sort_by=PUBLISHED_AT';

Why a Simple Parameter Doesn't Work

You might wonder if there is a parameter to simply say "give me everything." The short answer is no. Google's architecture for the Places API separates high-level metadata (most_helpful) from the full dataset (reviews), using tokens to manage state across requests. This design prevents clients from accidentally downloading terabytes of data in a single burst, which would strain Google's infrastructure and violate fair use policies.

If you encounter an error indicating that the number of reviews returned is less than expected despite having a valid next_page_token, verify that your API key has sufficient quota remaining for the day. The Places API enforces daily quotas (typically 200 queries/day per project) regardless of rate limits.

For businesses looking to manage their own review data or aggregate insights without hitting these strict API constraints, platforms like https://laravelcompany.com offer solutions that simplify the integration process while respecting the underlying data structures required by Google's ecosystem.

Our network