# 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       |

***

#### Example Usage

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

```bash
curl -X POST https://llm-scraper.netnut.io/search \
  -H "Content-Type: application/json" \
  -U "username:password" \
  -d '{
    "prompt": "Give me SEO trends for 2025",
    "engine": "copilot",
    "mode": "chat",
    "country": "uk"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from base64 import b64encode

headers = {
    "Authorization": "Basic " + b64encode(b"username:password").decode(),
    "Content-Type": "application/json"
}

body = {
    "prompt": "Give me SEO trends for 2026",
    "country": "us",
    "engine": "copilot",
    "mode": "chat",
}

response = requests.post("https://llm-scraper.netnut.io/search", headers=headers, json=body)
print(response.json())
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const username = 'your_username';
const password = 'your_password';
const auth = Buffer.from(`${username}:${password}`).toString('base64');

const headers = {
  'Authorization': `Basic ${auth}`,
  'Content-Type': 'application/json'
};

const body = {
  prompt: 'Give me SEO trends for 2025',
  engine: "copilot",
  mode: "chat",
  country: 'us'
};

fetch('https://llm-scraper.netnut.io/search', {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error.message));
```

{% 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
    }
  ]
}
```
