openapi: 3.0.0
info:
  title: Tripadvisor Reviews API
  description: |
    Retrieve paginated reviews for any Tripadvisor place — hotels, restaurants, attractions, attraction products, and geos.

    The API returns review text, ratings, photos, author details, management responses, and pagination metadata.

    **Cross-linking**: Use the [Tripadvisor Search API](/docs/tripadvisor-api) to search for places and obtain a `place_id`. Then pass that `place_id` to this API to fetch the place's reviews.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Tripadvisor Reviews Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Search engine identifier
          schema:
            type: string
            enum: ["tripadvisor_reviews"]
            default: "tripadvisor_reviews"
        - name: place_id
          in: query
          required: true
          description: Numeric Tripadvisor place identifier (hotel, restaurant, attraction, attraction product, or geo). Obtainable from the Tripadvisor Search API.
          schema:
            type: string
            pattern: '^\d+$'
        - name: tripadvisor_domain
          in: query
          required: false
          description: Tripadvisor domain to query
          schema:
            type: string
            enum: ["tripadvisor.com", "ar.tripadvisor.com", "tripadvisor.com.ar", "tripadvisor.com.au", "tripadvisor.at", "tripadvisor.be", "fr.tripadvisor.be", "tripadvisor.com.br", "tripadvisor.ca", "fr.tripadvisor.ca", "tripadvisor.cl", "cn.tripadvisor.com", "tripadvisor.co", "tripadvisor.dk", "tripadvisor.com.eg", "tripadvisor.fr", "tripadvisor.de", "tripadvisor.com.gr", "tripadvisor.com.hk", "en.tripadvisor.com.hk", "tripadvisor.in", "tripadvisor.co.id", "tripadvisor.ie", "tripadvisor.co.il", "tripadvisor.it", "tripadvisor.jp", "tripadvisor.com.my", "tripadvisor.com.mx", "tripadvisor.nl", "tripadvisor.co.nz", "no.tripadvisor.com", "tripadvisor.com.pe", "tripadvisor.com.ph", "tripadvisor.pt", "tripadvisor.ru", "tripadvisor.com.sg", "tripadvisor.co.za", "tripadvisor.co.kr", "tripadvisor.es", "tripadvisor.se", "tripadvisor.ch", "fr.tripadvisor.ch", "it.tripadvisor.ch", "tripadvisor.com.tw", "th.tripadvisor.com", "tripadvisor.com.tr", "tripadvisor.co.uk", "tripadvisor.com.ve", "tripadvisor.com.vn"]
            default: "tripadvisor.com"
        - name: q
          in: query
          required: false
          description: Free-text query that filters reviews to those whose text matches the keyword
          schema:
            type: string
        - name: sort_by
          in: query
          required: false
          description: Sort order for returned reviews
          schema:
            type: string
            enum: ["most_recent", "detailed_reviews"]
            default: "most_recent"
        - name: rating
          in: query
          required: false
          description: Filter reviews by star rating. Accepts a single value or a comma-separated list (e.g. `4,5`).
          schema:
            type: string
        - name: trip_type
          in: query
          required: false
          description: Filter reviews by traveler type. Accepts a single value or a comma-separated list (e.g. `families,couples`). Allowed values are `families`, `couples`, `solo`, `business`, `friends`.
          schema:
            type: string
        - name: time_of_year
          in: query
          required: false
          description: Filter reviews by the month or quarter the trip took place. Accepts a single value or a comma-separated list. Allowed values are quarter keys (`mar_may`, `jun_aug`, `sep_nov`, `dec_feb`) and three-letter month keys (`jan`, `feb`, `mar`, `apr`, `may`, `jun`, `jul`, `aug`, `sep`, `oct`, `nov`, `dec`).
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Target language for translated review text. Check the list of supported Tripadvisor languages at /docs/parameters/tripadvisor/language.
          schema:
            type: string
            enum: ["ar", "zhCN", "zhTW", "cs", "da", "nl", "en", "fi", "fr", "de", "el", "iw", "hu", "in", "it", "ja", "ko", "no", "pl", "pt", "ru", "sr", "sk", "es", "sv", "th", "tr", "uk", "vi"]
            default: "en"
        - name: original_language
          in: query
          required: false
          description: Filter reviews by the language they were originally written in. Accepts a single value or a comma-separated list (e.g. `en,es`). Check the list of supported Tripadvisor languages at /docs/parameters/tripadvisor/language.
          schema:
            type: string
        - name: translate
          in: query
          required: false
          description: Whether to machine-translate review text into the target `language`
          schema:
            type: boolean
            default: true
        - name: num
          in: query
          required: false
          description: Number of reviews per page
          schema:
            type: integer
            minimum: 1
            maximum: 20
            default: 10
        - name: page
          in: query
          required: false
          description: Page number for pagination
          schema:
            type: integer
            minimum: 1
            default: 1
      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
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        place:
          $ref: '#/components/schemas/Place'
        reviews:
          type: array
          description: List of reviews for the place
          items:
            $ref: '#/components/schemas/Review'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Error message when no reviews are found

    SearchMetadata:
      type: object
      required: [id, 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: Tripadvisor 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
          description: Search engine used
        place_id:
          type: string
          description: Tripadvisor place identifier
        tripadvisor_domain:
          type: string
          description: Tripadvisor domain queried
        q:
          type: string
          description: Free-text query used to filter reviews
        sort_by:
          type: string
          description: Sort order applied to reviews
        rating:
          type: string
          description: Star ratings used to filter reviews
        trip_type:
          type: string
          description: Traveler types used to filter reviews
        time_of_year:
          type: string
          description: Time-of-year filter applied to reviews
        language:
          type: string
          description: Target language for translated review text
        original_language:
          type: string
          description: Original languages used to filter reviews
        translate:
          type: string
          description: Whether machine translation is applied to review text
        num:
          type: integer
          description: Number of reviews per page
        page:
          type: integer
          description: Current page number

    SearchInformation:
      type: object
      properties:
        total_reviews:
          type: integer
          description: Total number of reviews available for the place
        sort_by:
          type: string
          description: Sort order reported by Tripadvisor for the returned reviews
          enum: ["most_recent", "detailed_reviews"]

    Place:
      type: object
      properties:
        id:
          type: integer
          description: Unique Tripadvisor place identifier
        title:
          type: string
          description: Name of the place
        type:
          type: string
          description: Place type (Accommodation, Attraction, Attraction Product, Eatery, Geo)
        link:
          type: string
          description: Absolute URL to the place page on Tripadvisor

    Review:
      type: object
      required: [position, id, title, text, rating, date, link, language]
      properties:
        position:
          type: integer
          description: Position of the review in the returned page (1-based)
        id:
          type: integer
          description: Unique Tripadvisor review identifier
        title:
          type: string
          description: Review title
        text:
          type: string
          description: Review body text (translated when `translate` is `true`)
        language:
          type: string
          description: Language code of the returned review text
        original_language:
          type: string
          description: Language code of the original review text
        translation_type:
          type: string
          description: Type of translation applied to the review text (e.g. `Mt` for machine translation)
        rating:
          type: integer
          description: Star rating from 1 to 5
          minimum: 1
          maximum: 5
        subratings:
          type: array
          description: Category-specific subratings for the review
          items:
            $ref: '#/components/schemas/Subrating'
        votes:
          type: integer
          description: Number of helpful votes the review has received
        date:
          type: string
          description: Date the review was published or created
        travel_date:
          type: string
          description: Date of the trip being reviewed
        travel_type:
          type: string
          description: Traveler type reported by the reviewer (e.g. `Family`, `Couples`, `Solo`, `Business`, `Friends`)
        publish_platform:
          type: string
          description: Platform the review was published from (e.g. `Mobile`, `Desktop`, `Ipad`)
        link:
          type: string
          description: Absolute URL to the review detail page on Tripadvisor
        author:
          $ref: '#/components/schemas/Author'
        response:
          $ref: '#/components/schemas/ManagementResponse'
        photos:
          type: array
          description: Photos attached to the review
          items:
            $ref: '#/components/schemas/Photo'

    Subrating:
      type: object
      properties:
        text:
          type: string
          description: Localized label for the subrating category
        value:
          type: integer
          description: Star rating for the subrating category
          minimum: 1
          maximum: 5

    Photo:
      type: object
      properties:
        caption:
          type: string
          description: Caption provided by the reviewer
        original:
          type: string
          description: Base URL template for the photo (without width/height substitutions)
        thumbnail:
          type: string
          description: Photo URL with width and height substituted to the maximum available size

    Author:
      type: object
      properties:
        name:
          type: string
          description: Display name of the reviewer
        username:
          type: string
          description: Tripadvisor username
        hometown:
          type: string
          description: Reviewer hometown, when disclosed
        link:
          type: string
          description: Absolute URL to the reviewer profile
        avatar:
          type: string
          description: URL of the reviewer avatar image
        is_verified:
          type: boolean
          description: Whether the reviewer is a verified Tripadvisor user
        contributions:
          type: integer
          description: Total number of Tripadvisor contributions by the reviewer

    ManagementResponse:
      type: object
      description: Owner or management response attached to the review
      properties:
        text:
          type: string
          description: Response body text
        language:
          type: string
          description: Language code of the response text
        date:
          type: string
          description: Date the response was published
        author:
          allOf:
            - $ref: '#/components/schemas/Author'
            - type: object
              properties:
                connection:
                  type: string
                  description: Responder relationship to the place (e.g. `General Manager`, `Owner`)

    Pagination:
      type: object
      required: [total_results, current_page]
      properties:
        total_results:
          type: integer
          description: Total number of reviews available for the place
        current_page:
          type: integer
          description: Current page number
        next_page:
          type: integer
          description: Next page number, omitted when no further pages are available

    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
