Go To Top

How to get product reviews from the Trustpilot API

A guide to retrieving product reviews from Trustpilot API e.g. for displaying in a widget on your website.

trustbox_product_reviews.jpg

Introduction

This guide will walk you through the different API endpoints you can use to retrieve product reviews from the Trustpilot API.

While the API examples provided are valid, they contain “dummy data” and {{placeholders}}. Remember to fill in the correct values for the placeholders.

We recommend that you follow and read the documentation (links) in this guide to get a better  understanding of the API endpoints and how they work.

Before you start

Do you even need this?

We love when people use our APIs to build new things, but remember that we also provide pre-built and easy to set up TrustBoxes that you can embed on your website without writing any code. This guide is meant for companies that, for one reason or another, can’t use our pre-built TrustBoxes and need to build their own.

SEO benefits

With product reviews you can get SEO benefits on your website. You can read more about how this works in this article for developers.

Integration guidelines

Before you start you should read our integration guidelines. The guidelines will tell you how to implement content and display the Trustpilot logo and images correctly.

Authentication

To use the API endpoints described in this guide you will need an API key, and to authenticate. Once you’ve authenticated you should have an access_token that you can use to authorize the different API calls.

How to get product reviews

To get a list of product reviews we need the “Get product reviews” endpoint in the Product Reviews API.
This endpoint has the following format:
https://api.trustpilot.com/v1/product-reviews/business-units/{{businessUnitId}}/reviews

And requires at least a “productUrl” or “sku” parameter, to define which product to get reviews for.

For our example, let’s say we want to retrieve a list of all reviews for the product with sku “abc123”, then it could look like this:
https://api.trustpilot.com/v1/product-reviews/business-units/{{businessUnitId}}/reviews?sku=abc123

Here’s the URL for doing just that with the Trustpilot.com business unit:

https://api.trustpilot.com/v1/product-reviews/business-units/46d6a890000064000500e0c3/reviews?sku=abc123

Result:

{
 
"productReviews": [
   {
     
"createdAt": "2013-09-07T13:37:00",
     
"stars": 4,
     
"content": "This product was nice, but slightly too soft.",
     
"consumer": {
       
"id": "507f191e810c19729de860ea",
       
"displayName": "John Doe"
     },
     
"language": "en"
   }
 ],
 
"links": [ … ]

}

As you can see in the result, the “productReviews” key is an array, which contains the product reviews. This list will by default contain up to 20 reviews. If you use the “perPage” parameter you can change this to anywhere from 1 to 100. If you want more than that, you will need to call the endpoint several times, using the “page” parameter.
For displaying the reviews on your website, you could use the “stars”, “content” and “consumer.displayName” properties from the reviews in the “productReviews” list.