tripadvisor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTripAdvisor Content API
TripAdvisor Content API
Search and retrieve hotel, restaurant, and attraction data from TripAdvisor. Ratings, rankings, reviews, photos, amenities, subratings, trip types, awards.
Base URL:
https://api.content.tripadvisor.com/api/v1Rate limit: 50 calls per second.
Monthly quota: 5,000 API calls per month. Each curl request = 1 call. A full hotel lookup (search + details + reviews + photos) = 4 calls. Budget accordingly. Prefer search + details (2 calls) and only fetch reviews/photos when specifically needed.
API limits: Up to 10 results per search. Up to 5 reviews and 5 photos per location.
搜索并获取TripAdvisor上的酒店、餐厅和景点数据,包括评分、排名、点评、照片、设施、分项评分、旅行类型及奖项等信息。
Base URL:
https://api.content.tripadvisor.com/api/v1调用频率限制: 每秒最多50次调用。
每月配额: 每月最多5000次API调用。每次curl请求计为1次调用。完整的酒店查询(搜索+详情+点评+照片)共计4次调用。请合理规划调用次数。优先使用搜索+详情(2次调用),仅在特别需要时再获取点评/照片。
API限制: 每次搜索最多返回10条结果。每个地点最多返回5条点评和5张照片。
Authentication
认证
First-time setup gotcha: TripAdvisor requires whitelisting your outbound IP at https://www.tripadvisor.com/developers before the key works. Without this, every call returns. This is the #1 first-time failure mode. Whitelist before troubleshooting auth or quotas.User is not authorized to access this resource with an explicit deny
- How to find your current IP:
curl ifconfig.me- Propagation: changes take 1-5 minutes (AWS edge cache).
- Multi-IP: residential CGNAT, VPN exits, and different networks each need their own entry.
- No Referer alternative: the free tier requires IP whitelisting; HTTP Referer restriction is not available.
- Verify which key is which: the developer portal shows the last 4 chars only (e.g. "Ends in 11D7"), so you can confirm without exposing the secret.
Set in your file:
TRIPADVISOR_API_KEY.envbash
undefined首次设置注意事项: TripAdvisor要求在https://www.tripadvisor.com/developers将你的出站IP加入白名单后,API密钥才能生效。如果未完成此操作,所有调用都会返回`User is not authorized to access this resource with an explicit deny`。这是首次使用时最常见的失败原因。在排查认证或配额问题前,请先完成IP白名单设置。
- 如何查看当前IP:
curl ifconfig.me- 生效时间: 设置变更需要1-5分钟(AWS边缘缓存)。
- 多IP场景: 住宅CGNAT、VPN出口及不同网络的IP都需要单独添加。
- 无Referer替代方案: 免费版必须使用IP白名单;不支持HTTP Referer限制。
- 验证密钥: 开发者门户仅显示密钥最后4位(例如"Ends in 11D7"),无需暴露完整密钥即可确认。
在你的文件中设置:
.envTRIPADVISOR_API_KEYbash
undefinedIn .env (gitignored)
In .env (gitignored)
TRIPADVISOR_API_KEY=your_key_here
Then source it before calling:
```bash
export $(grep TRIPADVISOR_API_KEY .env | xargs)TRIPADVISOR_API_KEY=your_key_here
调用前先加载环境变量:
```bash
export $(grep TRIPADVISOR_API_KEY .env | xargs)Error signatures
错误标识
| Response | Meaning | Fix |
|---|---|---|
| IP not on allowlist | Whitelist current IP at the developer portal, wait 1-5 min |
| Bad or expired key | Regenerate key |
| Hit monthly quota (5,000 calls) | Wait until next month or upgrade tier |
| 响应内容 | 含义 | 解决方法 |
|---|---|---|
| IP未在白名单中 | 在开发者门户添加当前IP,等待1-5分钟生效 |
| 密钥无效或过期 | 重新生成密钥 |
| 达到每月配额(5000次调用) | 等待下月重置或升级套餐 |
Endpoints
接口
1. Location Search
1. 地点搜索
Find locations by name. Returns up to 10 results.
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/search?key=$TRIPADVISOR_API_KEY&searchQuery=NOFO+Hotel+Stockholm&category=hotels&language=en"Parameters:
| Param | Required | Description |
|---|---|---|
| Yes | Text search query (name of hotel, restaurant, city) |
| No | Filter: |
| No | Phone number filter (any format, no leading +) |
| No | Address filter |
| No | Lat/long pair, e.g. |
| No | Radius from latLong (number) |
| No | |
| No | Default |
Response shape:
json
{
"data": [
{
"location_id": "237656",
"name": "Nofo Hotel",
"address_obj": {
"street1": "Tjarhovsgatan 11",
"city": "Stockholm",
"country": "Sweden",
"postalcode": "116 21",
"address_string": "Tjarhovsgatan 11, Stockholm 116 21 Sweden"
}
}
]
}通过名称查找地点,最多返回10条结果。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/search?key=$TRIPADVISOR_API_KEY&searchQuery=NOFO+Hotel+Stockholm&category=hotels&language=en"参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是 | 文本搜索关键词(酒店、餐厅、城市名称) |
| 否 | 筛选类别: |
| 否 | 电话号码筛选(任意格式,无需前置+) |
| 否 | 地址筛选 |
| 否 | 经纬度对,例如 |
| 否 | 基于经纬度的搜索半径(数字) |
| 否 | 单位: |
| 否 | 默认 |
响应格式:
json
{
"data": [
{
"location_id": "237656",
"name": "Nofo Hotel",
"address_obj": {
"street1": "Tjarhovsgatan 11",
"city": "Stockholm",
"country": "Sweden",
"postalcode": "116 21",
"address_string": "Tjarhovsgatan 11, Stockholm 116 21 Sweden"
}
}
]
}2. Location Details
2. 地点详情
Get comprehensive info for a location by ID. This is the richest endpoint.
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/details?key=$TRIPADVISOR_API_KEY&language=en¤cy=USD"Parameters:
| Param | Required | Description |
|---|---|---|
| Yes (path) | TripAdvisor location ID from search |
| No | Default |
| No | ISO 4217 code, default |
Response includes:
- ,
name,web_url,address_obj,latitude,longitude,timezonephone - (string, e.g. "4.6"),
rating(string, e.g. "845")num_reviews - : breakdown by star (
review_rating_count){"1": "7", "2": "10", ...} - :
ranking_data(#10),ranking(168),ranking_out_of("#10 of 168 hotels in Stockholm")ranking_string - : Location, Sleep Quality, Rooms, Service, Value, Cleanliness (each 0.0 to 5.0)
subratings - : "$", "$$", "$$$", "$$$$"
price_level - : array of strings
amenities - : array (e.g. "Family", "Centrally Located")
styles - : array with location_id and name
neighborhood_info - : business, couples, solo, family, friends with count values
trip_types - : Travelers Choice, Best of Best, etc. with year and images
awards - ,
parent_brand: chain affiliationbrand - ,
category: hotel/restaurant/attractionsubcategory - ,
photo_countURLsee_all_photos - URL
write_review
通过地点ID获取全面信息,这是数据最丰富的接口。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/details?key=$TRIPADVISOR_API_KEY&language=en¤cy=USD"参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是(路径参数) | 搜索接口返回的TripAdvisor地点ID |
| 否 | 默认 |
| 否 | ISO 4217货币代码,默认 |
响应包含:
- ,
name,web_url,address_obj,latitude,longitude,timezonephone - (字符串,例如"4.6"),
rating(字符串,例如"845")num_reviews - : 星级评分分布(
review_rating_count){"1": "7", "2": "10", ...} - :
ranking_data(第10名),ranking(共168家),ranking_out_of("斯德哥尔摩168家酒店中排名第10")ranking_string - : 位置、睡眠质量、客房、服务、性价比、清洁度(每项0.0至5.0)
subratings - : "$", "$$", "$$$", "$$$$"
price_level - : 设施字符串数组
amenities - : 风格数组(例如"家庭友好"、"市中心位置")
styles - : 包含location_id和名称的数组
neighborhood_info - : 商务、情侣、单人、家庭、朋友出行的数量统计
trip_types - : 旅行者之选、最佳之最等奖项,包含年份和图片
awards - ,
parent_brand: 连锁品牌归属brand - ,
category: 酒店/餐厅/景点subcategory - ,
photo_count链接see_all_photos - 链接
write_review
3. Location Reviews
3. 地点点评
Get up to 5 most recent reviews.
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/reviews?key=$TRIPADVISOR_API_KEY&language=en"Parameters:
| Param | Required | Description |
|---|---|---|
| Yes (path) | TripAdvisor location ID |
| No | Default |
| No | Number of results (max 5 on free tier) |
| No | Index of first result |
Response shape:
json
{
"data": [
{
"id": 123456,
"lang": "en",
"location_id": "237656",
"published_date": "2026-03-15T00:00:00-04:00",
"rating": 5,
"text": "Review text...",
"title": "Review title",
"trip_type": "Couples",
"travel_date": "2026-03",
"user": { "username": "traveler123" },
"subratings": {}
}
]
}Note: Reviews may return empty for locations with few English reviews. Try different values for international hotels.
data: []language获取最多5条最新点评。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/reviews?key=$TRIPADVISOR_API_KEY&language=en"参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是(路径参数) | TripAdvisor地点ID |
| 否 | 默认 |
| 否 | 结果数量(免费版最多5条) |
| 否 | 起始结果索引 |
响应格式:
json
{
"data": [
{
"id": 123456,
"lang": "en",
"location_id": "237656",
"published_date": "2026-03-15T00:00:00-04:00",
"rating": 5,
"text": "Review text...",
"title": "Review title",
"trip_type": "Couples",
"travel_date": "2026-03",
"user": { "username": "traveler123" },
"subratings": {}
}
]
}注意: 对于英文点评较少的地点,可能返回空数组。针对国际酒店可尝试更换参数。
data: []language4. Location Photos
4. 地点照片
Get up to 5 recent photos with multiple size options.
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/photos?key=$TRIPADVISOR_API_KEY&language=en"Parameters:
| Param | Required | Description |
|---|---|---|
| Yes (path) | TripAdvisor location ID |
| No | Default |
| No | Number of results (max 5 on free tier) |
| No | Index of first result |
| No | Comma-separated: |
Photo sizes in response:
- : 50x50 cropped
thumbnail - : 150x150 cropped
small - : max 250px dimension
medium - : max 550px dimension
large - : full resolution
original
获取最多5张最新照片,提供多种尺寸选项。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/photos?key=$TRIPADVISOR_API_KEY&language=en"参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是(路径参数) | TripAdvisor地点ID |
| 否 | 默认 |
| 否 | 结果数量(免费版最多5条) |
| 否 | 起始结果索引 |
| 否 | 逗号分隔的来源: |
响应中的照片尺寸:
- : 50x50 裁剪图
thumbnail - : 150x150 裁剪图
small - : 最大250px尺寸
medium - : 最大550px尺寸
large - : 原始分辨率
original
5. Nearby Location Search
5. 周边地点搜索
Find locations near coordinates. Returns up to 10.
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/nearby_search?key=$TRIPADVISOR_API_KEY&latLong=59.3127,18.0716&category=hotels&language=en"Parameters:
| Param | Required | Description |
|---|---|---|
| Yes | Lat/long pair, e.g. |
| No | |
| No | Phone number filter |
| No | Address filter |
| No | Radius from latLong |
| No | |
| No | Default |
Response includes (km) and (e.g. "northwest") for each result.
distancebearing根据坐标查找周边地点,最多返回10条结果。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/nearby_search?key=$TRIPADVISOR_API_KEY&latLong=59.3127,18.0716&category=hotels&language=en"参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是 | 经纬度对,例如 |
| 否 | |
| 否 | 电话号码筛选 |
| 否 | 地址筛选 |
| 否 | 基于经纬度的搜索半径 |
| 否 | |
| 否 | 默认 |
响应包含每个结果的(公里)和(例如"northwest")信息。
distancebearingCommon Workflows
常见工作流
Hotel Research (most common)
酒店调研(最常用)
bash
undefinedbash
undefined1. Search for hotel
1. 搜索酒店
curl -s "https://api.content.tripadvisor.com/api/v1/location/search?key=$TRIPADVISOR_API_KEY&searchQuery=Amerikalinjen+Oslo&category=hotels" | python3 -m json.tool
curl -s "https://api.content.tripadvisor.com/api/v1/location/search?key=$TRIPADVISOR_API_KEY&searchQuery=Amerikalinjen+Oslo&category=hotels" | python3 -m json.tool
2. Get details with location_id from step 1
2. 使用步骤1获取的location_id获取详情
curl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/details?key=$TRIPADVISOR_API_KEY¤cy=USD" | python3 -m json.tool
curl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/details?key=$TRIPADVISOR_API_KEY¤cy=USD" | python3 -m json.tool
3. Get reviews (optional, costs 1 call)
3. 获取点评(可选,消耗1次调用)
curl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/reviews?key=$TRIPADVISOR_API_KEY" | python3 -m json.tool
curl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/reviews?key=$TRIPADVISOR_API_KEY" | python3 -m json.tool
4. Get photos (optional, costs 1 call)
4. 获取照片(可选,消耗1次调用)
curl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/photos?key=$TRIPADVISOR_API_KEY" | python3 -m json.tool
undefinedcurl -s "https://api.content.tripadvisor.com/api/v1/location/1234567/photos?key=$TRIPADVISOR_API_KEY" | python3 -m json.tool
undefinedCompare Multiple Hotels in a City
对比同一城市的多家酒店
bash
undefinedbash
undefinedSearch all hotels in city
搜索城市内所有酒店
Then get details for each location_id returned
然后为每个返回的location_id获取详情
Compare: rating, num_reviews, ranking_data.ranking, subratings, price_level, amenities
对比维度:评分、点评数量、ranking_data.ranking、分项评分、价格等级、设施
undefinedundefinedFind Restaurants Near Hotel
查找酒店周边餐厅
bash
undefinedbash
undefinedUse hotel's lat/long from details response
使用酒店详情响应中的经纬度
undefinedDestination Research
目的地调研
bash
undefinedbash
undefinedSearch for attractions
搜索景点
Nearby attractions from a point
查找指定地点周边的景点
undefinedWhen to Use
适用场景
- Evaluating hotels (ratings, rankings, subratings, review sentiment)
- Comparing restaurants near a hotel or in a neighborhood
- Finding attractions and things to do near a destination
- Getting TripAdvisor ranking data ("#1 of 168 hotels in Stockholm")
- Checking amenities, trip type breakdown, award status
- Verifying hotel chain affiliation and neighborhood info
- 评估酒店(评分、排名、分项评分、点评情感)
- 对比酒店或周边街区的餐厅
- 查找目的地周边的景点和活动
- 获取TripAdvisor排名数据(例如"斯德哥尔摩168家酒店中排名第10")
- 查看设施、旅行类型分布、获奖情况
- 验证酒店连锁品牌归属及周边信息
When NOT to Use
不适用场景
- Pricing or availability. TripAdvisor Content API has no pricing data. Use ,
serpapi,liteapi,chase-travel, oramex-travelfor prices.rapidapi - Booking. This is read-only data. No booking capability.
- Bulk scraping. 5,000 calls/month. Be deliberate.
- 价格或可用性查询: TripAdvisor Content API不提供价格数据。如需价格信息,请使用,
serpapi,liteapi,chase-travel或amex-travel。rapidapi - 预订功能: 仅提供只读数据,无预订能力。
- 批量爬取: 每月仅5000次调用,请谨慎使用。
Key Data Points for Hotel Comparison
酒店对比关键数据点
When comparing hotels, extract and present:
| Field | Path | Example |
|---|---|---|
| Rating | | "4.6" |
| Review count | | "845" |
| Ranking | | "#10 of 168 hotels in Stockholm" |
| Location subrating | | "4.7" |
| Service subrating | | "4.7" |
| Cleanliness subrating | | "4.8" |
| Price level | | "$$$$" |
| Trip type leader | highest | "Couples: 381" |
| Awards | | "Travelers Choice 2025" |
| Breakfast | | Yes/No |
| Chain | | "Worldhotels" |
对比酒店时,可提取并展示以下数据:
| 字段 | 路径 | 示例 |
|---|---|---|
| 评分 | | "4.6" |
| 点评数量 | | "845" |
| 排名 | | "斯德哥尔摩168家酒店中排名第10" |
| 位置分项评分 | | "4.7" |
| 服务分项评分 | | "4.7" |
| 清洁度分项评分 | | "4.8" |
| 价格等级 | | "$$$$" |
| 主要旅行类型 | | "情侣: 381" |
| 奖项 | | "2025年旅行者之选" |
| 早餐 | | 是/否 |
| 连锁品牌 | | "Worldhotels" |
Supported Languages
支持语言
arzhzh_TWdanlenen_AUen_CAen_HKen_INen_IEen_MYen_NZen_PHen_SGen_ZAen_UKfrfr_BEfr_CAfr_CHdede_ATeliwitit_CHjakonoptpt_PTrueses_ARes_COes_MXes_PEes_VEes_CLsvthtrviUse for Danish, for Norwegian, for Swedish when searching Scandinavian hotels for local-language reviews.
danosvarzhzh_TWdanlenen_AUen_CAen_HKen_INen_IEen_MYen_NZen_PHen_SGen_ZAen_UKfrfr_BEfr_CAfr_CHdede_ATeliwitit_CHjakonoptpt_PTrueses_ARes_COes_MXes_PEes_VEes_CLsvthtrvi搜索斯堪的纳维亚酒店时,使用(丹麦语)、(挪威语)、(瑞典语)可获取当地语言点评。
danosv