Generate invitation links using Trustpilot APIs

This feature is part of the Connect add-on module, which can be purchased in addition to the Premium and Advanced plans, and is included in the Enterprise plan.

You can use a Trustpilot API to generate invitation links that can be sent via your own emails or in other ways you communicate with your customers. This guide outlines how to generate unique invitation links using a Trustpilot API.

You may need help from a developer.

Find your API and Secret key

If your account has API access granted, you can create and manage your API keys by following the quick steps below or going directly here.

  1. In Trustpilot Business, go to Integrations > Developers > APIs.
  2. Under Create a new application, name your application and enter any domains you want to include. Click Create application.
  3. Find the application in Your applications. Click the dropdown to expand the application and find your API and Secret key.

Find your Business Unit ID (BUID)

Your Business Unit ID is a unique identifier specific to your domain. It’s static and will only change if your domain on Trustpilot changes. To find the BUID for your domain, you’ll need to use the Find a business unit endpoint. The required parameter here is the “name” of the business unit, ie. your website’s domain. As a quick example, if you wanted to look up the BUID of Trustpilot, you’d pass along the string “trustpilot.com”.

Try it yourself, just remember to replace the API key.

https://api.trustpilot.com/v1/business-units/find?apikey={{apikey}}&name=trustpilotdemo.com

Once you get the response back, you want the “id” field. This is your BUID for the domain you just searched.

Authentication with OAuth 2.0

In order to use any private API endpoint on Trustpilot, authentication is required in the form of an access token. Since generating invitation links is considered a private endpoint, the goal here will be to get an access token first, which you can reuse for multiple API calls while it’s valid. Once expired, you can refresh the token. To jump right into our authentication documentation for more guidance, take a look here.

For server-side integrations, we recommend using Grant Type: Password.

Generate a service review invitation link

Once you have your access token, you can use our Generate service review invitation link API endpoint. This API call JSON request requires the customer name, email, locale, and some sort of reference ID such as an order ID or invoice number. Here’s a full sample JSON request:

    {
        "referenceId": "inv00001",
        "name": "John Doe",
        "tags": [
          "tag1", 
          "Tag2"
        ],
        "locale": "en-US",
        "email": "john.doe@trustpilot.com", 
        "redirectUri": "http://trustpilot.com"
    }

This API call will return a unique invitation link, which you can send directly to your customers.

You’ll also notice optional tags and redirectUri fields in that request. Here’s an overview to help you get a better understanding:

Optional tags

These are extra pieces of specific data that you know about the customer or their purchase. By adding these before the review has been submitted, your reviews will be tagged with hyper-relevant data, allowing for more granular analytics and highly tailored review display.

Valid characters are a-z, A-Z, 0-9, underscore, dash, and period. Spaces are not allowed.

Redirect URI

A redirectUri allows you to redirect the customer to any webpage of your choosing once they submit their review. By omitting the redirectUri, reviewers will be brought to a Trustpilot "review submitted" page. If you'd like to bring them back to a custom page on your website, like your own "thank you" page or simply your homepage, you have full control over that.

Make sure to use a full URL including http/https (https://example.com would be valid, but example.com would not).

Related articles