GET
# TripAdvisor Geo Search API

Map city or location names to TripAdvisor geo IDs for use with the Search endpoint.

## Overview

#### Geo ID Lookup

Use this endpoint to resolve location names (e.g., "Paris", "Bangkok") into TripAdvisor geo IDs, which are required by the Search endpoint.

The Geo Search endpoint accepts a location name and returns matching geographic locations with their geo IDs. Pass the returned `geo_id` directly to `/v1/tripadvisor/search` to find hotels in that location.

### Endpoint URL

GET https://api.stayapi.com/v1/tripadvisor/geo-search 

## Query Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| query | string | Required | Location name to search for (e.g., "Paris", "Bangkok", "New York") |

## Example Geo IDs

#### Use with Search

Pass the geo\_id from this endpoint directly to /v1/tripadvisor/search?geo\_id=... to search for hotels in that location.

| Location | Geo ID | Type |
| --- | --- | --- |
| Paris, Ile-de-France, France | 187147 | CITY |
| Bangkok, Thailand | 293916 | CITY |
| New York City, New York, US | 60763 | CITY |
| Phuket, Thailand | 293920 | ISLAND |
| London, England, UK | 186338 | CITY |

## Response Data

### Result Fields

- `geo_id` — TripAdvisor geographic ID (use with Search endpoint)
- `name` — Location name
- `secondary_text` — Parent region or country
- `geo_type` — Location type (CITY, ISLAND, MUNICIPALITY, etc.)

Request

```curl
curl -X GET "https://api.stayapi.com/v1/tripadvisor/geo-search?query=Paris" \
  -H "x-api-key: YOUR_API_KEY"
```

Response

```json
{
  "success": true,
  "query": "Paris",
  "results": [
    {
      "geo_id": 187147,
      "name": "Paris",
      "secondary_text": "Ile-de-France, France",
      "geo_type": "CITY"
    }
  ],
  "result_count": 1
}
```

```json
{
  "type": "https://api.stayapi.com/errors/upstream-error",
  "title": "Upstream Error",
  "status": 502,
  "detail": "The upstream service could not complete the request.",
  "error_code": "UPSTREAM_ERROR"
}
```
