POST/v1/flights/search
API 控制台
试一试
向沙箱 API 发送真实请求并查看响应。
凭证
登录后即可从已保存的 API 密钥中选择,无需手动粘贴。
请求体
cURL 请求
bash
curl -X POST 'https://api.sandbox.travelandz.com/v1/flights/search' \
-H 'Authorization: Bearer YOUR_SECRET_KEY' \
-H 'X-Travelandz-Id: YOUR_PUBLIC_KEY:YOUR_PROFILE_CODE' \
-H 'Content-Type: application/json' \
-d '{"slices":[{"origin":"MAD","destination":"BCN","departure_date":"2026-08-20"}],"passengers":[{"type":"adult"}],"cabin_class":"economy","currency":"EUR","language":"es"}'请填写凭证以发送请求。
响应
点击「试一试!」发送请求,响应将显示在此处。
搜索当前可用的航班库存来源,并返回已标准化的报价、开发者最终价格、供应方元数据和可选预订链接。
接口
| 方法 | 路径 | 认证 |
|---|---|---|
POST | /v1/flights/search | 需要 API key |
| Header | 说明 |
|---|---|
Authorization | Bearer <secret_key>. The secret is shown only once when the credential is created. |
X-Travelandz-Id | <public_key>:<profile_code>. The profile_code is the dp_-prefixed Developer Profile code shown in your dashboard. This binds the request to a profile and credential. |
Content-Type | Use application/json for requests with a body. |
Request Parameters
不需要路径参数或查询参数。
请求体结构
slicesslices[]originIATA code of the origin airport or city
slices[]destinationIATA code of the destination airport or city
slices[]departure_dateMust not be in the past
passengerspassengers[]typecabin_classcurrencyDefault EUR
languageOptional language for translated metadata when available
成功响应
返回 offers[] with normalized provider metadata, pricing, passenger requirements, slices and segments.
响应体结构
offersoffers[]offerIdoffers[]gdsprovideroffers[]expiresAtoffers[]totalAmountoffers[]holdOptionsoffers[]holdOptionsavailableoffers[]holdOptionspaymentRequiredByoffers[]holdOptionspriceGuarantedUntiloffers[]supportedPassengerIdDocumentsoffers[]supportedPassengerIdDocuments[]offers[]passengerIdentityDocumentsRequiredoffers[]supportedLoyaltyProgramsoffers[]supportedLoyaltyPrograms[]offers[]airlineoffers[]airlinenameoffers[]airlineiataCodeoffers[]airlinelogoURLoffers[]airlineconditionsOfCarriageoffers[]passengersoffers[]passengers[]idPublic passenger id to reuse during booking. Mystifly public offers generate internal ids such as
mystifly_pax_1.offers[]passengers[]typeoffers[]conditionsoffers[]conditionsrefundBeforeDepartureoffers[]conditionsrefundBeforeDeparturecurrencyoffers[]conditionsrefundBeforeDeparturepenaltyAmountoffers[]conditionsrefundBeforeDepartureallowedoffers[]conditionschangeBeforeDepartureoffers[]conditionschangeBeforeDeparturecurrencyoffers[]conditionschangeBeforeDeparturepenaltyAmountoffers[]conditionschangeBeforeDepartureallowedoffers[]slicesoffers[]slices[]fareNameoffers[]slices[]departureoffers[]slices[]departureiataCodeoffers[]slices[]departurecityNameoffers[]slices[]departureairportNameoffers[]slices[]departuredepartingAtoffers[]slices[]departuretimeZoneoffers[]slices[]arrivaloffers[]slices[]arrivaliataCodeoffers[]slices[]arrivalcityNameoffers[]slices[]arrivalairportNameoffers[]slices[]arrivalarrivingAtoffers[]slices[]arrivaltimeZoneoffers[]slices[]durationMinutesoffers[]slices[]conditionsoffers[]slices[]conditionspriorityCheckInoffers[]slices[]conditionspriorityBoardingoffers[]slices[]conditionsadvanceSeatSelectionoffers[]slices[]segmentsoffers[]slices[]segments[]fareNameoffers[]slices[]segments[]departureoffers[]slices[]segments[]departureiataCodeoffers[]slices[]segments[]departurecityNameoffers[]slices[]segments[]departureairportNameoffers[]slices[]segments[]departuredepartingAtoffers[]slices[]segments[]departuretimeZoneoffers[]slices[]segments[]departureterminaloffers[]slices[]segments[]arrivaloffers[]slices[]segments[]arrivaliataCodeoffers[]slices[]segments[]arrivalcityNameoffers[]slices[]segments[]arrivalairportNameoffers[]slices[]segments[]arrivalarrivingAtoffers[]slices[]segments[]arrivaltimeZoneoffers[]slices[]segments[]arrivalterminaloffers[]slices[]segments[]airlineoffers[]slices[]segments[]airlineoperatingCarrieroffers[]slices[]segments[]airlineoperatingCarriernameoffers[]slices[]segments[]airlineoperatingCarrieriataCodeoffers[]slices[]segments[]airlineoperatingCarrierlogoURLoffers[]slices[]segments[]airlineoperatingCarrierconditionsOfCarriageoffers[]slices[]segments[]airlinemarketingCarrieroffers[]slices[]segments[]airlinemarketingCarriernameoffers[]slices[]segments[]airlinemarketingCarrieriataCodeoffers[]slices[]segments[]airlinemarketingCarrierlogoURLoffers[]slices[]segments[]airlinemarketingCarrierconditionsOfCarriageoffers[]slices[]segments[]flightNumberoffers[]slices[]segments[]durationMinutesoffers[]slices[]segments[]passengersoffers[]slices[]segments[]passengers[]amenitiesoffers[]slices[]segments[]passengers[]amenitieswifioffers[]slices[]segments[]passengers[]amenitieswificostoffers[]slices[]segments[]passengers[]amenitieswifiavailableoffers[]slices[]segments[]passengers[]amenitiesseatoffers[]slices[]segments[]passengers[]amenitiesseatpitchoffers[]slices[]segments[]passengers[]amenitiesseatlegroomoffers[]slices[]segments[]passengers[]amenitiesseattypeoffers[]slices[]segments[]passengers[]amenitiespoweroffers[]slices[]segments[]passengers[]baggagesoffers[]slices[]segments[]passengers[]baggages[]typeoffers[]slices[]segments[]passengers[]baggages[]quantityoffers[]slices[]segments[]passengers[]baggages[]maxKgoffers[]CO2EmissionsKgoffers[]holdIdoffers[]originalCurrencyoffers[]currencyliveModeTrue when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.
集成说明
- Send one
slices[]item for one-way trips and two items for round trips. passengers[]must include at least one adult.- Store the selected offer payload. Some booking flows require
totalSegmentsbuilt fromoffer.slices[].segments[].
示例
bash
curl -X POST https://api.sandbox.travelandz.com/v1/flights/search \
-H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
-H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
-H "Content-Type: application/json" \
-d '{"slices":[{"origin":"MAD","destination":"BCN","departure_date":"2026-08-20"}],"passengers":[{"type":"adult"}],"cabin_class":"economy","currency":"EUR","language":"es"}'请求体 - 示例
json
{
"slices": [
{
"origin": "MAD",
"destination": "BCN",
"departure_date": "2026-08-20"
}
],
"passengers": [
{
"type": "adult"
}
],
"cabin_class": "economy",
"currency": "EUR",
"language": "es"
}响应
| 状态码 | 说明 |
|---|---|
200 | Flight offers retrieved successfully. |
400 | 请求无效:payload 不合法。 |
401 | 未授权:凭证无效或缺失。 |
403 | 禁止访问:凭证无效。 |
500 | 服务器内部错误 |
200 响应体
媒体类型:application/json
json
{
"offers": [
{
"offerId": "string",
"gdsprovider": 0,
"expiresAt": "2026-06-05T00:06:29.070Z",
"totalAmount": 0,
"holdOptions": {
"available": true,
"paymentRequiredBy": "2026-06-05T00:06:29.070Z",
"priceGuarantedUntil": "2026-06-05T00:06:29.070Z"
},
"supportedPassengerIdDocuments": "passport",
"passengerIdentityDocumentsRequired": true,
"supportedLoyaltyPrograms": [
null
],
"airline": {
"name": "string",
"iataCode": "string",
"logoURL": {},
"conditionsOfCarriage": "string"
},
"passengers": [
{
"id": "string",
"type": "adult"
}
],
"conditions": {
"refundBeforeDeparture": {
"currency": "string",
"penaltyAmount": "string",
"allowed": true
},
"changeBeforeDeparture": {
"currency": "string",
"penaltyAmount": "string",
"allowed": true
}
},
"slices": [
{
"fareName": "string",
"departure": {
"iataCode": "string",
"cityName": "string",
"airportName": "string",
"departingAt": "string",
"timeZone": "string"
},
"arrival": {
"iataCode": "string",
"cityName": "string",
"airportName": "string",
"arrivingAt": "string",
"timeZone": "string"
},
"durationMinutes": 0,
"conditions": {
"priorityCheckIn": true,
"priorityBoarding": true,
"advanceSeatSelection": true
},
"segments": [
{
"fareName": "string",
"departure": {
"iataCode": "string",
"cityName": "string",
"airportName": "string",
"departingAt": "string",
"timeZone": "string",
"terminal": "string"
},
"arrival": {
"iataCode": "string",
"cityName": "string",
"airportName": "string",
"arrivingAt": "string",
"timeZone": "string",
"terminal": "string"
},
"airline": {},
"flightNumber": "string",
"durationMinutes": 0,
"passengers": [
{
"amenities": {
"wifi": {
"cost": {},
"available": true
},
"seat": {
"pitch": "string",
"legroom": "string",
"type": {}
},
"power": true
},
"baggages": [
{
"type": "checked",
"quantity": 0,
"maxKg": "string"
}
]
}
]
}
]
}
],
"CO2EmissionsKg": 0,
"holdId": "string",
"originalCurrency": {},
"currency": "EUR"
}
],
"liveMode": false
}