Skip to main content

Flights Search

Flights search gives you capability to provide your users live airfares for all routes that your users need.

By default, the search endpoint will only provide you the best airfare for a single Trip. There is a complementary endpoint to get all the available fares for a single Trip.

Based from the user's input and settings - build a search object and use it to trigger a search session. Here's an example of a search request from a user planning a trip to London.

POST https://affiliate-api.wego.com/metasearch/flights/searches
Headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...
Body:
{
"paymentMethodIds": [
10,
15,
189,
191,
192
],
"search": {
"adultsCount": 1,
"appType": "WEB_APP",
"cabin": "economy",
"childrenCount": 0,
"clientCreatedAt": "2024-06-27T14:59:49.185Z",
"currencyCode": "USD",
"deviceType": "DESKTOP",
"infantsCount": 0,
"legs": [
{
"outboundDate": "2024-07-09",
"departureCityCode": "SIN",
"arrivalCityCode": "LON"
},
{
"outboundDate": "2024-07-12",
"departureCityCode": "LON",
"arrivalCityCode": "SIN"
}
],
"locale": "en",
"shopcashClickId": "",
"siteCode": "SG",
"userLoggedIn": false
}
}
Having two legs means the request is a roundtrip. Refer to the docs for more details on how to construct search request based on your users' needs (one way, roundtrip, passenger count, cabin class, etc)

The response will contain several objects but in this first response, you only need to get the Search ID. This is the indication that Wego has started the search and this ID will be the reference for getting the results.

Response
{
"legs": [],
"tags": [],
"search": {
"id": "5bf1fab505a74269msr",
"cabin": "economy",
"adultsCount": 1,
"childrenCount": 0,
"infantsCount": 0,
"siteCode": "AE",
"currencyCode": "AED",
"locale": "en",
"deviceType": "desktop",
"appType": "WEB_APP",
"createdAt": "2024-06-27T14:59:49.466Z",
"key": "[cSIN:cLON:2024-07-09-cLON:cSIN:2024-07-12]~1~0~0~AE~economy~desktop~WEB_APP",
"userCountryCode": "VN",
"wgInternalCampaign": "",
"legs": [
{
"id": "cSIN:cLON:2024-07-09",
"outboundDate": "2024-07-09",
"departureCityCode": "SIN",
"arrivalCityCode": "LON",
"departureCity": {
"code": "SIN",
"name": "Singapore",
"enName": "Singapore",
"countryCode": "SG",
"countryName": "Singapore",
"countryEnName": "Singapore",
"worldRegionCode": "i",
"worldRegionName": "Asia",
"worldRegionEnName": "Asia"
},
"arrivalCity": {
"code": "LON",
"name": "London",
"enName": "London",
"countryCode": "GB",
"countryName": "United Kingdom",
"countryEnName": "United Kingdom",
"worldRegionCode": "e",
"worldRegionName": "Europe",
"worldRegionEnName": "Europe"
}
},
{
"id": "cLON:cSIN:2024-07-12",
"outboundDate": "2024-07-12",
"departureCityCode": "LON",
"arrivalCityCode": "SIN",
"departureCity": {
"code": "LON",
"name": "London",
"enName": "London",
"countryCode": "GB",
"countryName": "United Kingdom",
"countryEnName": "United Kingdom",
"worldRegionCode": "e",
"worldRegionName": "Europe",
"worldRegionEnName": "Europe"
},
"arrivalCity": {
"code": "SIN",
"name": "Singapore",
"enName": "Singapore",
"countryCode": "SG",
"countryName": "Singapore",
"countryEnName": "Singapore",
"worldRegionCode": "i",
"worldRegionName": "Asia",
"worldRegionEnName": "Asia"
}
}
],
"nearbyRoutes": []
},
"currencies": [
{
"code": "FJD",
"rate": 2.2382
},
{
"code": "MXN",
"rate": 18.377396
},
// other currencies omitted for brevity
{
"code": "BRL",
"rate": 5.515501
}
],
"airlines": [],
"airports": [],
"cities": [],
"providers": [],
"countries": [],
"trips": [],
"fares": [],
"routeSponsors": [],
"scores": {},
"paymentMethods": [],
"fareConditions": [],
"faresCount": {},
"promosCount": {},
"count": 0,
"sponsors": []
}

Wego is working hard to process the search the moment you send the initial request. Now, it's time to get the results.

Getting the Search Results

Getting the results require you to poll Wego's API. Wego can not provide you all the results in one request. But we can help you gradually show the results to the user. You need to start polling to get the results. Let's make the first poll.

Use the search ID returned in the previous step. Pass offset with value 0. We'll discuss what offset is for in the later section of this guide.

GET https://affiliate-api.wego.com/metasearch/flights/:searchID/results
URL: https://affiliate-api.wego.com/metasearch/flights/searches/:searchID/results?offset=0&locale=EN&currencyCode=SGD
Headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...
URL Params:
offset: 0
locale: EN
currencyCode: SGD

