Flight Data

FREE
By Travelpayouts
Updated 5 months ago
Travel
8.2/10
Popularity Score
1864ms
Latency
78%
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
GETGet_The prices for the alternative directions_
GETGet_Airline data in json format_
GETGet_Non-stop tickets_
GETGet_The popular directions from a city_
GETGet_The calendar of prices for a month_
GETGet_City data in json format_
GETGet_Tickets for each day of month_
GETGet_Airplane data in json format_
GETGet_Popular airline routes_
GETGet_Alliance data in json format_
GETGet_Special offers_
GETGet_The prices for the airline tickets_
GETGet_Airport data in json format_
GETGet_The calendar of prices for a week_
GETGet_Data of countries in json format_
GETGet_Cheapest tickets_
GETGet_The 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