Search Locations

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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

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

Query Params
string
required
length between 1 and 500

Text search query.

string
Defaults to NAME

Searching type.

string
^[A-Z]{2}$

Alpha-2 country code.

string

City, Town, or Country Geo Name.

string

Postal/zip code to further narrow results.

If both geo_name and postal_code are given, the postal_code takes precedence in case they do not resolve.

string
enum

Filter based on Tripadvisor’s top-level categories (eat & drink, accommodations, attractions).

Allowed:
locale
array of strings

preferred locales for localized fields (e.g. names, descriptions), in priority order;
falls back to the default locale when omitted

locale
integer
≥ 1

Page index (1-based).

integer
≤ 20
Defaults to 20

Page size.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/problem+json