RapidAPI logo

Flight Data

FREE
By Travelpayouts
Updated 6 months ago
Travel
8.2/10
Popularity Score
679ms
Latency
63%
Success Rate

Flight Data API Documentation

To access the API you must pass your token in the X-Access-Token header or in the token parameter. To obtain a token for the Data Access API, go to http://www.travelpayouts.com/developers/api.

Dates are accepted in the formats YYYY-MM and YYYY-MM-DD.

Dates and times are given in UTC, formatted according to ISO 8601. Prices are given in rubles as of when the ticket is put in the search results. It is not recommended to use expired prices (the approximate expiration date is given in the value of the expires_at parameter).

Important. We strongly urge receiving data in compressed GZIP format, which saves a significant amount of time in receiving the response. To get data in compressed form, send the header Accept-Encoding: gzip, deflate.

View API Details
GETThe prices for the alternative directions
GETAirline data in json format
GETNon-stop tickets
GETThe popular directions from a city
GETThe calendar of prices for a month
GETCity data in json format
GETTickets for each day of month
GETAirplane data in json format
GETPopular airline routes
GETAlliance data in json format
GETSpecial offers
GETThe prices for the airline tickets
GETAirport data in json format
GETThe calendar of prices for a week
GETData of countries in json format
GETCheapest tickets
GETThe prices for the alternative directions

Brings the prices for the directions between the nearest to the target cities back.

Authorization:

To use this API you need a token, which you can find on the Developers page. Every request requires authentication. To confirm your identity please pass this token using the X-Access-Token HTTP header.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
X-Access-TokenHEADER
REQUIREDYOUR_API_TOKEN_HERE
Required Parameters
destinationSTRING
REQUIREDthe point of destination. The IATA city code or the country code. The length - from 2 to 3 symbols
currencySTRING
REQUIREDthe airline tickets currency
depart_dateSTRING
REQUIREDday or month of departure
return_dateSTRING
REQUIREDday or month of return
originSTRING
REQUIREDthe point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols
Optional Parameters
flexibilitySTRING
OPTIONALexpansion of the range of dates upward or downward. The value may vary from 0 to 7, where 0 shall show the variants for the dates specified, 7 – all the variants found for a week prior to the specified dates and a week after
show_to_affiliatesSTRING
OPTIONALfalse - all the prices, true - just the prices, found using the partner marker (recommended)
limitSTRING
OPTIONALthe number of variants entered, from 1 to 20. Where 1 – is just the variant with the specified points of departure and the points of destination
distanceSTRING
OPTIONALthe number of variants entered, from 1 to 20. Where 1 – is just the variant with the specified points of departure and the points of destination
Code Snippet
unirest.get("https://travelpayouts-travelpayouts-flight-data-v1.p.rapidapi.com/v2/prices/nearest-places-matrix?destination=<required>&currency=<required>&depart_date=<required>&return_date=<required>&origin=<required>")
.header("X-RapidAPI-Host", "travelpayouts-travelpayouts-flight-data-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://travelpayouts-travelpayouts-flight-data-v1.p.rapidapi.com/v2/prices/nearest-places-matrix
Request Method: GET
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://travelpayouts-travelpayouts-flight-data-v1.p.rapidapi.com/v2/prices/nearest-places-matrix?destination=<required>&currency=<required>&depart_date=<required>&return_date=<required>&origin=<required>")
.header("X-RapidAPI-Host", "travelpayouts-travelpayouts-flight-data-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication