openapi: 3.0.0
info:
  title: Google Hotels API
  description: |
    The Google Hotels API provides comprehensive hotel and vacation rental search capabilities. Search for accommodations by location or within geographic boundaries, filter by amenities, price, and property type, and get detailed information about each property including pricing, reviews, and availability.

    **Cross-linking**: The `property_token` returned by this API can be used with the Google Hotels Property API to fetch detailed information about a specific property. Pass it as the `property_token` parameter.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Hotels Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Search engine to use
          schema:
            type: string
            enum: ["google_hotels"]
        - name: q
          in: query
          required: false
          description: Search query for hotels location. Either q or bounding_box is required.
          schema:
            type: string
        - name: bounding_box
          in: query
          required: false
          description: Geographic boundary for search as [min_longitude, min_latitude, max_longitude, max_latitude]. Either q or bounding_box is required.
          schema:
            type: string
        - name: check_in_date
          in: query
          required: true
          description: Check-in date in YYYY-M-D format
          schema:
            type: string
            pattern: '^\d{4}-(0?[1-9]|1[0-2])-(0?[1-9]|[12][0-9]|3[01])$'
        - name: check_out_date
          in: query
          required: true
          description: Check-out date in YYYY-M-D format
          schema:
            type: string
            pattern: '^\d{4}-(0?[1-9]|1[0-2])-(0?[1-9]|[12][0-9]|3[01])$'
        - name: currency
          in: query
          required: false
          description: Currency code for prices
          schema:
            type: string
            enum: ["AED", "ALL", "AMD", "ARS", "AUD", "AWG", "AZN", "BAM", "BGN", "BHD", "BMD", "BRL", "BSD", "BYN", "CAD", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CZK", "DKK", "DOP", "EGP", "EUR", "GBP", "GEL", "HKD", "HUF", "IDR", "ILS", "INR", "IRR", "ISK", "JMD", "JOD", "JPY", "KRW", "KWD", "KZT", "LBP", "MAD", "MKD", "MDL", "MXN", "MYR", "NOK", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "QAR", "RON", "RSD", "RUB", "SAR", "SEK", "SGD", "THB", "TRY", "TWD", "UAH", "USD", "VND", "XPF", "ZAR"]
            default: "USD"
        - name: hl
          in: query
          required: false
          description: Language code for results
          schema:
            type: string
            default: "en"
        - name: gl
          in: query
          required: false
          description: Country code for search
          schema:
            type: string
            default: "us"
        - name: adults
          in: query
          required: false
          description: Number of adults (1-10)
          schema:
            type: integer
            minimum: 1
            maximum: 10
            default: 2
        - name: children_ages
          in: query
          required: false
          description: Comma-separated ages of children (1-17)
          schema:
            type: string
        - name: sort_by
          in: query
          required: false
          description: Sort order for results
          schema:
            type: string
            enum: ["relevance", "lowest_price", "highest_rating", "most_reviewed"]
        - name: price_min
          in: query
          required: false
          description: Minimum price per night
          schema:
            type: number
            minimum: 0
        - name: price_max
          in: query
          required: false
          description: Maximum price per night
          schema:
            type: number
            minimum: 0
        - name: property_type
          in: query
          required: false
          description: Type of property to search for
          schema:
            type: string
            enum: ["hotel", "vacation_rental"]
            default: "hotel"
        - name: property_types
          in: query
          required: false
          description: Comma-separated property type IDs to filter by
          schema:
            type: string
        - name: amenities
          in: query
          required: false
          description: Comma-separated amenity IDs to filter by
          schema:
            type: string
        - name: rating
          in: query
          required: false
          description: Minimum star rating filter
          schema:
            type: string
            enum: ["7", "8", "9"]
        - name: free_cancellation
          in: query
          required: false
          description: Filter for properties with free cancellation
          schema:
            type: boolean
        - name: special_offers
          in: query
          required: false
          description: Filter for properties with special offers
          schema:
            type: boolean
        - name: eco_certified
          in: query
          required: false
          description: Filter for eco-certified properties
          schema:
            type: boolean
        - name: for_displaced_individuals
          in: query
          required: false
          description: Filter for properties supporting displaced individuals
          schema:
            type: boolean
        - name: hotel_class
          in: query
          required: false
          description: Comma-separated hotel class values (2-5 stars)
          schema:
            type: string
        - name: brands
          in: query
          required: false
          description: Comma-separated brand IDs to filter by
          schema:
            type: string
        - name: bedrooms
          in: query
          required: false
          description: Number of bedrooms (0-5, vacation rentals only)
          schema:
            type: integer
            minimum: 0
            maximum: 5
        - name: bathrooms
          in: query
          required: false
          description: Number of bathrooms (0-5, vacation rentals only)
          schema:
            type: integer
            minimum: 0
            maximum: 5
        - name: next_page_token
          in: query
          required: false
          description: Token for pagination to get next page of results
          schema:
            type: string
      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'
        properties:
          type: array
          items:
            $ref: '#/components/schemas/Property'
          description: List of hotels or vacation rentals
        brands:
          type: array
          items:
            $ref: '#/components/schemas/Brand'
          description: Available hotel brands for filtering
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Error message if the search failed

    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: "Google Hotels 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
        q:
          type: string
          description: Search query
        check_in_date:
          type: string
          description: Check-in date
        check_out_date:
          type: string
          description: Check-out date
        currency:
          type: string
          description: Currency code
        hl:
          type: string
          description: Language code
        gl:
          type: string
          description: Country code
        bounding_box:
          type: string
          description: Geographic boundary
        adults:
          type: integer
          description: Number of adults
        children_ages:
          type: string
          description: Ages of children
        sort_by:
          type: string
          description: Sort order
        price_min:
          type: number
          description: Minimum price filter
        price_max:
          type: number
          description: Maximum price filter
        property_type:
          type: string
          description: Property type
        property_types:
          type: string
          description: Property type IDs
        amenities:
          type: string
          description: Amenity IDs
        rating:
          type: string
          description: Minimum rating filter
        free_cancellation:
          type: boolean
          description: Free cancellation filter
        special_offers:
          type: boolean
          description: Special offers filter
        eco_certified:
          type: boolean
          description: Eco-certified filter
        for_displaced_individuals:
          type: boolean
          description: Displaced individuals support filter
        hotel_class:
          type: string
          description: Hotel class filter
        brands:
          type: string
          description: Brand IDs filter
        bedrooms:
          type: integer
          description: Number of bedrooms
        bathrooms:
          type: integer
          description: Number of bathrooms
        next_page_token:
          type: string
          description: Pagination token

    SearchInformation:
      type: object
      properties:
        total_results:
          type: integer
          description: Total number of results found

    Property:
      type: object
      properties:
        type:
          type: string
          description: Type of property (hotel or vacation_rental)
        property_token:
          type: string
          description: Unique token for this property. Use with Google Hotels Property API for details.
        data_id:
          type: string
          description: Google's internal ID for this property
        name:
          type: string
          description: Name of the property
        link:
          type: string
          description: Link to property details
        description:
          type: string
          description: Property description
        gps_coordinates:
          $ref: '#/components/schemas/GPSCoordinates'
        city:
          type: string
          description: City where property is located
        country:
          type: string
          description: Country where property is located
        check_in_time:
          type: string
          description: Check-in time
        check_out_time:
          type: string
          description: Check-out time
        price_per_night:
          $ref: '#/components/schemas/Price'
        total_price:
          $ref: '#/components/schemas/Price'
        deal:
          type: string
          description: Deal indicator
        deal_description:
          type: string
          description: Description of the deal (Deal or Great Deal)
        nearby_places:
          type: array
          items:
            $ref: '#/components/schemas/NearbyPlace'
          description: Notable places near the property
        hotel_class:
          type: string
          description: Hotel star rating
        extracted_hotel_class:
          type: integer
          description: Numeric hotel class
        offers:
          type: array
          items:
            $ref: '#/components/schemas/Offer'
          description: Booking offers from different sources
        rating:
          type: number
          description: Overall rating
        reviews:
          type: integer
          description: Number of reviews
        reviews_histogram:
          type: object
          additionalProperties:
            type: integer
          description: Distribution of reviews by rating
        location_rating:
          type: number
          description: Location rating score
        proximity_to_things_to_do_rating:
          type: number
          description: Rating for proximity to activities
        proximity_to_transit_rating:
          type: number
          description: Rating for proximity to transit
        airport_access_rating:
          type: number
          description: Rating for airport accessibility
        reviews_breakdown:
          type: array
          items:
            $ref: '#/components/schemas/ReviewBreakdown'
          description: Breakdown of reviews by category
        eco_certified:
          type: boolean
          description: Eco-certification status
        amenities:
          type: array
          items:
            type: string
          description: Available amenities
        excluded_amenities:
          type: array
          items:
            type: string
          description: Amenities not available
        essential_info:
          type: array
          items:
            type: string
          description: Essential property information
        images:
          type: array
          items:
            $ref: '#/components/schemas/Image'
          description: Property images

    GPSCoordinates:
      type: object
      properties:
        latitude:
          type: number
          description: Latitude coordinate
        longitude:
          type: number
          description: Longitude coordinate

    Price:
      type: object
      properties:
        price:
          type: string
          description: Formatted price with currency
        extracted_price:
          type: integer
          description: Numeric price value
        price_before_taxes:
          type: string
          description: Formatted price before taxes
        extracted_price_before_taxes:
          type: integer
          description: Numeric price before taxes

    NearbyPlace:
      type: object
      properties:
        name:
          type: string
          description: Name of the nearby place
        transportations:
          type: array
          items:
            $ref: '#/components/schemas/Transportation'
          description: Transportation options to reach the place

    Transportation:
      type: object
      properties:
        type:
          type: string
          description: Type of transportation (Taxi, Transit, Walking, Public Transport)
        duration:
          type: string
          description: Time to reach destination

    Offer:
      type: object
      properties:
        source:
          type: string
          description: Name of the booking source
        link:
          type: string
          description: Direct booking link
        logo:
          type: string
          description: Logo URL of the booking source
        is_official:
          type: boolean
          description: Whether this is the official hotel website
        remarks:
          type: array
          items:
            type: string
          description: Special remarks about the offer
        num_guests:
          type: integer
          description: Number of guests included
        price_per_night:
          $ref: '#/components/schemas/OfferPrice'
        total_price:
          $ref: '#/components/schemas/OfferPrice'
        original_price_per_night:
          $ref: '#/components/schemas/OfferPrice'
        original_total_price:
          $ref: '#/components/schemas/OfferPrice'
        discount_remarks:
          type: array
          items:
            type: string
          description: Information about discounts
        has_free_cancellation:
          type: boolean
          description: Whether offer has free cancellation
        free_cancellation_until:
          $ref: '#/components/schemas/FreeCancellation'

    OfferPrice:
      type: object
      properties:
        price:
          type: string
          description: Formatted price
        extracted_price:
          type: number
          description: Numeric price value
        price_before_taxes:
          type: string
          description: Price before taxes
        extracted_price_before_taxes:
          type: number
          description: Numeric price before taxes

    FreeCancellation:
      type: object
      properties:
        date:
          type: string
          description: Last date for free cancellation
        time:
          type: string
          description: Last time for free cancellation

    ReviewBreakdown:
      type: object
      properties:
        name:
          type: string
          description: Review category name
        description:
          type: string
          description: Category description
        total:
          type: integer
          description: Total reviews in category
        positive:
          type: integer
          description: Positive reviews
        neutral:
          type: integer
          description: Neutral reviews
        negative:
          type: integer
          description: Negative reviews

    Image:
      type: object
      properties:
        thumbnail:
          type: string
          description: Thumbnail image URL
        original:
          type: string
          description: Full-size image URL

    Brand:
      type: object
      properties:
        id:
          type: integer
          description: Brand identifier
        title:
          type: string
          description: Brand name
        children:
          type: array
          items:
            $ref: '#/components/schemas/BrandChild'
          description: Sub-brands or hotel chains under this brand

    BrandChild:
      type: object
      properties:
        id:
          type: integer
          description: Sub-brand identifier
        title:
          type: string
          description: Sub-brand name

    Pagination:
      type: object
      properties:
        records_from:
          type: integer
          description: Starting record number
        records_to:
          type: integer
          description: Ending record number
        next_page_token:
          type: string
          description: Token to fetch next page of results

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