The APIVex Tripadvisor API exposes public travel data for hotels, restaurants, attractions, and destinations. This guide builds a hotel lookup: search for a place, inspect the matching results, then retrieve the selected hotel’s details.
APIVex provides third-party data access. These endpoints do not complete bookings. Hotel offers, where requested, describe public rates for a stay rather than a completed reservation.
Understand place IDs and destination IDs
Tripadvisor workflows use two important identifiers:
| Identifier | Represents | Typical use |
|---|---|---|
location_id | A specific hotel, restaurant, or attraction | Place details, photos, reviews |
geo_id | A destination such as a city | Destination details and place lists |
They are not interchangeable. A Tripadvisor URL can contain a destination segment such as g60763 and a place segment such as d5040757. Prefer the fields returned by the API instead of treating either number as a universal ID.
Search for a hotel
Use the base URL https://api.apivex.com/tripadvisor and your APIVex key from the dashboard.
curl --get 'https://api.apivex.com/tripadvisor/api/search/locations' \
--header "x-apivex-key: $APIVEX_API_KEY" \
--data-urlencode 'query=Hilton Times Square' \
--data-urlencode 'type=hotel' \
--data-urlencode 'limit=2'The matching places are in data.results. This search returned similarly named properties, including Homewood Suites and Embassy Suites. Do not assume that a broad hotel-brand query identifies one exact property.
Display each result’s name and available location information in a picker. Save the location_id of the user’s choice and use that identifier for later refreshes.
Retrieve the selected hotel’s details
The Node.js example below prints the matches and retrieves the first one as a compact demonstration. In an application, replace that first-result selection with the user’s confirmed choice. Save the code as hotel-lookup.mjs, set APIVEX_API_KEY, and run it using Node.js 20 or newer.
const key = process.env.APIVEX_API_KEY;
if (!key) throw new Error('Set APIVEX_API_KEY first');
const base = 'https://api.apivex.com/tripadvisor';
// Demonstration pacing; use the request rate allowed by your plan.
const pause = () => new Promise(resolve => setTimeout(resolve, 2500));
async function get(path, params) {
const url = new URL(base + path);
url.search = new URLSearchParams(params).toString();
const response = await fetch(url, {
headers: {'x-apivex-key': key},
signal: AbortSignal.timeout(30000)
});
if (!response.ok) throw new Error('HTTP ' + response.status);
const body = await response.json();
if (body.status !== true) throw new Error(body.message || 'API request failed');
return body.data;
}
const search = await get('/api/search/locations', {query: 'Hilton Times Square', type: 'hotel', limit: 2});
console.table(search.results.map(p => ({id: p.location_id, name: p.name})));
const hotel = search.results.find(p => !p.is_geo && p.location_id);
if (!hotel) throw new Error('No hotel in this result page');
// Demo: inspect the matches above; a real UI should ask the user to choose.
await pause();
const detail = await get('/api/hotels/detail', {location_id: hotel.location_id, hl: 'en', currency: 'USD'});
console.log(JSON.stringify(detail, null, 2));The returned hotel detail record included name, address, rating, review_count, coordinates, and both identifiers. For the selected Homewood Suites property, location_id was 5040757 and geo_id was 60763.
The response did not include every field listed as possible in the endpoint description. Treat optional amenities, descriptions, price bands, and images as optional in your application; do not invent values when they are absent.
Add reviews or stay-specific offers
Review routes use the place and destination identifiers. Get them from the selected property, preserve any returned continuation token, and follow the endpoint’s first-page versus continuation-page rules in the documentation. Do not send a hotel ID to a restaurant-review route just because both use numeric IDs.
Hotel detail requests can take optional stay dates. For a stay-price workflow, keep check-in, check-out, adults, rooms, and currency explicit and associated with the returned offer. A price without those inputs is not enough to compare two stays reliably.
A hotel’s rating and review count can change. Store when you fetched the record and avoid presenting a cached count as an instantaneous measurement. Missing review text, images, or price information should remain missing rather than being replaced with fabricated content.
Separate hotel discovery from booking
A travel comparison interface can use this API to find properties, show public details, and explore reviews or offers. It should keep the selected destination and property distinct throughout that flow.
If a request fails, retain the user’s selected ID so they can retry without accidentally switching hotels. Check the HTTP status and the API response before writing an empty result over a previously valid property record.
Use the Tripadvisor API documentation to try a property search and inspect the review or offer parameters. For a separate accommodation-data workflow, the Booking API guide covers that provider’s identifiers and endpoints.



