departure_idstring必填
origin airport/location code
https://api.sandbase.ai/v1/api/google-flights/searchGoogle Flights itineraries for a route and date: airlines, times, stops, durations, prices and price insights.
您的输出将显示在这里
完成输入,然后点击运行。
Returns Google Flights itineraries for one route and date. Each itinerary lists the flight legs, layovers, total duration, price and carbon emissions. You send an origin code, a destination code and an outbound date.
CDG) to Austin (AUS) on a given day.curl -X POST "https://api.sandbase.ai/v1/api/google-flights/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"departure_id": "CDG", "arrival_id": "AUS", "outbound_date": "2026-12-15", "type": "2"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
arrival_id | string | Yes | destination airport/location code |
departure_id | string | Yes | origin airport/location code |
outbound_date | string | Yes | YYYY-MM-DD |
currency | string | No | currency |
return_date | string | No | YYYY-MM-DD, required when type=1 |
type | string | No | 1 round trip (default) / 2 one way / 3 multi-city |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"airports": [
{
"arrival": [
{
"airport": {
"id": "AUS",
"name": "Austin-Bergstrom International Airport"
},
"city": "Austin",
"country": "United States",
"country_code": "US",
"image": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRKdjkMcBZuGRD1MjnuLQvdGtpT…",
"thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSQ73FSj9E8pKaNvjWKyEDQGfLV…"
}
],
"departure": [
{
"airport": {
"id": "CDG",
"name": "Aéroport de Paris-Charles de Gaulle"
},
"city": "Paris",
"country": "France",
"country_code": "FR",
"image": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQGx8ii2KbSDdbdzfKye5oDN2bw…",
"thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSyQJ-woNs0iO22mPSkmRUM5gcs…"
}
]
}
],
"best_flights": [
{
"airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/DL.png",
"booking_token": "WyJDalJJ…",
"carbon_emissions": {
"difference_percent": 16,
"this_flight": 598000,
"typical_for_this_route": 517000
},
"extensions": [
"Checked baggage for a fee"
],
"flights": [
{
"airline": "Delta",
"airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/DL.png",
"airplane": "Airbus A330",
"arrival_airport": {
"id": "MSP",
"name": "Minneapolis-Saint Paul International Airport",
"time": "2026-12-15 13:10"
},
"departure_airport": {
"id": "CDG",
"name": "Aéroport de Paris-Charles de Gaulle",
"time": "2026-12-15 10:30"
},
"duration": 580,
"extensions": [
"Average legroom (31 in)"
],
"flight_number": "DL 153"
}
],
"layovers": [
{
"duration": 95,
"id": "MSP",
"name": "Minneapolis-Saint Paul International Airport"
}
],
"price": 949,
"total_duration": 847,
"type": "One way"
}
],
"other_flights": [
{
"airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
"booking_token": "WyJDalJJ…",
"carbon_emissions": {
"difference_percent": 38,
"this_flight": 712000,
"typical_for_this_route": 517000
},
"extensions": [
"1 checked bag up to 23 kg included"
],
"flights": [
{
"airline": "Air Tahiti Nui",
"airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/TN.png",
"airplane": "Boeing 787",
"arrival_airport": {
"id": "LAX",
"name": "Los Angeles International Airport",
"time": "2026-12-15 14:00"
},
"departure_airport": {
"id": "CDG",
"name": "Aéroport de Paris-Charles de Gaulle",
"time": "2026-12-15 11:35"
},
"duration": 685,
"extensions": [
"Average legroom (31 in)"
],
"flight_number": "TN 7"
}
],
"layovers": [
{
"duration": 288,
"id": "LAX",
"name": "Los Angeles International Airport"
}
],
"price": 766,
"total_duration": 1156,
"type": "One way"
}
],
"price_insights": {
"lowest_price": 766,
"price_history": [
[
1788386400
]
],
"price_level": "typical",
"typical_price_range": [
630
]
}
}
| Field | Meaning |
|---|---|
best_flights[] / other_flights[] | Lists of itineraries. best_flights holds the top-ranked options and other_flights holds the rest. Both use the same structure. |
best_flights[].price | Total fare for the itinerary as a number. The response does not show the currency, so set currency in the request if you need a specific one. |
best_flights[].total_duration | Total travel time of the itinerary, including layovers. The 847 value for a trip with 580 and 172 minute legs and a 95 minute layover suggests minutes. |
best_flights[].flights[] | The individual legs of the itinerary, in order. A one-stop itinerary has two legs. |
best_flights[].flights[].departure_airport.id / best_flights[].flights[].arrival_airport.id | Airport code for the start and end of a leg. Each object also has name and time in YYYY-MM-DD HH:MM format. |
best_flights[].flights[].airline / best_flights[].flights[].flight_number / best_flights[].flights[].airplane | Operating airline, flight number such as DL 153, and aircraft type for the leg. |
best_flights[].flights[].duration | Duration of a single leg. Values like 580 and 172 are consistent with minutes. |
best_flights[].layovers[] | One entry per connection, with the airport id, name and layover duration. |
best_flights[].carbon_emissions.this_flight / best_flights[].carbon_emissions.typical_for_this_route / best_flights[].carbon_emissions.difference_percent | Emissions for this itinerary, the typical value for the route, and the percent difference between them. Negative values mean lower than typical. |
best_flights[].booking_token | Token string for the itinerary. Keep it if you need to refer to a specific option later. |
CDG and AUS for departure_id and arrival_id.type is 1 for round trip (default), 2 for one way or 3 for multi-city. return_date is required when type is 1.YYYY-MM-DD HH:MM format. A leg can arrive on the next date, as the Istanbul connection shows.airports array describes the departure and arrival airports with city, country and country code.$0.015 per successful call. Failed calls are not charged.
开始构建
具备统一身份验证和使用情况跟踪的平台 API 端点。
curl -X POST "https://api.sandbase.ai/v1/api/google-flights/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "2",
"arrival_id": "AUS",
"departure_id": "CDG",
"outbound_date": "2026-12-15"
}'将您的 SandBase API 密钥设置到服务器环境中。请求使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它。
departure_idstring必填origin airport/location code
arrival_idstring必填destination airport/location code
outbound_datestring必填YYYY-MM-DD
typestring1 round trip (default) | 2 one way | 3 multi-city
return_datestringYYYY-MM-DD, required when type=1
currencystringcurrency
这是该 API 保存的示例响应;查看时不会发起实时请求。
尚未发布已保存的响应。请在 Playground 中运行 API 以查看其响应。
探索更多
| API | 价格 | 响应 |
|---|---|---|
Google Flights | $0.015 每次调用 | JSON |
Google Flights | $0.01 每次调用 | JSON |
Google Flights | $0.01 每次调用 | JSON |
Google Flights | $0.01 每次调用 | JSON |
问题
向 https://api.sandbase.ai/v1/api/google-flights/search 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。
每次调用 $0.015,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。
必填:departure_id (string), arrival_id (string) 和 outbound_date (string)。 可选:type (string), return_date (string) 和 currency (string)。 Parameters 表和本页的 Playground 列出了每个字段。
在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。
不需要。Google Flights Search 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Google Flights API 访问权限。