---
openapi: 3.0.0
info:
  title: Trustpilot Reviews API
  description: Retrieve Trustpilot business reviews with ratings, review text, reviewer
    profiles, business replies, the business profile summary, and pagination. Filter
    by star rating, date window, language, and keyword.
  version: 1.0.0
servers:
- url: https://www.searchapi.io/api/v1
paths:
  "/search":
    get:
      summary: Trustpilot Reviews
      security:
      - ApiKeyAuth: []
      - ApiKeyQuery: []
      parameters:
      - name: engine
        in: query
        required: true
        description: Set to trustpilot_reviews.
        schema:
          type: string
          enum:
          - trustpilot_reviews
      - name: domain
        in: query
        required: true
        description: Business website domain to retrieve reviews for, for example
          amazon.com or www.booking.com.
        schema:
          type: string
          maxLength: 253
      - name: page
        in: query
        required: false
        description: Page number of reviews to return. Trustpilot shows at most 10
          pages per search.
        schema:
          type: integer
          minimum: 1
          maximum: 10
          default: 1
      - name: sort_by
        in: query
        required: false
        description: Order of the returned reviews.
        schema:
          type: string
          enum:
          - recency
          - relevance
          default: "recency"
      - name: rating
        in: query
        required: false
        description: Filter by star rating. Pass one or more values from 1 to 5, separated
          by commas.
        schema:
          type: string
          pattern: '^[1-5](,[1-5]){0,4}$'
      - name: date
        in: query
        required: false
        description: Filter reviews by how recently they were posted.
        schema:
          type: string
          enum:
          - last30days
          - last3months
          - last6months
          - last12months
      - name: languages
        in: query
        required: false
        description: Filter reviews by language. Pass a language code such as de or zh-tw, or
          'all' to return reviews in every language.
        schema:
          type: string
          pattern: '^[a-zA-Z]{2,3}(?:-[a-zA-Z0-9]{2,8})?$'
          default: "en"
      - name: q
        in: query
        required: false
        description: Keyword to search for within the reviews.
        schema:
          type: string
          maxLength: 200
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/SearchResponse"
        '400':
          description: Validation Error. There is an issue with query parameters, such
            as missing required parameters or invalid values.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/ErrorResponse"
        '401':
          description: Authentication Error. The API key is missing or invalid.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/ErrorResponse"
        '429':
          description: Rate Limit Exceeded. The number of allowed requests has been
            exceeded. Consider upgrading your plan or waiting for the limit to reset.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/ErrorResponse"
        '500':
          description: Server Error. Internal server error.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/ErrorResponse"
        '503':
          description: Timeout. We could not retrieve results in 90 seconds.
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/ErrorResponse"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use Bearer authentication. Format: "Bearer YOUR_API_KEY"'
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Pass API key as query parameter
  schemas:
    SearchResponse:
      type: object
      required: [search_metadata, search_parameters]
      properties:
        search_metadata:
          "$ref": "#/components/schemas/SearchMetadata"
        search_parameters:
          "$ref": "#/components/schemas/SearchParameters"
        search_information:
          type: object
          required: [total_results]
          properties:
            total_results:
              type: integer
              description: Number of reviews that match the request.
            has_active_filters:
              type: boolean
              description: Whether any filter is applied to the request.
        place_result:
          type: object
          required: [business_unit_id, name, domain]
          properties:
            business_unit_id:
              type: string
              description: Unique identifier of the business on Trustpilot.
            name:
              type: string
              description: Display name of the business.
            domain:
              type: string
              description: Business domain the Trustpilot profile is registered under.
            link:
              type: string
              description: URL of the Trustpilot profile.
            website:
              type: string
              description: Website of the business.
            rating:
              type: number
              description: Star rating of the business, from 1 to 5.
            trust_score:
              type: number
              description: TrustScore of the business, from 1 to 5.
            reviews_count:
              type: integer
              description: Total number of reviews on the profile.
            reviews_last_12_months:
              type: integer
              description: Number of reviews posted in the last 12 months.
            reviews_histogram:
              type: object
              description: Number of reviews on the profile for each star rating.
              properties:
                "1":
                  type: integer
                  description: Number of 1-star reviews.
                "2":
                  type: integer
                  description: Number of 2-star reviews.
                "3":
                  type: integer
                  description: Number of 3-star reviews.
                "4":
                  type: integer
                  description: Number of 4-star reviews.
                "5":
                  type: integer
                  description: Number of 5-star reviews.
            categories:
              type: array
              description: Categories the business is listed under.
              items:
                type: object
                required: [name, is_primary]
                properties:
                  category_id:
                    type: string
                    description: Identifier of the category.
                  name:
                    type: string
                    description: Name of the category.
                  is_primary:
                    type: boolean
                    description: Whether this is the primary category of the business.
            reply_behavior:
              type: object
              description: How the business replies to negative reviews.
              properties:
                reply_rate:
                  type: number
                  description: Percentage of negative reviews the business replied to.
                average_days_to_reply:
                  type: number
                  description: Average number of days the business takes to reply.
                negative_reviews_count:
                  type: integer
                  description: Number of negative reviews the reply rate is based on.
                negative_reviews_replied_count:
                  type: integer
                  description: Number of those negative reviews the business replied to.
                last_negative_reply_date:
                  type: string
                  description: Date and time of the most recent reply to a negative review.
            country:
              type: string
              description: Country code of the business.
            logo:
              type: string
              description: Profile image of the business.
            is_claimed:
              type: boolean
              description: Whether the business has claimed its profile.
            is_closed:
              type: boolean
              description: Whether the business is permanently closed.
            is_temporarily_closed:
              type: boolean
              description: Whether the business is temporarily closed.
        ai_summary:
          type: object
          description: Trustpilot's AI-generated summary of recent reviews.
          properties:
            summary:
              type: string
              description: Summary of what reviewers say overall.
            topics:
              type: array
              description: Summaries of what reviewers say about specific topics.
              items:
                type: object
                required: [topic, summary]
                properties:
                  topic:
                    type: string
                    description: Identifier of the topic.
                  name:
                    type: string
                    description: Display name of the topic.
                  summary:
                    type: string
                    description: Summary of what reviewers say about the topic.
        review_languages:
          type: array
          description: Languages the business has reviews in, with the number of reviews in each.
          items:
            type: object
            required: [language, reviews_count]
            properties:
              language:
                type: string
                description: Language code, usable as the languages parameter.
              reviews_count:
                type: integer
                description: Number of reviews in the language.
        pagination:
          type: object
          required: [current_page, per_page, total_pages]
          properties:
            current_page:
              type: integer
              description: Page number of the returned reviews.
            per_page:
              type: integer
              description: Number of reviews per page.
            total_pages:
              type: integer
              description: Number of pages that can be requested, up to 10.
            total_results:
              type: integer
              description: Total number of reviews that match the request.
            next_page:
              type: integer
              description: Page number to request next.
        reviews:
          type: array
          items:
            type: object
            required: [review_id, link, rating, title, likes]
            properties:
              review_id:
                type: string
                description: Unique identifier of the review.
              link:
                type: string
                description: URL of the review on Trustpilot.
              rating:
                type: integer
                description: Star rating the reviewer gave, from 1 to 5.
              title:
                type: string
                description: Title of the review.
              text:
                type: string
                description: Body of the review.
              likes:
                type: integer
                description: Number of users who found the review useful.
              language:
                type: string
                description: Language code of the review.
              source:
                type: string
                description: Channel the review was collected through, such as an organic review or an invitation link.
              published_date:
                type: string
                description: Date and time the review was published.
              experienced_date:
                type: string
                description: Date the reviewer reports experiencing the service.
              updated_date:
                type: string
                description: Date and time the review was last edited.
              is_verified:
                type: boolean
                description: Whether the review is verified.
              verification_level:
                type: string
                description: Verification level Trustpilot assigns to the review.
              verification_source:
                type: string
                description: How Trustpilot verified or collected the review.
              author:
                type: object
                required: [name, consumer_id, link]
                properties:
                  name:
                    type: string
                    description: Display name of the reviewer.
                  consumer_id:
                    type: string
                    description: Unique identifier of the reviewer.
                  link:
                    type: string
                    description: URL of the reviewer profile on Trustpilot.
                  is_verified:
                    type: boolean
                    description: Whether Trustpilot has verified the reviewer.
                  avatar:
                    type: string
                    description: Profile image of the reviewer.
                  country:
                    type: string
                    description: Country code of the reviewer.
                  reviews_count:
                    type: integer
                    description: Total number of reviews the reviewer has written.
                  business_reviews_count:
                    type: integer
                    description: Number of reviews the reviewer has written about this business.
              reply:
                type: object
                properties:
                  text:
                    type: string
                    description: Body of the business reply.
                  published_date:
                    type: string
                    description: Date and time the business reply was published.
                  updated_date:
                    type: string
                    description: Date and time the business reply was last edited.
        error:
          type: string
          description: Why there are no reviews to return.
    SearchMetadata:
      type: object
      required: [status, created_at]
      properties:
        id:
          type: string
          description: Unique identifier for the search request
        status:
          type: string
          description: Status of the search request
        created_at:
          type: string
          format: date-time
          description: Timestamp when the search was created
        request_time_taken:
          type: number
          description: Time taken to make the request in seconds
        parsing_time_taken:
          type: number
          description: Time taken to parse the results in seconds
        total_time_taken:
          type: number
          description: Total time taken for the search in seconds
        request_url:
          type: string
          description: Trustpilot URL for this search
        html_url:
          type: string
          description: URL to view HTML results
        json_url:
          type: string
          description: URL to view JSON results
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
        domain:
          type: string
        page:
          type: integer
        sort_by:
          type: string
        rating:
          type: string
        date:
          type: string
        languages:
          type: string
        q:
          type: string
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
