The skypicker API is a nifty REST API for obtaining flight and airline data. skypicker is a thin NodeJS wrapper around the API.
npm install skypicker --save
searchLocationsByTermsearchLocationsByRadiussearchLocationsByBoxgetLocationByIdgetLocationDumpgetAirlinesgetAirlineIconsearchFlights
term: (required; string)- The search parameter used to identify a airport, city, country, etc.locale: (optional; string)- The returned output matches thelocalespecified. The default value isen.locationTypes: (optional; array)- There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in theLOCATION_TYPESconstant. The default behavior is to search all location types.limit: (optional; positive integer)- This specifies the number of records returned by the API. The default value is20.RESTAPI documentation
import { searchLocationsByTerm, LOCATION_TYPES } from 'skypicker';
const tenAirportsThatMatchLoganWithSpanishOutput = await searchLocationsByTerm({
term: 'Logan',
locale: 'es-ES',
locationTypes: [LOCATION_TYPES.AIRPORT],
limit: 10,
});coordinate: (required; object)- An object withlatitudeandlongitudeproperties that represents a pointradius: (optional; non-negative integer)- Represents thekilometersfrom the specifiedcoordinateto search. Defaults to250 kilometers.locale: (optional; string)- The returned output matches thelocalespecified. The default value isen.locationTypes: (optional; array)- There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in theLOCATION_TYPESconstant. The default behavior is to search all location types.limit: (optional; positive integer)- This specifies the number of records returned by the API. The default value is20.sort: (optional: LOCATION_RESULTS_SORT_TYPES)- Specifies whether output should be sorted bynameorrankin an ascending or descending mannerRESTAPI documentation
import { searchLocationsByRadius, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';
const tenAirportsWithinA100KilometerRadiusOfNewYorkCityWithSpanishOutput = await searchLocationsByRadius({
coordinate: {
latitude: 40.7128,
longitude: -74.0059,
},
radius: 100,
locale: 'es-ES',
locationTypes: [LOCATION_TYPES.AIRPORT],
limit: 10,
sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})lowCoordinate: (required; object)- Specifies acoordinateobject withlatitudeandlongitudeproperties that represent the southwest corner of the geo search box.highCoordinate: (required; object)- Specifies acoordinateobject withlatitudeandlongitudeproperties that represent the northeast corner of the geo search box.locale: (optional; string)- The returned output matches thelocalespecified. The default value isen.locationTypes: (optional; array)- There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in theLOCATION_TYPESconstant. The default behavior is to search all location types.limit: (optional; positive integer)- This specifies the number of records returned by the API. The default value is20.sort: (optional: LOCATION_RESULTS_SORT_TYPES)- Specifies whether output should be sorted bynameorrankin an ascending or descending mannerRESTAPI documentation
import { searchLocationsByBox, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';
const boxSearch = await searchLocationsByBox({
lowCoordinate: {
latitude: 40.200610,
longitude: -74.624328,
},
highCoordinate: {
latitude: 44.763212,
longitude: -73.376543,
},
locale: 'es-ES',
locationTypes: [LOCATION_TYPES.AIRPORT],
limit: 10,
sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})id: (required; string)- Specifies the IATA airport or ISO-3166 location codelocale: (optional; string)- The returned output matches thelocalespecified. The default value isen.RESTAPI documentation
locale: (optional; string)- The returned output matches thelocalespecified. The default value isen.locationTypes: (optional; array)- There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in theLOCATION_TYPESconstant. The default behavior is to search all location types.limit: (optional; positive integer)- This specifies the number of records returned by the API. The default value is20.sort: (optional: LOCATION_RESULTS_SORT_TYPES)- Specifies whether output should be sorted bynameorrankin an ascending or descending mannerRESTAPI documentation
import { getLocationDump, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';
const locationDump = await getLocationDump({
locationTypes: [LOCATION_TYPES.AIRPORT],
limit: 10,
sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})- Gets all airlines (both
LC (legacy carrier)andLCC (low-cost carrier)) - No parameters needed
RESTAPI documentation
airlineCode: (required; string)- Specifies the airline'sIATAcodeRESTAPI documentation
departureIdentifier: (required; string, array[string])- AnySkypickerlocation id(s), like airport codes, city IDs, two-letter country codes, etc.departureDateTimeRange: (required; object)- Specifies the departure date and time-of-day ranges. The departure date values should be inISO-8601format (YYYY-MM-DD), while the time of day values should be inHH:mmformat where the hour and minute values span00-23and00-59, respectively.
{
date: {
start: '2018-01-01',
end: '2018-01-15',
},
timeOfDay: {
start: '02:30',
end: '14:15',
},
};returnDepartureDateTimeRange: (required if round-trip flight; object)- Specifies the departure date and time-of-day ranges. Object should be in the same format as thedepartureDateTimeRangevariable.arrivalIdentifier: (optional; string, array[string])- AnySkypickerlocation id(s). If this is not specified, you'll get results for all airports in the worldmaximumHoursInFlight: (optional; non-negative integers)- Maximum flight duration, in hourspassengerCount: (optional; positive integers)- Number of passengers. Default value is1.directFlightsOnly: (optional; boolean)- Whentrue, only direct flights are considered. By default,false.currencyCode: (optional; string)- The currency in which prices and other relevant values are expressed. FollowsISO-4217currency codes. By default,EUR.priceRange: (optional; object)- Only tickets within the specified range are returned. Values should be represented as non-negative integers.
{
start: 0,
end: 100,
}maximumStopOverCount: (optional; non-negative integer)- Maximum number of stopoversairlinesFilter: (optional; object)- Either excludes or includes the specified airlines. TheairlinesFilterobject has two properties:airlines(anarrayofIATAcodes) andtype(anAIRLINES_FILTER_TYPEvalue).partner: (optional; string)- The Skypicker Partner ID assigned to your account. Usepickyfor testing.
{
airlines: [B6],
type: AIRLINES_FILTER_TYPE.EXCLUDE,
}locale: (optional; string)- The returned output matches thelocalespecified. The default value isen.offset: (optional; non-negative integer)- Specified for paginating through requestslimit: (optional; positive integer)- This specifies the number of records returned by the API. The default value is20.sortType: (optional; FLIGHT_RESULTS_SORT_TYPES)- Specifies whether to sort results by date, duration, price, or qualityRESTAPI documentation