Hotels in a destination API
Hotels in a destination with Tripadvisor’s filters, sorts and prices, paginated.
GET /v1/tripadvisor/hotelsBeta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/tripadvisor/hotels?q=New%20York%20City",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "geo": { "geoId": 60763, "name": "New York City" }, "results": [ { "hotelResultKey": "7778097:s:MzMxODA3Njk:07e457c3-c3e1-4c35-a43b-df461e10b743", "locationId": 7778097, "location": { "url": "/Hotel_Review-g60763-d7778097-Reviews-EVEN_Hotel_New_York_Times_Square_South_by_…", "reviewSummary": { "…": "2 fields" }, "thumbnail": { "…": "4 fields" }, "businessAdvantageSubscriptions": [ "…" ], "locationV2": { "…": "14 fields" }, "accommodationCategory": "HOTEL", "countryId": 191, "isoCountryCode": "US", "socialStatistics": { "…": "1 fields" } }, "resultDetail": { "businessAdvantageInfo": { "…": "1 fields" }, "amenities": { "…": "1 fields" }, "merchandisingLabels": [ "…" ], "isNewListingTag": false, "hotelMetaResult": { "…": "12 fields" } }, "hotelHighlightLink": { "webLinkUrl": "/HotelHighlight-g60763-d7778097-Reviews-EVEN_Hotel_New_York_Times_Square_South_b…" } }, "… 36 more" ], "total": 1051, "pagination": { "next_cursor": "eyJnIjo2MDc2MywibyI6MzB9", "has_more": true }}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | The destination: a city or region name (the first match is used), a geo id (60763 or g60763), or a Tripadvisor link to it. Example: New York City. |
sort_byquery | "BEST_VALUE" | "RANKED" | "PRICE_LOW_TO_HIGH" | "DISTANCE" | Order (default BEST_VALUE). One of BEST_VALUE, RANKED, PRICE_LOW_TO_HIGH, DISTANCE. |
price_minquery | number | null | Lowest nightly price. |
price_maxquery | number | null | Highest nightly price. |
star_rating_minquery | "0" | "1" | "2" | "3" | "4" | "5" | "any" | Minimum hotel class in stars. One of 0, 1, 2, 3, 4, 5, any. |
review_score_minquery | "3" | "4" | "5" | "any" | "3.5" | "4.5" | Minimum traveler rating. One of 3, 4, 5, any, 3.5, 4.5. |
property_typequery | "any" | "hotel" | "resort" | "apartment" | "villa" | "hostel" | "guest_house" | "bed_and_breakfast" | Kind of property. One of any, hotel, resort, apartment, villa, hostel, guest_house, bed_and_breakfast. |
currencyquery | string | Currency for prices (default USD). |
afterquery | string | Cursor: the previous page’s pagination.next_cursor. |
Response fields
200 with a TripadvisorHotelsResponse, in Tripadvisor’s own JSON.
| Field | Type | Description |
|---|---|---|
geo | object | |
results | object[] | |
total | number | null | |
pagination | TripadvisorPagination |
Status codes
| Status | Meaning |
|---|---|
200 | A page of hotels. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No Tripadvisor place or destination like that. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Tripadvisor is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Tripadvisor is a trademark of its owner. We are not affiliated with or endorsed by it.