# Google Hotels

The Google Hotels API enables retrieval of Google Hotels search results and returns structured JSON output.

It supports hotel search queries with filters such as check-in/check-out dates, number of guests, price range, currency, sorting, and more.

***

### API Setup

#### Endpoint

```http
https://serp-api.netnut.io/search
```

***

### Authentication

Use HTTP Basic Authentication:

```
Authorization: Basic <base64(username:password)>
```

Where `<base64(username:password)>` is the Base64-encoded string of your NetNut credentials.

***

### Request Format

The request is sent as a **GET** request.\
All parameters are passed directly in the URL query string.

#### Example Request

```http
https://serp-api.netnut.io/search?hl=en&q=uk&gl=us&engine=google_hotels&adults=1&checkInDate=2026-03-26&checkOutDate=2026-03-28
```

***

### Request Parameters

| Field        | Type    | Description                                                                                                                                | Parameter Type |
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------------- |
| engine       | string  | Search engine to use. For this product, use `google_hotels`.                                                                               | Required       |
| q            | string  | Search query or destination for the hotel search.                                                                                          | Required       |
| hl           | string  | Language of the Google Hotels results. Example: `en`.                                                                                      | Optional       |
| gl           | string  | Geographic location for the search results. Example: `us`.                                                                                 | Optional       |
| checkInDate  | string  | Hotel check-in date in `YYYY-MM-DD` format.                                                                                                | Required       |
| checkOutDate | string  | Hotel check-out date in `YYYY-MM-DD` format.                                                                                               | Required       |
| ts           | string  | Google Hotels encoded parameter used for advanced search state and filtering. **Can be used without** `checkInDate` **and** `checkOutDate` | Optional       |
| minPrice     | integer | Minimum hotel price filter.                                                                                                                | Optional       |
| maxPrice     | integer | Maximum hotel price filter.                                                                                                                | Optional       |
| currency     | string  | Currency for hotel pricing. Example: `USD`, `EUR`.                                                                                         | Optional       |
| adults       | integer | Number of adults staying.                                                                                                                  | Optional       |
| childrenAges | string  | Ages of children as comma-separated values. Example: `2,6,10`.                                                                             | Optional       |
| sortBy       | string  | Sorting method for hotel results.                                                                                                          | Optional       |
| rawHtml      | integer | Controls whether raw HTML is returned. `1` = return parsed JSON + HTML, `2` = return HTML only.                                            | Optional       |

***

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://serp-api.netnut.io/search?hl=en&q=uk&gl=us&engine=google_hotels&adults=1&checkInDate=2026-03-26&checkOutDate=2026-03-28" \
  -u "username:password"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from base64 import b64encode

headers = {
    "Authorization": "Basic " + b64encode(b"username:password").decode()
}

params = {
    "hl": "en",
    "q": "uk",
    "gl": "us",
    "engine": "google_hotels",
    "adults": 1,
    "checkInDate": "2026-03-26",
    "checkOutDate": "2026-03-28"
}

response = requests.get("https://serp-api.netnut.io/search", headers=headers, params=params)
print(response.json())
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const username = "username";
const password = "password";

const params = new URLSearchParams({
  hl: "en",
  q: "uk",
  gl: "us",
  engine: "google_hotels",
  adults: 1,
  checkInDate: "2026-03-26",
  checkOutDate: "2026-03-28"
});

const response = await fetch(`https://serp-api.netnut.io/search?${params}`, {
  method: "GET",
  headers: {
    "Authorization": "Basic " + Buffer.from(`${username}:${password}`).toString("base64")
  }
});

