tripadvisor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TripAdvisor 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/v1
Rate 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
User is not authorized to access this resource with an explicit deny
. This is the #1 first-time failure mode. Whitelist before troubleshooting auth or quotas.
  • 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
TRIPADVISOR_API_KEY
in your
.env
file:
bash
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"),无需暴露完整密钥即可确认。
在你的
.env
文件中设置
TRIPADVISOR_API_KEY
:
bash
undefined

In .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

错误标识

ResponseMeaningFix
User is not authorized to access this resource with an explicit deny
IP not on allowlistWhitelist current IP at the developer portal, wait 1-5 min
Forbidden
/ 403 with no body
Bad or expired keyRegenerate key
429 Too Many Requests
Hit monthly quota (5,000 calls)Wait until next month or upgrade tier
响应内容含义解决方法
User is not authorized to access this resource with an explicit deny
IP未在白名单中在开发者门户添加当前IP,等待1-5分钟生效
Forbidden
/ 无响应体的403错误
密钥无效或过期重新生成密钥
429 Too Many Requests
达到每月配额(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:
ParamRequiredDescription
searchQuery
YesText search query (name of hotel, restaurant, city)
category
NoFilter:
hotels
,
restaurants
,
attractions
,
geos
phone
NoPhone number filter (any format, no leading +)
address
NoAddress filter
latLong
NoLat/long pair, e.g.
59.3127,18.0716
radius
NoRadius from latLong (number)
radiusUnit
No
km
,
mi
, or
m
language
NoDefault
en
. Supports 40+ languages.
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"
参数:
参数是否必填说明
searchQuery
文本搜索关键词(酒店、餐厅、城市名称)
category
筛选类别:
hotels
,
restaurants
,
attractions
,
geos
phone
电话号码筛选(任意格式,无需前置+)
address
地址筛选
latLong
经纬度对,例如
59.3127,18.0716
radius
基于经纬度的搜索半径(数字)
radiusUnit
单位:
km
,
mi
, 或
m
language
默认
en
,支持40+种语言。
响应格式:
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&currency=USD"
Parameters:
ParamRequiredDescription
locationId
Yes (path)TripAdvisor location ID from search
language
NoDefault
en
currency
NoISO 4217 code, default
USD
Response includes:
  • name
    ,
    web_url
    ,
    address_obj
    ,
    latitude
    ,
    longitude
    ,
    timezone
    ,
    phone
  • rating
    (string, e.g. "4.6"),
    num_reviews
    (string, e.g. "845")
  • review_rating_count
    : breakdown by star (
    {"1": "7", "2": "10", ...}
    )
  • ranking_data
    :
    ranking
    (#10),
    ranking_out_of
    (168),
    ranking_string
    ("#10 of 168 hotels in Stockholm")
  • subratings
    : Location, Sleep Quality, Rooms, Service, Value, Cleanliness (each 0.0 to 5.0)
  • price_level
    : "$", "$$", "$$$", "$$$$"
  • amenities
    : array of strings
  • styles
    : array (e.g. "Family", "Centrally Located")
  • neighborhood_info
    : array with location_id and name
  • trip_types
    : business, couples, solo, family, friends with count values
  • awards
    : Travelers Choice, Best of Best, etc. with year and images
  • parent_brand
    ,
    brand
    : chain affiliation
  • category
    ,
    subcategory
    : hotel/restaurant/attraction
  • photo_count
    ,
    see_all_photos
    URL
  • write_review
    URL
通过地点ID获取全面信息,这是数据最丰富的接口。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/details?key=$TRIPADVISOR_API_KEY&language=en&currency=USD"
参数:
参数是否必填说明
locationId
是(路径参数)搜索接口返回的TripAdvisor地点ID
language
默认
en
currency
ISO 4217货币代码,默认
USD
响应包含:
  • name
    ,
    web_url
    ,
    address_obj
    ,
    latitude
    ,
    longitude
    ,
    timezone
    ,
    phone
  • rating
    (字符串,例如"4.6"),
    num_reviews
    (字符串,例如"845")
  • review_rating_count
    : 星级评分分布(
    {"1": "7", "2": "10", ...}
  • ranking_data
    :
    ranking
    (第10名),
    ranking_out_of
    (共168家),
    ranking_string
    ("斯德哥尔摩168家酒店中排名第10")
  • subratings
    : 位置、睡眠质量、客房、服务、性价比、清洁度(每项0.0至5.0)
  • price_level
    : "$", "$$", "$$$", "$$$$"
  • amenities
    : 设施字符串数组
  • styles
    : 风格数组(例如"家庭友好"、"市中心位置")
  • neighborhood_info
    : 包含location_id和名称的数组
  • 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:
ParamRequiredDescription
locationId
Yes (path)TripAdvisor location ID
language
NoDefault
en
limit
NoNumber of results (max 5 on free tier)
offset
NoIndex 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
data: []
for locations with few English reviews. Try different
language
values for international hotels.
获取最多5条最新点评。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/reviews?key=$TRIPADVISOR_API_KEY&language=en"
参数:
参数是否必填说明
locationId
是(路径参数)TripAdvisor地点ID
language
默认
en
limit
结果数量(免费版最多5条)
offset
起始结果索引
响应格式:
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: []
。针对国际酒店可尝试更换
language
参数。

4. 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:
ParamRequiredDescription
locationId
Yes (path)TripAdvisor location ID
language
NoDefault
en
limit
NoNumber of results (max 5 on free tier)
offset
NoIndex of first result
source
NoComma-separated:
Expert
,
Management
,
Traveler
Photo sizes in response:
  • thumbnail
    : 50x50 cropped
  • small
    : 150x150 cropped
  • medium
    : max 250px dimension
  • large
    : max 550px dimension
  • original
    : full resolution
获取最多5张最新照片,提供多种尺寸选项。
bash
curl -s "https://api.content.tripadvisor.com/api/v1/location/{locationId}/photos?key=$TRIPADVISOR_API_KEY&language=en"
参数:
参数是否必填说明
locationId
是(路径参数)TripAdvisor地点ID
language
默认
en
limit
结果数量(免费版最多5条)
offset
起始结果索引
source
逗号分隔的来源:
Expert
,
Management
,
Traveler
响应中的照片尺寸:
  • thumbnail
    : 50x50 裁剪图
  • small
    : 150x150 裁剪图
  • medium
    : 最大250px尺寸
  • large
    : 最大550px尺寸
  • 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:
ParamRequiredDescription
latLong
YesLat/long pair, e.g.
59.3127,18.0716
category
No
hotels
,
restaurants
,
attractions
,
geos
phone
NoPhone number filter
address
NoAddress filter
radius
NoRadius from latLong
radiusUnit
No
km
,
mi
,
m
language
NoDefault
en
Response includes
distance
(km) and
bearing
(e.g. "northwest") for each result.
根据坐标查找周边地点,最多返回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"
参数:
参数是否必填说明
latLong
经纬度对,例如
59.3127,18.0716
category
hotels
,
restaurants
,
attractions
,
geos
phone
电话号码筛选
address
地址筛选
radius
基于经纬度的搜索半径
radiusUnit
km
,
mi
,
m
language
默认
en
响应包含每个结果的
distance
(公里)和
bearing
(例如"northwest")信息。

Common Workflows

常见工作流

Hotel Research (most common)

酒店调研(最常用)

bash
undefined
bash
undefined

1. Search for hotel

1. 搜索酒店

2. Get details with location_id from step 1

2. 使用步骤1获取的location_id获取详情

3. Get reviews (optional, costs 1 call)

3. 获取点评(可选,消耗1次调用)

4. Get photos (optional, costs 1 call)

4. 获取照片(可选,消耗1次调用)

Compare Multiple Hotels in a City

对比同一城市的多家酒店

bash
undefined
bash
undefined

Search 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、分项评分、价格等级、设施

undefined
undefined

Find Restaurants Near Hotel

查找酒店周边餐厅

bash
undefined
bash
undefined

Use hotel's lat/long from details response

使用酒店详情响应中的经纬度

Destination Research

目的地调研

bash
undefined
bash
undefined

Search for attractions

搜索景点

Nearby attractions from a point

查找指定地点周边的景点

When 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
    ,
    amex-travel
    , or
    rapidapi
    for prices.
  • 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:
FieldPathExample
Rating
rating
"4.6"
Review count
num_reviews
"845"
Ranking
ranking_data.ranking_string
"#10 of 168 hotels in Stockholm"
Location subrating
subratings.0.value
"4.7"
Service subrating
subratings.3.value
"4.7"
Cleanliness subrating
subratings.5.value
"4.8"
Price level
price_level
"$$$$"
Trip type leaderhighest
trip_types[].value
"Couples: 381"
Awards
awards[].display_name
"Travelers Choice 2025"
Breakfast
amenities
contains "Breakfast included"
Yes/No
Chain
parent_brand
"Worldhotels"
对比酒店时,可提取并展示以下数据:
字段路径示例
评分
rating
"4.6"
点评数量
num_reviews
"845"
排名
ranking_data.ranking_string
"斯德哥尔摩168家酒店中排名第10"
位置分项评分
subratings.0.value
"4.7"
服务分项评分
subratings.3.value
"4.7"
清洁度分项评分
subratings.5.value
"4.8"
价格等级
price_level
"$$$$"
主要旅行类型
trip_types[].value
最高项
"情侣: 381"
奖项
awards[].display_name
"2025年旅行者之选"
早餐
amenities
包含"Breakfast included"
是/否
连锁品牌
parent_brand
"Worldhotels"

Supported Languages

支持语言

ar
,
zh
,
zh_TW
,
da
,
nl
,
en
,
en_AU
,
en_CA
,
en_HK
,
en_IN
,
en_IE
,
en_MY
,
en_NZ
,
en_PH
,
en_SG
,
en_ZA
,
en_UK
,
fr
,
fr_BE
,
fr_CA
,
fr_CH
,
de
,
de_AT
,
el
,
iw
,
it
,
it_CH
,
ja
,
ko
,
no
,
pt
,
pt_PT
,
ru
,
es
,
es_AR
,
es_CO
,
es_MX
,
es_PE
,
es_VE
,
es_CL
,
sv
,
th
,
tr
,
vi
Use
da
for Danish,
no
for Norwegian,
sv
for Swedish when searching Scandinavian hotels for local-language reviews.
ar
,
zh
,
zh_TW
,
da
,
nl
,
en
,
en_AU
,
en_CA
,
en_HK
,
en_IN
,
en_IE
,
en_MY
,
en_NZ
,
en_PH
,
en_SG
,
en_ZA
,
en_UK
,
fr
,
fr_BE
,
fr_CA
,
fr_CH
,
de
,
de_AT
,
el
,
iw
,
it
,
it_CH
,
ja
,
ko
,
no
,
pt
,
pt_PT
,
ru
,
es
,
es_AR
,
es_CO
,
es_MX
,
es_PE
,
es_VE
,
es_CL
,
sv
,
th
,
tr
,
vi
搜索斯堪的纳维亚酒店时,使用
da
(丹麦语)、
no
(挪威语)、
sv
(瑞典语)可获取当地语言点评。