Finds Locations by free-text name or address.
Use this endpoint to resolve a textual query (for example a business name or street address) into matching Tripadvisor Locations. Results are restricted to Locations you are licensed to access and return the full Location representation.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Search Locations requests
A Search Locations request takes a free-text query and returns the matching Locations, restricted to those on your allowlist. Each result is a full Location plus matched_value, the text that matched the query.
To search the whole Tripadvisor catalogue — for example when deciding what to add to your allowlist — use Search Locations Catalog.
A request is an HTTP GET to a URL in the form:
https://terra.tripadvisor.com/api/locations/search
Search Locations responses
The response is a paged object. The data array contains the matches; the pagination object carries page, size, total_elements and total_pages. Pages are 1-based.
A query that matches nothing on your allowlist returns an empty data array, not 404. To distinguish "not in the Tripadvisor catalogue" from "not licensed to me", run the same query against Search Locations Catalog.
Search parameters
query
Required. Between 1 and 500 characters. A longer value returns 400 with the message query must be between 1 and 500 characters.
search_type
What the query is matched against: NAME (default), ADDRESS or COMBINED.
country_code
An ISO 3166-1 alpha-2 country code, upper case. A lower-case value returns 400 with the message should be Alpha-2 country code.
geo_name and postal_code
A destination name and a postal code, each narrowing the search. If both are supplied and they do not resolve consistently, postal_code takes precedence.
category
One of RESTAURANT, ATTRACTION or HOTEL.
Limits
size must not exceed 20 and defaults to 20. A larger value returns 400 with the message 'size' should not go over 20.
Search has no offset ceiling, so it can be paged to the end of the result set. Search Nearby Locations does have one.
Note: the search and nearby endpoints have a lower rate limit than the rest of your package. Debounce user input rather than issuing a request per keystroke. See API Access and Limits.
Note: matching is tuned for Latin-script languages. Chinese, Japanese and Korean queries return weaker results.
Examples
Search by name within a city
curl "https://terra.tripadvisor.com/api/locations/search?version=1&query=bistrot&geo_name=Paris&category=RESTAURANT" \
-H "X-API-Key: API_KEY"Search by address
curl "https://terra.tripadvisor.com/api/locations/search?version=1&query=12%20Rue%20de%20Rivoli&search_type=ADDRESS&country_code=FR" \
-H "X-API-Key: API_KEY"Narrow a search by postal code
curl "https://terra.tripadvisor.com/api/locations/search?version=1&query=hotel&postal_code=75004&country_code=FR&size=10" \
-H "X-API-Key: API_KEY"Related
- Search Locations Catalog — the same query, not restricted by allowlist
- Search Nearby Locations — by geography instead of text
- Catalog Search vs Location Search