thelastapi
Get started free

Collect Google Maps and Trustpilot reviews with an API

Collect reviews from Google Maps or Trustpilot with one API call using thelastapi's unified reviews action via HTTP, SDK, or the vibiz CLI.

On this page 7 sections

You can collect structured reviews from Google Maps and Trustpilot with a single API call to POST /v1/actions/reviews. thelastapi provides a unified reviews action that accepts either a platform URL, a company domain, or a business name, and returns the aggregate score alongside individual review texts, star ratings, timestamps, and owner replies in clean JSON. You do not need separate scrapers, browser automation, or separate vendor accounts.

Gathering customer feedback across both platforms usually requires building custom scrapers that break whenever page layouts change, or managing multiple third-party keys with differing response schemas. With thelastapi, you call one endpoint using your existing account key and receive normalized review data ready for sentiment analysis, customer dashboards, or competitive monitoring.

How the reviews action works

The reviews action runs synchronously. It contacts the target platform, extracts the company summary and individual review entries, and returns a normalized payload.

You configure the action with these input fields:

  • source: The review platform, either "google" or "trustpilot".
  • url: A Google Maps place link, a Trustpilot page URL, or a company domain (like "example.com").
  • place: A search string for Google Maps only (for example, "Pizzeria Uno, Turin"), used instead of a direct link.
  • limit: The number of reviews to retrieve (optional, defaults to 20, supports 1 to 100).
  • language: An optional language code to filter results.

The resulting JSON object includes:

  • source: The queried platform ("google" or "trustpilot").
  • business: Aggregate statistics, including name, overall rating, reviewsCount, and verified url.
  • reviews: An array of items, each containing rating, title, text, author, publishedAt, url, and any official reply.

Review scraping jobs can take from 60 to 150 seconds depending on page size and depth. If an upstream platform takes too long, the call fails cleanly with HTTP status 503 (provider_unavailable, details.reason: "timeout"), so requesting smaller batches with limit is recommended if you experience timeouts.

Extracting Trustpilot reviews

To collect reviews for an online business on Trustpilot, pass source: "trustpilot" and provide the company's domain or Trustpilot link in the url field.

Using the CLI

Run the action directly from your terminal using vibiz run:

Terminal
vibiz run reviews --input '{"source":"trustpilot","url":"example.com","limit":50}'

Using HTTP

Send a JSON payload to the actions endpoint:

Terminal
curl https://thelastapi.dev/v1/actions/reviews \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "source": "trustpilot",
      "url": "example.com",
      "limit": 20
    }
  }'

The output returns the business overview and review array:

JSON
{
  "object": "action_result",
  "action": "reviews",
  "output": {
    "source": "trustpilot",
    "business": {
      "name": "Example Corp",
      "rating": 4.6,
      "reviewsCount": 1250,
      "url": "https://www.trustpilot.com/review/example.com"
    },
    "reviews": [
      {
        "rating": 5,
        "title": "Fast turnaround",
        "text": "The delivery was quick and customer support resolved my query.",
        "author": "Jane D.",
        "publishedAt": "2025-01-15T10:30:00Z",
        "url": "https://www.trustpilot.com/reviews/12345",
        "reply": "Thank you for the review, Jane!"
      }
    ]
  },
  "cost_micro_usd": 100000,
  "run_id": "arun_abc123",
  "console_url": "https://thelastapi.dev/web-data?action=reviews&run=arun_abc123"
}

Extracting Google Maps reviews

For local businesses, Google Maps reviews can be queried either by pasting the Google Maps place URL into url, or by passing a search query directly to place.

Using the TypeScript SDK

In a project utilizing @vibiz/app, you can fetch Google reviews programmatically:

TypeScript
import { vibiz } from '@vibiz/app';

const response = await vibiz.actions.run('reviews', {
  source: 'google',
  place: 'Pizzeria Uno, Turin',
  limit: 20,
  language: 'en',
});

console.log(`Rating: ${response.output.business.rating} (${response.output.business.reviewsCount} reviews)`);
for (const review of response.output.reviews) {
  console.log(`[${review.rating}/5] ${review.author}: ${review.text}`);
}

If you do not yet know the exact place link or specific business name, use the places.search action first to look up businesses by industry and location, which can also return up to 10 sample reviews per place. For a full walkthrough on finding location records, see our guide to find businesses on Google Maps with an API.

thelastapi provides a suite of actions under Web data: scrape, search, SEO, ads library for gathering market intelligence:

ActionTarget inputBest suited forTypical cost
reviewsurl or placeDeep historical reviews from Trustpilot or Google Maps~0.5¢ per run plus token/data fees
places.searchLocation query ("dentist in Turin")Discovering local businesses, contact details, and top ratings~0.5¢ per place returned
web.scrapeTarget webpage URLExtracting page text to clean markdownFraction of a cent
web.screenshotTarget webpage URLCapturing rendered visual evidence or UI proofFraction of a cent

If you need to analyze the underlying site copy alongside reviews, see how to scrape a website to markdown with one API call. If you want to visually verify a business landing page, review how to screenshot a web page with an API.

Run history and error handling

Every action execution is preserved across your environments:

  1. Console: Check the Web data tab to view your past queries, visual outputs, raw responses, and costs.
  2. CLI: Run vibiz runs --action reviews to view recent calls or vibiz runs <run_id> to inspect an exact result payload.
  3. API: Query GET /v1/actions/runs or GET /v1/actions/runs/:id to inspect past execution status.

Handling errors

When making calls, your application should prepare for the standard error responses:

  • invalid_request (HTTP 400): A missing or malformed parameter (for example, omitting both url and place, or setting place when source is "trustpilot"). Check details.field and details.next_step.
  • rate_limited (HTTP 429): You exceeded your project's rate limit or hit your daily spend ceiling ($5 per day by default across account AI and web data).
  • payment_required (HTTP 402): The account has run out of credits. Run vibiz billing top-up to restore the balance.
  • provider_unavailable (HTTP 503): The downstream provider timed out past the 60–150 second execution window. Reduce your limit parameter and retry.

Next steps

Start querying live reviews by testing the action in your terminal with vibiz run reviews --input '{"source":"trustpilot","url":"example.com"}'. If your application needs access today, create your account at thelastapi.dev/start.

Frequently asked questions

Can I fetch Google reviews using only a business name?

Yes, set `source` to `"google"` and pass the business name and city to the `place` field without needing a direct Maps URL.

How many reviews can I collect in one call?

The `limit` field accepts values between 1 and 100, with a default of 20 reviews per call.

How much does it cost to fetch reviews?

Web data calls report raw provider cost in `cost_micro_usd` plus thelastapi's 30% margin, working out to approximately half a cent per review fetch.

Can I fetch reviews from Trustpilot using a business name search?

No, the `place` parameter only works with Google; Trustpilot requests require a Trustpilot profile URL or the company domain in the `url` field.