const data = await response.json();
console.log(data);
```

{% endtab %}
{% endtabs %}

***

### Response Format

The Google Hotels API returns structured JSON.

No HTML is returned by default.

When `rawHtml=1`, the response includes both the parsed JSON and the raw HTML.\
When `rawHtml=2`, the response returns only the raw HTML.

***

### Example JSON Response

```json
{
  "url": "https://www.google.com/travel/search?gl=US&hl=en&q=uk&start=0&ts=CAESBgoCCAMQARogCgIaABIaEhQKBwjqDxADGBoSBwjqDxADGBwYAjICCAEqDQoLOgNVU0RiAggBGgA&uule=w+CAIQICINVW5pdGVkIFN0YXRlcw",
  "general": {
    "searchEngine": "google_hotels",
    "language": "en",
    "device": "desktop",
    "searchType": "text",
    "pageTitle": "uk - Google Hotel Search",
    "timestamp": "2026-03-10T13:29:47.328468801Z",
    "render": false
  },
  "input": {
    "originalUrl": "https://www.google.com/search?gl=US&hl=en&q=uk&start=0&ts=CAESBgoCCAMQARogCgIaABIaEhQKBwjqDxADGBoSBwjqDxADGBwYAjICCAEqDQoLOgNVU0RiAggBGgA&uule=w+CAIQICINVW5pdGVkIFN0YXRlcw",
    "jobId": "b40c5eab-2694-4aa8-9114-68096e05102e"
  },
  "hotels": [
    {
      "name": "Smart Hyde Park View",
      "tags": [
        "Excellent location"
      ],
      "link": "https://www.google.com/travel/hotels/entity/ChcIqsyXsbLfss8SGgsvZy8xdGR5ZjMwbhAB?engine=google_hotels&q=uk&uule=w+CAIQICINVW5pdGVkIFN0YXRlcw&hl=en&gl=US&start=0&ts=CAESBgoCCAMQARogCgIaABIaEhQKBwjqDxADGBoSBwjqDxADGBwYAjICCAEqDQoLOgNVU0RiAggBGgA",
      "propertyToken": "ChcIqsyXsbLfss8SGgsvZy8xdGR5ZjMwbhAB",
      "hotelClass": "2-star hotel",
      "extractedHotelClass": 2,
      "overallRating": 3.7,
      "ratePerNight": {
        "lowest": "$18",
        "extractedLowest": 18
      },
      "totalRate": {
        "lowest": "$37 total",
        "extractedLowest": 37
      },
      "reviews": "1,935",
      "amenities": [
        "Breakfast ($)",
        "Free Wi-Fi",
        "Air conditioning",
        "Bar",
        "Restaurant",
        "Kid-friendly",
        "Smoke-free property"
      ],
      "images": [
        {
          "thumbnail": "https://lh5.googleusercontent.com/proxy/example-image-1"
        },
        {
          "thumbnail": "https://lh3.googleusercontent.com/p/example-image-2"
        }
      ],
      "reviewsLink": "https://www.google.com/travel/hotels/entity/ChcIqsyXsbLfss8SGgsvZy8xdGR5ZjMwbhAB/reviews?engine=google_hotels&q=uk",
      "rank": 1
    },
    {
      "name": "Safestay London Kensington Holland Park",
      "link": "https://www.google.com/travel/hotels/entity/ChkIwsae5-_N1oMzGg0vZy8xMWI4MDdoaHE0EAE?engine=google_hotels&q=uk",
      "propertyToken": "ChkIwsae5-_N1oMzGg0vZy8xMWI4MDdoaHE0EAE",
      "hotelClass": "4-star hotel",
      "extractedHotelClass": 4,
      "overallRating": 3.6,
      "ratePerNight": {
        "lowest": "$20",
        "extractedLowest": 20
      },
      "totalRate": {
        "lowest": "$41 total",
        "extractedLowest": 41
      },
      "reviews": "2,287",
      "amenities": [
        "Breakfast",
        "Free Wi-Fi",
        "Bar",
        "Restaurant",
        "Kid-friendly",
        "Smoke-free property"
      ],
      "images": [
        {
          "thumbnail": "https://lh5.googleusercontent.com/proxy/example-image-3"
        }
      ],
      "reviewsLink": "https://www.google.com/travel/hotels/entity/ChkIwsae5-_N1oMzGg0vZy8xMWI4MDdoaHE0EAE/reviews?engine=google_hotels&q=uk",
      "rank": 2
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.netnut.io/netnut-documentation/netnut-scraper-apis/serp-api/google-scraper/google-hotels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
