遇见数据集

Google Flights Search and Explore

收藏
RapidAPI2026-08-14 更新2026-08-15 收录
官方服务:

资源简介:

Search flight itineraries, compare fare calendars, and explore destinations with flexible dates.

创建时间:
2026-08-14
原始信息汇总

Google Flights Search and Explore API 总结

该API是一个非官方的Google Flights数据接口,提供航班搜索、票价日历比较和目的地探索功能,通过结构化JSON返回价格、路线、航空公司、经停、时长、碳排放及可选预订信息。


核心功能

  • 搜索航班:支持单程、往返和多城市(2至5段)行程搜索。
  • 比较票价日历:通过日历模式(Graph, Grid, Picker)灵活比较日期价格。
  • 探索目的地:根据出发地、出行时长和月份,发现灵活日期下的旅行目的地。

使用要点

  • 每个请求执行一种操作(Search、Calendar或Explore)。
  • API有110秒处理预算;搜索无maxResults输入,可用showAllResults: true获取更广结果。
  • 价格和可用性可能变动,最终价格以结账时为准。
  • 机场使用三字母IATA代码(自动转大写,不修剪空格)。
  • 日期必须为真实的YYYY-MM-DD格式,搜索和日历拒绝过去的出发日期。
  • 乘客总数不超过9人,每位婴儿需对应一名成人。
  • 未知请求属性会被拒绝;fields选择器接受未知字段但忽略。
  • 所有成功POST调用返回HTTP 201。

输入参数(Search示例)

字段 类型 默认 限制/规则
origin string 必填 三字母IATA代码;多城市不用
destination string 必填 origin不同
departureDate string 必填 真实当前或未来日期
returnDate string 不早于出发日期
tripType string 推断 one-way, round-trip, multi-city
searches array 多城市必填 2至5个有序航段
cabinClass string economy economy, premium-economy, business, first
currency string USD 支持71种货币代码
adults integer 1 1-9
children integer 0 0-9
infantsOnLap integer 0 0-9;不超过adults
infantsInSeat integer 0 0-9
maxStops integer 任意 0, 1, 2
maxPrice integer 正数最大总价
maxDuration integer 每个航段最大时长(分钟)
airlines string[] 至多20个航空公司代码或联盟
departureTimeEarliest string 本地小时或HH:MM
departureTimeLatest string 本地小时或HH:MM
arrivalTimeEarliest string 本地小时或HH:MM
arrivalTimeLatest string 本地小时或HH:MM
sortBy string best best, cheapest, fastest, departure-time, arrival-time
showAllResults boolean false 请求更广结果集
includeBookingDetails boolean false 添加供应商和交接数据
fields string[] 所有结果字段 顶层字段或["*"]

输出示例(Search响应结构)

json { "data": { "results": [ { "origin": "SFO", "destination": "LAX", "departureDate": "2026-10-24", "returnDate": null, "tripType": "one-way", "cabinClass": "economy", "price": 129, "currency": "USD", "pricePerPassenger": null, "totalDuration": 96, "stops": 0, "airlines": ["Example Air"], "airlineCodes": ["EA"], "outbound": { "duration": 96, "stops": 0, "segments": [ { "airline": "Example Air", "airlineCode": "EA", "flightNumber": "EA100", "aircraft": "Example aircraft", "departureAirport": "SFO", "arrivalAirport": "LAX", "departureTime": "2026-10-24T08:00:00-07:00", "arrivalTime": "2026-10-24T09:36:00-07:00", "duration": 96, "layover": null } ] }, "return": null, "co2Emissions": 59600, "co2EmissionsLabel": null, "fareClass": null, "bookingDetails": null } ], "count": 1 }, "meta": { "tool": "google-flights-search", "creditsUsed": 2, "requestId": "req_example" } }


票价日历(Calendar)

  • 三种模式
    • graph:检查向前单程窗口,默认61天。
    • grid:围绕departureDate的窗口,默认7天,必须为奇数。
    • picker:比较固定时长往返日期对,默认61对。
  • 支持与Search类似的筛选输入(舱位、货币、乘客、经停、价格、时长、航空公司、时间)。
  • 成功响应示例包含prices数组,每项为日期和价格。

探索目的地(Explore)

  • 输入:origin(必填),tripDurationweekend, 1-week, 2-weeks),monthnext-6-months或具体月份名)。
  • 输出结果包含目的地ID、城市、国家、机场、出发/返回日期、价格、最便宜价格、航空公司等字段。

错误与响应头

  • 成功响应包含头:X-Request-Cost, X-Remaining-Credits, X-Request-Id
  • 错误使用application/problem+json格式,包含type, status, code, message, requestId, docUrl, retryable
  • 常见HTTP状态:
    • 400:无效输入
    • 401:无有效API密钥
    • 402:无有效订阅
    • 429:速率限制
    • 502:上游拒绝或响应变化
    • 503:无健康代理
    • 504:110秒预算过期

与Actor的差异(不适用于API用户)

API与底层Actor在请求处理、输出格式、输入验证等方面有显著不同,API用户不应使用Actor专属字段(如proxyConfiguration, includeCalendarPrices等)。


非官方服务声明

该服务为非官方服务,与Google无关联或背书。票价、航班、机场、排放等数据可能变化,购买前请与航空公司或供应商核实。

二维码
社区交流群
二维码
科研交流群
商业服务