✈
Oneway Trip API
In this API you will get prices from multiple airlines and vendors for a oneway route. You can pass any airport IATA code, future date, currency, and pax.
API endpoint for this API is:
https://api.flightapi.io/oneway
Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.
You can generate an API key from your Dashboard at any time.
Here is the list of default parameters you have to use with this API:
Parameters | Description | Type |
---|---|---|
api_key
required | This is your personal API key. You can find this on your Dashboard. | String |
departure_airport_code
required | This is the IATA code of departure airport. | String |
arrival_airport_code
required | This is the IATA code of arrival airport. | String |
departure_date
required | Date of deparure
Format - YYYY-MM-DD | String |
number_of_adults
required | This is the number of adults. | String |
number_of_childrens
required | This is the number of childrens. | String |
number_of_infants
required | This is the number of infants. | String |
cabin_class
required | This is the class of the seat in the plane.
Possible Values- "Economy", "Business", "First" or "Premium_Economy" | String |
currency
required | You can use any currency code like USD, INR, EUR, etc | String |
You have to send a GET request to
https://api.flightapi.io/oneway
along with all the parameters. Take a look at how you might call this API using various different coding languages.
curl
Node
Python
curl "https://api.flightapi.io/onewaytrip/api_key/departure_airport_code/arrival_airport_code/departure_date/number_of_adults/number_of_childrens/number_of_infants/cabin_class/currency"
// require the Unirest or any other module to make an HTTP GET request
const unirest = require('unirest')
unirest.get('https://api.flightapi.io/onewaytrip/api_key/departure_airport_code/arrival_airport_code/departure_date/number_of_adults/number_of_childrens/number_of_infants/cabin_class/currency')
.then(response => {
console.log(response.body);
})
.catch(error => {
console.log(error);
});
// Set your API key before making the request
import requests
resp = requests.get('https://api.flightapi.io/onewaytrip/api_key/departure_airport_code/arrival_airport_code/departure_date/number_of_adults/number_of_childrens/number_of_infants/cabin_class/currency')
print (resp.json())
The sample response of the API will look somewhat like this.
// Sample Response
{
"legs": [
{
"id": "JAI-GOA:UK564~5:LX155~6:LX3618~6:LH6920~6:0",
"departureTime": "19:55",
"arrivalTime": "12:50",
"duration": "20h 25m",
"departureAirportCode": "JAI",
"arrivalAirportCode": "GOA",
"airlineCodes": [
"LX",
"UK",
"LH"
],
"stopoverAirportCodes": [
"BOM",
"ZRH",
"MUC"
],
"allianceCodes": [
"",
"star_alliance"
],
"stopoversCount": 3,
"departureTimeMinutes": 1195,
"arrivalTimeMinutes": 770,
"departureDateTime": "2023-07-05T19:55:00.000+05:30",
"arrivalDateTime": "2023-07-06T12:50:00.000+02:00",
"stopoverDurationMinutes": 445,
"durationMinutes": 1225,
"overnight": true,
"stopoverDuration": "07h 25m",
"durationDays": 1,
"longStopover": true,
"segments": [
{
"durationMinutes": 125,
"stopoverDurationMinutes": 175,
"departureAirportCode": "JAI",
"arrivalAirportCode": "BOM",
"airlineCode": "UK",
"cabin": "economy",
"designatorCode": "UK564",
"departureDateTime": "2023-07-05T19:55:00.000+05:30",
"arrivalDateTime": "2023-07-05T22:00:00.000+05:30"
},
{
"durationMinutes": 530,
"stopoverDurationMinutes": 185,
"departureAirportCode": "BOM",
"arrivalAirportCode": "ZRH",
"airlineCode": "LX",
"cabin": "economy",
"designatorCode": "LX155",
"departureDateTime": "2023-07-06T00:55:00.000+05:30",
"arrivalDateTime": "2023-07-06T06:15:00.000+02:00"
},
{
"durationMinutes": 50,
"stopoverDurationMinutes": 85,
"departureAirportCode": "ZRH",
"arrivalAirportCode": "MUC",
"airlineCode": "LX",
"operatingAirlineCode": "LH",
"cabin": "economy",
"designatorCode": "LX3618",
"departureDateTime": "2023-07-06T09:20:00.000+02:00",
"arrivalDateTime": "2023-07-06T10:10:00.000+02:00"
},
{
"durationMinutes": 75,
"stopoverDurationMinutes": 0,
"departureAirportCode": "MUC",
"arrivalAirportCode": "GOA",
"airlineCode": "LH",
"operatingAirlineCode": "EN",
"cabin": "economy",
"designatorCode": "LH6920",
"departureDateTime": "2023-07-06T11:35:00.000+02:00",
"arrivalDateTime": "2023-07-06T12:50:00.000+02:00"
}
],
"operatingAirlineCodes": [
"EN"
],
"stopoverCode": "MORE_THAN_ONE_STOP",
"shortStopover": false,
"earlyDeparture": false,
"lateArrival": false,
"newAircraft": false,
"oldAircraft": true,
"highlyRatedCarrier": false,
"score": 628.5
}
],
"tags": [
],
"search": {
"id": "f03653ce738ae2e5msr",
"cabin": "economy",
"adultsCount": 1,
"childrenCount": 0,
"infantsCount": 0,
"siteCode": "US",
"currencyCode": "USD",
"locale": "en",
"deviceType": "desktop",
"appType": "WEB_APP",
"createdAt": "2023-05-27T11:51:26.651Z",
"key": "[JAI:GOA:2023-07-05]~1~0~0~US~economy~desktop~WEB_APP",
"userCountryCode": "US",
"wgCampaign": "",
"legs": [
{
"id": "JAI:GOA:2023-07-05",
"outboundDate": "2023-07-05",
"departureAirportCode": "JAI",
"arrivalAirportCode": "GOA",
"departureCity": {
"code": "JAI",
"name": "Jaipur",
"enName": "Jaipur",
"countryCode": "IN",
"countryName": "India",
"countryEnName": "India",
"worldRegionCode": "i",
"worldRegionName": "Asia",
"worldRegionEnName": "Asia"
},
"arrivalCity": {
"code": "GOA",
"name": "Genoa",
"enName": "Genoa",
"countryCode": "IT",
"countryName": "Italy",
"countryEnName": "Italy",
"worldRegionCode": "e",
"worldRegionName": "Europe",
"worldRegionEnName": "Europe"
},
"departureAirport": {
"name": "Jaipur Airport",
"code": "JAI",
"cityCode": "JAI"
},
"arrivalAirport": {
"name": "Genoa Airport",
"code": "GOA",
"cityCode": "GOA"
}
}
]
},"airlines": [
{
"name": "Air Dolomiti",
"code": "EN"
},
{
"name": "Air France",
"code": "AF"
},
{
"name": "Emirates",
"code": "EK"
},
{
"name": "Etihad Airways",
"code": "EY"
},
{
"name": "KLM",
"code": "KL"
},
{
"name": "KLM Cityhopper",
"code": "WA"
},
{
"name": "Lufthansa",
"code": "LH"
},
{
"name": "Turkish Airlines",
"code": "TK"
},
{
"name": "Virgin Atlantic Airways",
"code": "VS"
},
{
"name": "Vistara",
"code": "UK"
}
],
"airports": [
{
"name": "Abu Dhabi International Airport",
"code": "AUH",
"cityCode": "AUH"
},
{
"name": "Geneva Airport",
"code": "GVA",
"cityCode": "GVA"
},
{
"name": "Genoa Airport",
"code": "GOA",
"cityCode": "GOA"
},
{
"name": "Hamad International Airport",
"code": "DOH",
"cityCode": "DOH"
},
{
"name": "Istanbul Airport",
"code": "IST",
"cityCode": "IST"
},
{
"name": "Jaipur Airport",
"code": "JAI",
"cityCode": "JAI"
},
{
"name": "Zurich Airport",
"code": "ZRH",
"cityCode": "ZRH"
}
],
"trips": [
{
"id": "f03653ce738ae2e5msr:KL3661~5-KL872~6-KL1565~6",
"code": "KL3661~5-KL872~6-KL1565~6",
"legIds": [
"JAI-GOA:KL3661~5:KL872~6:KL1565~6:0"
]
},
{
"id": "f03653ce738ae2e5msr:6E5237~5-EY203~5-EY85~6-AZ1383~6",
"code": "6E5237~5-EY203~5-EY85~6-AZ1383~6",
"legIds": [
"JAI-GOA:6E5237~5:EY203~5:EY85~6:AZ1383~6:0"
]
},
{
"id": "f03653ce738ae2e5msr:6E2405~5-AZ769~6-AZ1383~6",
"code": "6E2405~5-AZ769~6-AZ1383~6",
"legIds": [
"JAI-GOA:6E2405~5:AZ769~6:AZ1383~6:0"
]
}
],
"fares": [
{
"paymentFees": [
{
"paymentMethodId": 15,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 10,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
},
{
"paymentMethodId": 3,
"currencyCode": "USD",
"amount": 0,
"amountUsd": 0,
"totalAmount": 0,
"totalAmountUsd": 0
}
],
"id": "f03653ce738ae2e5msr:mytrip.com.us:7755cd345469a40f",
"price": {
"totalAmount": 465,
"totalAmountUsd": 464.88,
"amount": 465,
"amountUsd": 464.88,
"originalAmount": 464.88,
"originalAmountUsd": 464.88,
"amountPerAdult": 464.88,
"amountPerChild": 0,
"amountPerInfant": 0,
"taxAmount": 0,
"taxAmountUsd": 0,
"totalTaxAmount": 0,
"totalTaxAmountUsd": 0,
"currencyCode": "USD",
"paymentFeeAmountUsd": 0,
"bookingFee": 0,
"bookingFeeUsd": 0,
"totalBookingFee": 0,
"totalBookingFeeUsd": 0
},
"providerCode": "mytrip.com.us",
"handoffUrl": "https://handoff.wego.com/flights/continue?currency=USD&url_locale=en&site_code=US&device_type=desktop&app_type=WEB_APP&domain=www.wego.com&fare_id=f03653ce738ae2e5msr:mytrip.com.us:7755cd345469a40f&route=JAI-GOA&search_id=f03653ce738ae2e5msr&trip_id=JAI:GOA:2023-07-05&pwa=false&api_version=2&integration_code=mytrip.com®ion=ap-southeast-1&placement_type=metasearch",
"ecpc": 0.560586,
"remainingSeatsCount": 0,
"conditionIds": [
],
"legConditionIds": [
],
"refundable": false,
"exchangeable": false,
"tags": [
],
"score": 286.12,
"tripId": "f03653ce738ae2e5msr:I5773~5-AZ769~6-AZ1383~6"
}
]
}
It is just a sample API response. Some objects will have more attributes. New arrays will also be there.
In the JSON response, you may observe that many objects include references (IDs or codes) to objects from other lists. This pattern is employed in our API to prevent redundant data and reduce the overall size by allowing multiple objects to reference the same data.

Everything is associated with IDs
Sometimes you might have to make more than one API call to get complete data. Since, we compare a lot of airlines and vendors sometimes it becomes impossible to pull this much amount of data at once
.png?alt=media&token=b30002f8-1628-4ed5-a7ab-69bbe41d4d24)
Response Arrays
Above image will give you a clear idea of what data you will get in each array. The id you get in the
legs
array will help you find the trip
id in the trips
array and then finally using that trip id you can find the fares
array. This fares
array will provide you with all the pricing data for each trip.Last modified 3mo ago