Here's a snippet of the response. You'll notice that objects alongside Search have values now.

Response: HTTP 200
{
"legs": [
{
"id": "SIN-LHR:BA6177~9:BA2364~10:0",
"departureTime": "18:45",
"arrivalTime": "06:25",
"duration": "18h 40m",
"departureAirportCode": "SIN",
"arrivalAirportCode": "LHR",
"airlineCodes": [
"BA"
],
"stopoverAirportCodes": [
"DOH"
],
"allianceCodes": [
"oneworld"
],
"stopoversCount": 1,
"departureTimeMinutes": 1125,
"arrivalTimeMinutes": 385,
"departureDateTime": "2024-07-09T18:45:00.000+08:00",
"arrivalDateTime": "2024-07-10T06:25:00.000+01:00",
"stopoverDurationMinutes": 195,
"durationMinutes": 1120,
"overnight": true,
"stopoverDuration": "03h 15m",
"durationDays": 1,
"longStopover": false,
"segments": [
{
"durationMinutes": 490,
"stopoverDurationMinutes": 195,
"departureAirportCode": "SIN",
"arrivalAirportCode": "DOH",
"airlineCode": "BA",
"operatingAirlineCode": "QR",
"cabin": "economy",
"designatorCode": "BA6177",
"departureDateTime": "2024-07-09T18:45:00.000+08:00",
"arrivalDateTime": "2024-07-09T21:55:00.000+03:00"
},
{
"durationMinutes": 435,
"stopoverDurationMinutes": 0,
"departureAirportCode": "DOH",
"arrivalAirportCode": "LHR",
"airlineCode": "BA",
"cabin": "economy",
"designatorCode": "BA2364",
"departureDateTime": "2024-07-10T01:10:00.000+03:00",
"arrivalDateTime": "2024-07-10T06:25:00.000+01:00"
}
],
"operatingAirlineCodes": [
"QR"
],
"stopoverCode": "ONE_STOP",
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": true,
"highlyRatedCarrier": false,
"score": 841.33
},
{
"id": "STN-SIN:EK68~12:EK352~13:1",
"departureTime": "21:10",
"arrivalTime": "21:45",
"duration": "17h 35m",
"departureAirportCode": "STN",
"arrivalAirportCode": "SIN",
"airlineCodes": [
"EK"
],
"stopoverAirportCodes": [
"DXB"
],
"allianceCodes": [
""
],
"stopoversCount": 1,
"departureTimeMinutes": 1270,
"arrivalTimeMinutes": 1305,
"departureDateTime": "2024-07-12T21:10:00.000+01:00",
"arrivalDateTime": "2024-07-13T21:45:00.000+08:00",
"stopoverDurationMinutes": 175,
"durationMinutes": 1055,
"overnight": true,
"stopoverDuration": "02h 55m",
"durationDays": 1,
"longStopover": false,
"segments": [
{
"durationMinutes": 420,
"stopoverDurationMinutes": 175,
"departureAirportCode": "STN",
"arrivalAirportCode": "DXB",
"airlineCode": "EK",
"cabin": "economy",
"designatorCode": "EK68",
"departureDateTime": "2024-07-12T21:10:00.000+01:00",
"arrivalDateTime": "2024-07-13T07:10:00.000+04:00"
},
{
"durationMinutes": 460,
"stopoverDurationMinutes": 0,
"departureAirportCode": "DXB",
"arrivalAirportCode": "SIN",
"airlineCode": "EK",
"cabin": "economy",
"designatorCode": "EK352",
"departureDateTime": "2024-07-13T10:05:00.000+04:00",
"arrivalDateTime": "2024-07-13T21:45:00.000+08:00"
}
],
"operatingAirlineCodes": [],
"stopoverCode": "ONE_STOP",
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": true,
"highlyRatedCarrier": false,
"score": 845.67
},
{
"id": "SIN-LHR:BA2307~9:BA7005~9:0",
"departureTime": "10:30",
"arrivalTime": "22:00",
"duration": "18h 30m",
"departureAirportCode": "SIN",
"arrivalAirportCode": "LHR",
"airlineCodes": [
"BA"
],
"stopoverAirportCodes": [
"DOH"
],
"allianceCodes": [
"oneworld"
],
"stopoversCount": 1,
"departureTimeMinutes": 630,
"arrivalTimeMinutes": 1320,
"departureDateTime": "2024-07-09T10:30:00.000+08:00",
"arrivalDateTime": "2024-07-09T22:00:00.000+01:00",
"stopoverDurationMinutes": 190,
"durationMinutes": 1110,
"overnight": false,
"stopoverDuration": "03h 10m",
"durationDays": 0,
"longStopover": false,
"segments": [
{
"durationMinutes": 485,
"stopoverDurationMinutes": 190,
"departureAirportCode": "SIN",
"arrivalAirportCode": "DOH",
"airlineCode": "BA",
"operatingAirlineCode": "QR",
"cabin": "economy",
"designatorCode": "BA2307",
"departureDateTime": "2024-07-09T10:30:00.000+08:00",
"arrivalDateTime": "2024-07-09T13:35:00.000+03:00"
},
{
"durationMinutes": 435,
"stopoverDurationMinutes": 0,
"departureAirportCode": "DOH",
"arrivalAirportCode": "LHR",
"airlineCode": "BA",
"operatingAirlineCode": "QR",
"cabin": "economy",
"designatorCode": "BA7005",
"departureDateTime": "2024-07-09T16:45:00.000+03:00",
"arrivalDateTime": "2024-07-09T22:00:00.000+01:00"
}
],
"operatingAirlineCodes": [
"QR"
],
"stopoverCode": "ONE_STOP",
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": true,
"highlyRatedCarrier": false,
"score": 842
},
{
"id": "LHR-SIN:BA2365~12:BA2304~13:1",
"departureTime": "19:25",
"arrivalTime": "20:45",
"duration": "18h 20m",
"departureAirportCode": "LHR",
"arrivalAirportCode": "SIN",
"airlineCodes": [
"BA"
],
"stopoverAirportCodes": [
"DOH"
],
"allianceCodes": [
"oneworld"
],
"stopoversCount": 1,
"departureTimeMinutes": 1165,
"arrivalTimeMinutes": 1245,
"departureDateTime": "2024-07-12T19:25:00.000+01:00",
"arrivalDateTime": "2024-07-13T20:45:00.000+08:00",
"stopoverDurationMinutes": 210,
"durationMinutes": 1100,
"overnight": true,
"stopoverDuration": "03h 30m",
"durationDays": 1,
"longStopover": false,
"segments": [
{
"durationMinutes": 405,
"stopoverDurationMinutes": 210,
"departureAirportCode": "LHR",
"arrivalAirportCode": "DOH",
"airlineCode": "BA",
"operatingAirlineCode": "QR",
"cabin": "economy",
"designatorCode": "BA2365",
"departureDateTime": "2024-07-12T19:25:00.000+01:00",
"arrivalDateTime": "2024-07-13T04:10:00.000+03:00"
},
{
"durationMinutes": 485,
"stopoverDurationMinutes": 0,
"departureAirportCode": "DOH",
"arrivalAirportCode": "SIN",
"airlineCode": "BA",
"operatingAirlineCode": "QR",
"cabin": "economy",
"designatorCode": "BA2304",
"departureDateTime": "2024-07-13T07:40:00.000+03:00",
"arrivalDateTime": "2024-07-13T20:45:00.000+08:00"
}
],
"operatingAirlineCodes": [
"QR"
],
"stopoverCode": "ONE_STOP",
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": true,
"highlyRatedCarrier": false,
"score": 842.67
}
],
"tags": [
{
"id": 5,
"code": "REFUNDABLE",
"name": "Refundable",
"type": "flexible_tickets",
"price": {
"totalAmount": 3445,
"totalAmountUsd": 937.9987,
"currencyCode": "AED"
}
}
],
"search": {
"id": "5bf1fab505a74269msr",
"cabin": "economy",
"adultsCount": 1,
"childrenCount": 0,
"infantsCount": 0,
"siteCode": "SG",
"currencyCode": "USD",
"locale": "en",
"deviceType": "desktop",
"appType": "WEB_APP",
"createdAt": "2024-06-30T14:18:10.157Z",
"key": "[cSIN:cLON:2024-07-09-cLON:cSIN:2024-07-12]~1~0~0~SG~economy~desktop~WEB_APP",
"userCountryCode": "SG",
"wgInternalCampaign": "",
"legs": [
{
"id": "cSIN:cLON:2024-07-09",
"outboundDate": "2024-07-09",
"departureCityCode": "SIN",
"arrivalCityCode": "LON",
"departureCity": {
"code": "SIN",
"name": "Singapore",
"enName": "Singapore",
"countryCode": "SG",
"countryName": "Singapore",
"countryEnName": "Singapore",
"worldRegionCode": "i",
"worldRegionName": "Asia",
"worldRegionEnName": "Asia"
},
"arrivalCity": {
"code": "LON",
"name": "London",
"enName": "London",
"countryCode": "GB",
"countryName": "United Kingdom",
"countryEnName": "United Kingdom",
"worldRegionCode": "e",
"worldRegionName": "Europe",
"worldRegionEnName": "Europe"
}
},
{
"id": "cLON:cSIN:2024-07-12",
"outboundDate": "2024-07-12",
"departureCityCode": "LON",
"arrivalCityCode": "SIN",
"departureCity": {
"code": "LON",
"name": "London",
"enName": "London",
"countryCode": "GB",
"countryName": "United Kingdom",
"countryEnName": "United Kingdom",
"worldRegionCode": "e",
"worldRegionName": "Europe",
"worldRegionEnName": "Europe"
},
"arrivalCity": {
"code": "SIN",
"name": "Singapore",
"enName": "Singapore",
"countryCode": "SG",
"countryName": "Singapore",
"countryEnName": "Singapore",
"worldRegionCode": "i",
"worldRegionName": "Asia",
"worldRegionEnName": "Asia"
}
}
],
"nearbyRoutes": []
},
"currencies": [
{
"code": "FJD",
"rate": 2.2382
},
{
"code": "MXN",
"rate": 18.377396
},
{
"code": "BRL",
"rate": 5.515501
}
],
"airlines": [
{
"name": "British Airways",
"code": "BA"
},
{
"name": "Emirates",
"code": "EK"
}
],
"airports": [
{
"name": "London Heathrow Airport",
"code": "LHR",
"cityCode": "LON"
},
{
"name": "London Stansted Airport",
"code": "STN",
"cityCode": "LON"
},
{
"name": "Singapore Changi Airport",
"code": "SIN",
"cityCode": "SIN"
}
],
"cities": [
{
"code": "LON",
"name": "London",
"countryCode": "GB"
},
{
"code": "SIN",
"name": "Singapore",
"countryCode": "SG"
}
],
"providers": [
{
"code": "kiwi.com",
"name": "Kiwi",
"type": "ota",
"instant": false,
"facilitatedBooking": false,
"wegoFare": false
},
{
"code": "onetravel.com",
"name": "Onetravel",
"type": "ota",
"instant": false,
"facilitatedBooking": false,
"wegoFare": false
}
],
"countries": [
{
"code": "SG",
"name": "Singapore"
},
{
"code": "GB",
"name": "United Kingdom"
}
],
"trips": [
{
"id": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13",
"originalFlightId": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13",
"code": "BA6177~9-BA2364~10=EK68~12-EK352~13",
"legIds": [
"SIN-LHR:BA6177~9:BA2364~10:0",
"STN-SIN:EK68~12:EK352~13:1"
],
"normalizedFlight": false
},
{
"id": "5bf1fab505a74269msr:BA2307~9-BA7005~9=BA2365~12-BA2304~13",
"originalFlightId": "5bf1fab505a74269msr:BA2307~9-BA7005~9=BA2365~12-BA2304~13",
"code": "BA2307~9-BA7005~9=BA2365~12-BA2304~13",
"legIds": [
"SIN-LHR:BA2307~9:BA7005~9:0",
"LHR-SIN:BA2365~12:BA2304~13:1"
],
"normalizedFlight": false
}
],
"fares": [
{
"paymentFees": [
{
"paymentMethodId": 10,
"currencyCode": "AED",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 15,
"currencyCode": "AED",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
}
],
"id": "5bf1fab505a74269msr:kiwi.com:e0d59a00316afcc9",
"price": {
"totalAmount": 5131,
"totalAmountUsd": 1397,
"amount": 5131,
"amountUsd": 1397,
"originalAmount": 5131.181,
"originalAmountUsd": 1397,
"amountPerAdult": 0,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"providerCode": "kiwi.com",
"handoffUrl": "https://handoff.wego.com/flights/continue?currency=USD&url_locale=en&site_code=SG&device_type=desktop&app_type=WEB_APP&domain=www.wego.com.sg&fare_id=5bf1fab505a74269msr:kiwi.com:e0d59a00316afcc9&route=SIN-LON&search_id=5bf1fab505a74269msr&trip_id=cSIN:cLON:2024-07-09:cLON:cSIN:2024-07-12&pwa=false&api_version=2&integration_code=kiwi.com®ion=ap-southeast-1&placement_type=metasearch",
"ecpc": 0.461463,
"remainingSeatsCount": 0,
"conditionIds": [],
"legConditionIds": [],
"refundable": false,
"exchangeable": false,
"tags": [],
"score": 290,
"legsSourceTypes": [
"NORMAL",
"NORMAL"
],
"tripId": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13"
},
{
"paymentFees": [
{
"paymentMethodId": 3,
"currencyCode": "AED",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 10,
"currencyCode": "AED",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 15,
"currencyCode": "AED",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
}
],
"id": "5bf1fab505a74269msr:onetravel.com:54be33645e53dc45",
"price": {
"totalAmount": 3727,
"totalAmountUsd": 1014.6,
"amount": 3727,
"amountUsd": 1014.6,
"originalAmount": 3726.6257,
"originalAmountUsd": 1014.6,
"amountPerAdult": 3726.6257,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"providerCode": "onetravel.com",
"handoffUrl": "https://handoff.wego.com/flights/continue?currency=USD&url_locale=en&site_code=SG&device_type=desktop&app_type=WEB_APP&domain=www.wego.com.sg&fare_id=5bf1fab505a74269msr:onetravel.com:54be33645e53dc45&route=SIN-LON&search_id=5bf1fab505a74269msr&trip_id=cSIN:cLON:2024-07-09:cLON:cSIN:2024-07-12&pwa=false&api_version=2&integration_code=onetravel.com®ion=ap-southeast-1&placement_type=metasearch",
"ecpc": 0.442071,
"remainingSeatsCount": 0,
"conditionIds": [],
"legConditionIds": [],
"refundable": false,
"exchangeable": false,
"tags": [],
"score": 670.06995,
"legsSourceTypes": [
"NORMAL",
"NORMAL"
],
"tripId": "5bf1fab505a74269msr:BA2307~9-BA7005~9=BA2365~12-BA2304~13"
}
],
"routeSponsors": [],
"scores": {
"5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13": 841.33,
"5bf1fab505a74269msr:BA2307~9-BA7005~9=BA2365~12-BA2304~13": 842
},
"paymentMethods": [
{
"id": 3,
"name": "American Express"
},
{
"id": 14,
"name": "Visa"
},
{
"id": 10,
"name": "MasterCard Credit"
},
{
"id": 15,
"name": "Visa Credit"
},
{
"id": 187,
"name": "Apple Pay"
},
{
"id": 152,
"name": "MADA"
}
],
"fareConditions": [
{
"id": 1,
"code": "REFUNDABLE",
"name": "Refundable"
}
],
"faresCount": {
"5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13": 1,
"5bf1fab505a74269msr:BA2307~9-BA7005~9=BA2365~12-BA2304~13": 2
},
"promosCount": {},
"count": 2,
"sponsors": [],
"filters": {
"minPrice": {
"totalAmount": 3036,
"totalAmountUsd": 826.5536,
"amount": 3036,
"amountUsd": 826.5536,
"originalAmount": 3035.9314,
"originalAmountUsd": 826.5536,
"amountPerAdult": 3035.9316,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"maxPrice": {
"totalAmount": 26116,
"totalAmountUsd": 7110.21,
"amount": 26116,
"amountUsd": 7110.21,
"originalAmount": 26115.803,
"originalAmountUsd": 7110.21,
"amountPerAdult": 26115.803,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"stops": [
{
"code": "ONE_STOP",
"price": {
"totalAmount": 3077,
"totalAmountUsd": 837.7368,
"amount": 3077,
"amountUsd": 837.7368,
"originalAmount": 3077.0073,
"originalAmountUsd": 837.7368,
"amountPerAdult": 0,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"code": "MORE_THAN_ONE_STOP",
"price": {
"totalAmount": 3036,
"totalAmountUsd": 826.5536,
"amount": 3036,
"amountUsd": 826.5536,
"originalAmount": 3035.9314,
"originalAmountUsd": 826.5536,
"amountPerAdult": 3035.9316,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"code": "DIRECT",
"price": {
"totalAmount": 6750,
"totalAmountUsd": 1837.79,
"amount": 6750,
"amountUsd": 1837.79,
"originalAmount": 6750.203,
"originalAmountUsd": 1837.79,
"amountPerAdult": 6750.203,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"airlines": [
{
"code": "EK",
"price": {
"totalAmount": 3780,
"totalAmountUsd": 1029.22,
"amount": 3780,
"amountUsd": 1029.22,
"originalAmount": 3780.325,
"originalAmountUsd": 1029.22,
"amountPerAdult": 3780.325,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"code": "BA",
"price": {
"totalAmount": 3391,
"totalAmountUsd": 923.24,
"amount": 3391,
"amountUsd": 923.24,
"originalAmount": 3391.0605,
"originalAmountUsd": 923.24,
"amountPerAdult": 3391.0605,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"providers": [
{
"code": "onetravel.com",
"price": {
"totalAmount": 3429,
"totalAmountUsd": 933.7,
"amount": 3429,
"amountUsd": 933.7,
"originalAmount": 3429.4802,
"originalAmountUsd": 933.7,
"amountPerAdult": 3429.4802,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"code": "kiwi.com",
"price": {
"totalAmount": 3813,
"totalAmountUsd": 1038,
"amount": 3813,
"amountUsd": 1038,
"originalAmount": 3812.5742,
"originalAmountUsd": 1038,
"amountPerAdult": 0,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"stopoverAirports": [
{
"code": "LHR",
"price": {
"totalAmount": 3747,
"totalAmountUsd": 1020.0516,
"amount": 3747,
"amountUsd": 1020.0516,
"originalAmount": 3746.918,
"originalAmountUsd": 1020.0516,
"amountPerAdult": 3746.918,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"code": "DXB",
"price": {
"totalAmount": 3825,
"totalAmountUsd": 1041.205,
"amount": 3825,
"amountUsd": 1041.205,
"originalAmount": 3825.0872,
"originalAmountUsd": 1041.205,
"amountPerAdult": 3825.0872,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"departureTimeRanges": [
{
"startTime": "2024-07-15T00:00:00.000Z",
"endTime": "2024-07-15T12:00:00.000Z",
"price": {
"totalAmount": 3780,
"totalAmountUsd": 1029.22,
"amount": 3780,
"amountUsd": 1029.22,
"originalAmount": 3780.325,
"originalAmountUsd": 1029.22,
"amountPerAdult": 3780.325,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"startTime": "2024-07-16T00:00:00.000Z",
"endTime": "2024-07-16T12:00:00.000Z",
"price": {
"totalAmount": 3241,
"totalAmountUsd": 881.693,
"amount": 3241,
"amountUsd": 881.693,
"originalAmount": 3241.1548,
"originalAmountUsd": 881.693,
"amountPerAdult": 3241.1548,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"arrivalTimeRanges": [
{
"startTime": "2024-07-15T12:00:00.000Z",
"endTime": "2024-07-15T23:59:59.999Z",
"price": {
"totalAmount": 3391,
"totalAmountUsd": 923.24,
"amount": 3391,
"amountUsd": 923.24,
"originalAmount": 3391.0605,
"originalAmountUsd": 923.24,
"amountPerAdult": 3391.0605,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"startTime": "2024-07-16T12:00:00.000Z",
"endTime": "2024-07-17T00:00:00.000Z",
"price": {
"totalAmount": 6750,
"totalAmountUsd": 1837.79,
"amount": 6750,
"amountUsd": 1837.79,
"originalAmount": 6750.203,
"originalAmountUsd": 1837.79,
"amountPerAdult": 6750.203,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
],
"durationRanges": [
{
"startTime": "PT12H0M",
"endTime": "PT24H0M",
"price": {
"totalAmount": 6750,
"totalAmountUsd": 1837.79,
"amount": 6750,
"amountUsd": 1837.79,
"originalAmount": 6750.203,
"originalAmountUsd": 1837.79,
"amountPerAdult": 6750.203,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
},
{
"startTime": "PT24H0M",
"endTime": "PT36H0M",
"price": {
"totalAmount": 26116,
"totalAmountUsd": 7110.21,
"amount": 26116,
"amountUsd": 7110.21,
"originalAmount": 26115.803,
"originalAmountUsd": 7110.21,
"amountPerAdult": 26115.803,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "AED",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
}
}
]
}
}
^A sample but not a complete response body. Some objects will have more attributes.
note

To check out the full defaults the objects and its attributes included in the response body, please refer to Reference page.

Understanding the Response

This response is a subset of the entire search result. It is important to understand that you can start showing this subset to the user so they can start interacting

note

Looking up for details

You might notice that most of the objects contain references ( ID or Code) to another object from another list. Our API uses this pattern for data that can be referenced by multiple objects - to avoid data duplication and to trim down size.

Data Relations

Trip only has legIds. Full Leg information is in the leg object. Moreover, leg only has airport code. Airport name can be found in the actual airport object.

Displaying the results

You don't have to keep your users waiting to finish the polling before showing users the results. Use the the available Trips, and Fares to engage your user this early on. While in the background, you can continue polling. We will discuss how to poll for more results in the next section. Right now, let's not keep your user waiting. You can start displaying the available result.

The main objects that you will be dealing with in displaying the results are Trips and Fares.

note

A trip contains references to the legs of a particular journey. A trip may have 1, 2 or more than 2 legs depending on the type of the trip.

One leg means the trip is one way. A trip with two legs means it is a round trip. And more than 2 legs means it is a multi-city trip.

note

A Fare object holds the price information and the provider selling this ticket.

Refer to the docs to know more about the Fare object.

Polling for more results

You need to make another request to get the next set of result.

Supposed that the first response returned count with a value 100, you will use this as an offset for the succeeding request.

You are telling Wego that the next request you only want the 101st fares and onwards. Wego will not return the first 100 fares that was already returned in the previous poll.

GET https://affiliate-api.wego.com/metasearch/flights/:searchID/results
URL: https://affiliate-api.wego.com/metasearch/flights/searches/:searchID/results?offset=0&locale=EN&currencyCode=SGD
Headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...
URL Params:
offset: 100
locale: EN
currencyCode: SGD

Merging multiple results

Using count and offset means that you are getting the results by chunk. This approach is good for performance because the size being passed over the network is significantly lower.

This means that the responses have to be merged carefully. Collections like airports, airlines, countries, legs, filters, etc need to be merged and deduped. ie: same airport can appear on multiple responses.

You will also need to sort the fares when merging. The new fares might be have cheaper prices than the previously returned fares.

Polling strategy

We recommend that you keep polling for more results with increasing intervals in between.

For example:

  • Poll #1 - wait 500ms before doing another poll
  • Poll #2 - wait 1 second before doing another poll
  • Poll #3 - wait 2 seconds before doing another poll
  • Poll #4 - wait 3 seconds before doing another poll
  • Poll #5 - wait 4 seconds before doing another poll

When to stop polling

If for three consecutive polls returned the same count, it means that the API has given all the available fares for this particular session. On average, it takes about 7 polls to get the entire results for a particular search session.

Filtering

The filter data is provided by the API. You can see several options under filters object in the response.

We are giving you the responsibility to filter the results. This means that when user changed a filter option, you will have to filter the results in the client. This main benefit of this approach is performance. You don't need to make another network call to filter the search result.

Sorting

Sorting is also done client-side. You can implement several sorting options. eg: by price, by flight duration, departure time, etc.

Pagination

Pagination is also done client-side. You just need to slice the result based on your needs.

Getting more Fares

So far, you have been calling one endpoint to trigger search and poll for results. This endpoint only gives you the best fare for a given trip. We have another endpoint to get all the available fares - these fares are from different OTAs and airlines in varying prices.

When a user shows interest in a particular trip (by clicking or focusing on it), you can show more fares and additional information regarding that trip. Let's send below request:

GET https://affiliate-api.wego.com/metasearch/flights/trips/:tripId
URL: https://affiliate-api.wego.com/metasearch/flights/trips/57b9519e27b02524:CX714-CX253=CX354-CX691
Headers:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...
Trip details and Fares
{
"paymentMethods": [
{
"id": 7,
"name": "JCB"
},
{
"id": 10,
"name": "MasterCard Credit"
},
{
"id": 15,
"name": "Visa Credit"
}
],
"trip": {
"id": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13",
"originalFlightId": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13",
"code": "BA6177~9-BA2364~10=EK68~12-EK352~13",
"normalizedFlight": false,
"domestic": false,
"tags": [],
"messages": [],
"fares": [
{
"id": "5bf1fab505a74269msr:kiwi.com:6887deecd37d2fe4",
"searchId": "5bf1fab505a74269msr",
"price": {
"totalAmount": 1469,
"totalAmountUsd": 1469,
"amount": 1469,
"amountUsd": 1469,
"originalAmount": 1469,
"originalAmountUsd": 1469,
"amountPerAdult": 0,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "USD",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"provider": {
"code": "kiwi.com",
"name": "Kiwi",
"type": "ota",
"instant": false,
"facilitatedBooking": false,
"wegoFare": false,
"badges": [],
"starPartner": false,
"colorHexPrimary": "#000000"
},
"bookingParams": "null",
"paymentFees": [
{
"paymentMethodId": 7,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 10,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 15,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
}
],
"handoffUrl": "https://handoff.wego.com/flights/continue?currency=USD&url_locale=en&site_code=SG&device_type=desktop&app_type=WEB_APP&domain=www.wego.com.sg&fare_id=5bf1fab505a74269msr:kiwi.com:6887deecd37d2fe4&route=SIN-LON&search_id=5bf1fab505a74269msr&trip_id=cSIN:cLON:2024-07-09:cLON:cSIN:2024-07-12&pwa=false&api_version=2&integration_code=kiwi.com&fare_index=1&total_fares=1®ion=ap-southeast-1&placement_type=metasearch",
"ecpc": 0.461463,
"remainingSeatsCount": 0,
"conditionIds": [],
"promos": [],
"refundable": false,
"exchangeable": false,
"hasBrandedFares": false,
"tags": [],
"score": 218,
"legsSourceTypes": [
"NORMAL",
"NORMAL"
],
"tripId": "5bf1fab505a74269msr:BA6177~9-BA2364~10=EK68~12-EK352~13"
}
],
"legs": [
{
"departureTime": "18:45",
"arrivalTime": "06:25",
"duration": "18h 40m",
"departureAirportCode": "SIN",
"arrivalAirportCode": "LHR",
"airlineCodes": [
"BA",
"BA"
],
"stopoverAirportCodes": [
"DOH"
],
"allianceCodes": [
"oneworld"
],
"stopoversCount": 1,
"departureTimeMinutes": 1125,
"arrivalTimeMinutes": 385,
"departureDateTime": "2024-07-09T18:45:00.000+08:00",
"arrivalDateTime": "2024-07-10T06:25:00.000+01:00",
"stopoverDurationMinutes": 195,
"durationMinutes": 1120,
"overnight": true,
"stopoverDuration": "03h 15m",
"durationDays": 1,
"longStopover": false,
"segments": [
{
"departureAirportCode": "SIN",
"departureAirportName": "Singapore Changi Airport",
"departureCityName": "Singapore",
"departureCountryCode": "SG",
"departureDate": "9 Jul",
"departureTime": "18:45",
"departureDateTime": "2024-07-09T18:45:00.000+08:00",
"duration": "08h 10m",
"durationMinutes": 490,
"airlineName": "British Airways",
"airlineCode": "BA",
"allianceCode": "oneworld",
"designatorCode": "BA6177",
"arrivalAirportCode": "DOH",
"arrivalAirportName": "Hamad International Airport",
"arrivalCityName": "Doha",
"arrivalCountryCode": "QA",
"arrivalDate": "9 Jul",
"arrivalTime": "21:55",
"arrivalDateTime": "2024-07-09T21:55:00.000+03:00",
"stopoverDuration": "03h 15m",
"stopoverDurationMinutes": 195,
"operatingAirlineName": "Qatar Airways",
"operatingAirlineCode": "QR",
"cabin": "economy"
},
{
"departureAirportCode": "DOH",
"departureAirportName": "Hamad International Airport",
"departureCityName": "Doha",
"departureCountryCode": "QA",
"departureDate": "10 Jul",
"departureTime": "01:10",
"departureDateTime": "2024-07-10T01:10:00.000+03:00",
"duration": "07h 15m",
"durationMinutes": 435,
"airlineName": "British Airways",
"airlineCode": "BA",
"allianceCode": "oneworld",
"designatorCode": "BA2364",
"arrivalAirportCode": "LHR",
"arrivalAirportName": "London Heathrow Airport",
"arrivalCityName": "London",
"arrivalCountryCode": "GB",
"arrivalDate": "10 Jul",
"arrivalTime": "06:25",
"arrivalDateTime": "2024-07-10T06:25:00.000+01:00",
"stopoverDurationMinutes": 0,
"aircraftType": "Airbus Industrie A380 800",
"operatingAirlineName": "Qatar Airways",
"operatingAirlineCode": "QR",
"cabin": "economy"
}
],
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": false,
"highlyRatedCarrier": false,
"departureDate": "Tue, 9 Jul",
"arrivalDate": "Wed, 10 Jul"
},
{
"departureTime": "21:10",
"arrivalTime": "21:45",
"duration": "17h 35m",
"departureAirportCode": "STN",
"arrivalAirportCode": "SIN",
"airlineCodes": [
"EK",
"EK"
],
"stopoverAirportCodes": [
"DXB"
],
"allianceCodes": [
""
],
"stopoversCount": 1,
"departureTimeMinutes": 1270,
"arrivalTimeMinutes": 1305,
"departureDateTime": "2024-07-12T21:10:00.000+01:00",
"arrivalDateTime": "2024-07-13T21:45:00.000+08:00",
"stopoverDurationMinutes": 175,
"durationMinutes": 1055,
"overnight": true,
"stopoverDuration": "02h 55m",
"durationDays": 1,
"segments": [
{
"departureAirportCode": "STN",
"departureAirportName": "London Stansted Airport",
"departureCityName": "London",
"departureCountryCode": "GB",
"departureDate": "12 Jul",
"departureTime": "21:10",
"departureDateTime": "2024-07-12T21:10:00.000+01:00",
"duration": "07h",
"durationMinutes": 420,
"airlineName": "Emirates",
"airlineCode": "EK",
"allianceCode": "",
"designatorCode": "EK68",
"arrivalAirportCode": "DXB",
"arrivalAirportName": "Dubai International Airport",
"arrivalCityName": "Dubai",
"arrivalCountryCode": "AE",
"arrivalDate": "13 Jul",
"arrivalTime": "07:10",
"arrivalDateTime": "2024-07-13T07:10:00.000+04:00",
"stopoverDuration": "02h 55m",
"stopoverDurationMinutes": 175,
"cabin": "economy"
},
{
"departureAirportCode": "DXB",
"departureAirportName": "Dubai International Airport",
"departureCityName": "Dubai",
"departureCountryCode": "AE",
"departureDate": "13 Jul",
"departureTime": "10:05",
"departureDateTime": "2024-07-13T10:05:00.000+04:00",
"duration": "07h 40m",
"durationMinutes": 460,
"airlineName": "Emirates",
"airlineCode": "EK",
"allianceCode": "",
"designatorCode": "EK352",
"arrivalAirportCode": "SIN",
"arrivalAirportName": "Singapore Changi Airport",
"arrivalCityName": "Singapore",
"arrivalCountryCode": "SG",
"arrivalDate": "13 Jul",
"arrivalTime": "21:45",
"arrivalDateTime": "2024-07-13T21:45:00.000+08:00",
"stopoverDurationMinutes": 0,
"cabin": "economy"
}
],
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": false,
"highlyRatedCarrier": false,
"departureDate": "Fri, 12 Jul",
"arrivalDate": "Sat, 13 Jul"
}
]
},
"fareConditions": [],
"legConditions": []
}