About API
Travelpayouts Data API — the way to get travel insights for your site or blog. You can get flight price trends and find popular destinations for your customers.
To access the API you should be registered in our travel affiliate network.
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 https://www.travelpayouts.com/programs/100/tools/api.
You can find more helpfull informaion in the Help center.
Flight Data Access API v1
Travelpayouts Flight Data API – the way to get travel insights for your site or blog. You can get flight price trends and find popular destinations for your customers.
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 https://www.travelpayouts.com/developers/api.
Dates are accepted in the formats YYYY-MM and YYYY-MM-DD.
The server response is always sent in JSON format with the following structure:
- success – true for a successful request, false in case of errors;
- data – a result of the request; in case of an error is equal to null;
- error – short description of the error that prevented request completion; for a successful request is equal to null.
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).
To obtain access to the API for searching for plane tickets and hotels, send a request.
Cheapest tickets
Returns the cheapest non-stop tickets, as well as tickets with 1 or 2 stops, for the selected route with departure/return date filters.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/v1/prices/cheap?origin=MOW&destination=HKT&depart_date=2019-11&return_date=2019-12' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v1/prices/cheap?origin=MOW&destination=HKT&depart_date=2019-11&return_date=2019-12")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v1/prices/cheap?origin=MOW&destination=HKT&depart_date=2019-11&return_date=2019-12",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v1/prices/cheap"
querystring = {"origin":"MOW","destination":"HKT","depart_date":"2019-11","return_date":"2019-12"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v1/prices/cheap?origin=MOW&destination=HKT&depart_date=2016-11&return_date=2016-12&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of the departure city. IATA code is shown by uppercase letters, for example, MOW. |
destination | - | IATA code of the destination city (for all routes, enter "-"). IATA code is shown by uppercase letters, for example, MOW. |
depart_date (optional) | - | Day or month of departure (yyyy-mm-dd or yyyy-mm). |
return_date (optional) | - | Day or month of return (yyyy-mm-dd or yyyy-mm). |
page | - | Optional parameter, is used to display the found data (by default the page displays 100 found prices. If the destination isn't selected, there can be more data. In this case, use the page, to display the next set of data, for example, page=2). |
token | - | Individual affiliate token. |
currency | RUB | Currency of prices |
Response
The above command returns JSON structured like this:
{
"success": true,
"data": {
"HKT": {
"0": {
"price": 35443,
"airline": "UN",
"flight_number": 571,
"departure_at": "2015-06-09T21:20:00Z",
"return_at": "2015-07-15T12:40:00Z",
"expires_at": "2015-01-08T18:30:40Z"
}}
}
}
Parameter | Default | Description |
---|---|---|
0, 1, 2 | - | Sequence number in the search results. |
price | - | Ticket price (in the currency specified in the currency parameter). |
airline | - | IATA code of the airline operating the flight. |
flight_number | - | Flight number. |
departure_at | - | Departure Date. |
return_at | - | Return Date. |
expires_at | - | Date on which the found price expires (UTC+0). |
token | - | Individual affiliate token. |
Non-stop tickets
Returns the cheapest non-stop tickets for the selected route with departure/return date filters.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/v1/prices/cheap?origin=MOW&destination=HKT&depart_date=2019-11&return_date=2019-12' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v1/prices/direct?origin=MOW&destination=LED&depart_date=2019-11&return_date=2019-12")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v1/prices/direct?origin=MOW&destination=LED&depart_date=2019-11&return_date=2019-12",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v1/prices/direct"
querystring = {"origin":"MOW","destination":"LED","depart_date":"2019-11","return_date":"2019-12"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v1/prices/direct?origin=MOW&destination=LED&depart_date=2016-11&return_date=2016-12&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of departure city. IATA code is shown by uppercase letters, for example, MOW. |
destination | - | IATA code of destination city (for all routes, enter “-”). IATA code is shown by uppercase letters, for example, MOW. |
depart_date (optional) | - | Day or month of departure (yyyy-mm-dd or yyyy-mm). |
return_date (optional) | - | Day or month of return (yyyy-mm-dd or yyyy-mm). |
token | - | Individual affiliate token. |
currency | RUB | Currency of prices |
Response
The above command returns JSON structured like this:
{
"success": true,
"data": {
"LED": {
"0": {
"price": 4363,
"airline": "UT",
"flight_number": 369,
"departure_at": "2015-06-27T11:35:00Z",
"return_at": "2015-07-04T16:00:00Z",
"expires_at": "2015-01-08T20:21:46Z"
}
}
}
}
Parameter | Default | Description |
---|---|---|
price | - | Ticket price (in specified currency). |
airline | - | IATA code of airline operating the flight. |
flight_number | - | Flight number. |
departure_at | - | Departure date. |
return_at | - | Return date. |
expires_at | - | Date on which the found price expires (UTC+0). |
Tickets for each day of a month
Returns the cheapest non-stop, one-stop, and two-stop flights for the selected route for each day of the selected month.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/v1/prices/calendar?depart_date=2019-11&origin=MOW&destination=BCN&calendar_type=departure_date¤cy=USD' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v1/prices/calendar?depart_date=2019-11&origin=MOW&destination=BCN&calendar_type=departure_date¤cy=USD")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v1/prices/calendar?depart_date=2019-11&origin=MOW&destination=BCN&calendar_type=departure_date¤cy=USD",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v1/prices/calendar"
querystring = {"depart_date":"2019-11","origin":"MOW","destination":"BCN","calendar_type":"departure_date","currency":"USD"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v1/prices/calendar?depart_date=2016-11&origin=MOW&destination=BCN&calendar_type=departure_date&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of departure city. IATA code is shown by uppercase letters, for example MOW. |
destination | - | IATA code of destination city. IATA code is shown by uppercase letters, for example MOW. |
departure_date | - | Day or month of departure (yyyy-mm-dd or yyyy-mm). |
return_date (optional) | - | Day or month of return (yyyy-mm-dd or yyyy-mm). Pay attention! If the return_date is not specified, you will get the "One way" flights. |
calendar_type | - | Field used to build the calendar. Equal to either: departure_date or return_date |
length (optional) | - | Length of stay in the destination city. |
token | - | Individual affiliate token. |
currency | RUB | Currency of prices |
Response
The above command returns JSON structured like this:
{
"success": true,
"data": {
"2015-06-01": {
"origin": "MOW",
"destination": "BCN",
"price": 12449,
"transfers": 1,
"airline": "PS",
"flight_number": 576,
"departure_at": "2015-06-01T06:35:00Z",
"return_at": "2015-07-01T13:30:00Z",
"expires_at": "2015-01-07T12:34:14Z"
}
}
}
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of departure city. |
destination | - | IATA code of destination city. |
price | - | Ticket price in the specified currency. |
transfers | - | Number of stops. |
airline | - | IATA code of airline. |
flight_number | - | Flight number. |
departure_at | - | Departure Date. |
return_at | - | Return Date. |
expires_at | - | When the found price expires (UTC+0). |
Cheapest tickets grouped by month
Returns the cheapest non-stop tickets, as well as tickets with 1 or 2 stops, for the selected route grouped by month.
HTTP Request
GET http://api.travelpayouts.com/v1/prices/monthly?currency=USD&origin=MOW&destination=HKT&token=PutHereYourToken
Request parameters
Example of request:
curl --request GET \
--url 'http://api.travelpayouts.com/v1/prices/monthly?currency=USD&origin=MOW&destination=HKT' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/http'
url = URI("http://api.travelpayouts.com/v1/prices/monthly?currency=USD&origin=MOW&destination=HKT")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.travelpayouts.com/v1/prices/monthly?currency=USD&origin=MOW&destination=HKT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://api.travelpayouts.com/v1/prices/monthly"
querystring = {"origin":"MOW","destination":"BCN","currency":"USD"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of departure city. IATA code is shown by uppercase letters, for example MOW. |
destination | - | IATA code of destination city. IATA code is shown by uppercase letters, for example MOW. |
currency | RUB | Currency of prices. |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success":true,
"data":{
"2019-07":{
"origin":"MOW",
"destination":"LON",
"price":166,
"transfers":1,
"airline":"W6",
"flight_number":7898,
"departure_at":"2019-07-31T14:10:00Z",
"return_at":"2019-08-31T19:15:00Z",
"expires_at":"2019-07-27T03:07:40Z"
}
},
"error":null,
"currency":"USD"
}
Response parameters
Parameter | Default | Description |
---|---|---|
origin | - | IATA code of departure city. |
destination | - | IATA code of destination city. |
price | - | Ticket price in the specified currency. |
transfers | - | Number of stops. |
airline | - | IATA code of airline. |
flight_number | - | Flight number. |
departure_at | - | Departure Date. |
return_at | - | Return Date. |
expires_at | - | When the found price expires (UTC+0). |
currency | - | Currency of prices. |
Popular airline routes
Returns routes for which an airline operates flights, sorted by popularity.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/v1/airline-directions?airline_code=SU&limit=10' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v1/airline-directions?airline_code=SU&limit=10")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v1/airline-directions?airline_code=SU&limit=10",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v1/airline-directions"
querystring = {"airline_code":"SU","limit":"10"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v1/airline-directions?airline_code=SU&limit=10&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
airline_code | - | IATA code of airline. |
limit | - | Records limit per page. Default value is 100. Not less than 1000. |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success": true,
"data": {
"MOW-BKK": 187491,
"MOW-BCN": 113764,
"MOW-PAR": 91889,
"MOW-NYC": 77417,
"MOW-PRG": 71449,
"MOW-ROM": 67190,
"MOW-TLV": 62132,
"MOW-HKT": 58549,
"MOW-GOI": 47341,
"MOW-IST": 45553
},
"error": null,
"currency":"rub"
}
Description of response
Returns a list of popular routes of an airline, sorted by popularity.
The popular directions from a city
Brings the most popular directions from a specified city back.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/v1/city-directions?origin=MOW¤cy=usd' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v1/city-directions?origin=MOW¤cy=usd")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v1/city-directions?origin=MOW¤cy=usd",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v1/city-directions"
querystring = {"origin":"MOW","currency":"usd"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v1/city-directions?origin=MOW¤cy=usd&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
currency | RUB | The airline tickets currency. |
origin | - | The point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols. |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success":true,
"data":{
"AER":{
"origin":"MOW",
"destination":"AER",
"price":3673,
"transfers":0,
"airline":"WZ",
"flight_number":125,
"departure_at":"2016-03-08T16:35:00Z",
"return_at":"2016-03-17T16:05:00Z",
"expires_at":"2016-02-22T09:32:44Z"
}
},
"error":null,
"currency":"rub"
}
Parameter | Default | Description |
---|---|---|
origin | - | The point of departure. |
destination | - | The point of destination. |
departure_at | - | The date of departure. |
return_at | - | The date of return. |
expires_at | - | Date on which the found price expires (UTC+0). |
number_of_changes | - | The number of transfers. |
price | - | The cost of a flight, in the currency specified. |
found_at | - | The time and the date, for which a ticket was found. |
transfers | - | The number of directs. |
airline | - | IATA of an airline. |
flight_number | - | Flight number. |
currency | - | Currency of response. |
Flight Data Access API v2
The server response is always sent in JSON format with the following structure:
- success – true for a successful request, false in case of errors;
- data – a result of the request; in case of an error is equal to null;
- error – short description of the error that prevented request completion; for a successful request is equal to null.
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).
The prices for the airline tickets
Brings back the list of prices found by our users during the most recent 48 hours according to the filters used.
Example of a request:
curl --request GET \
--url 'https://api.travelpayouts.com/v2/prices/latest?currency=usd&period_type=year&page=1&limit=30&show_to_affiliates=true&sorting=price&trip_class=0' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v2/prices/latest?currency=usd&period_type=year&page=1&limit=30&show_to_affiliates=true&sorting=price&trip_class=0")
https = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v2/prices/latest?currency=usd&period_type=year&page=1&limit=30&show_to_affiliates=true&sorting=price&trip_class=0",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v2/prices/latest"
querystring = {"currency":"usd","period_type":"year","page":"1","limit":"30","show_to_affiliates":"true","sorting":"price","trip_class":"0"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v2/prices/latest?currency=usd&period_type=year&page=1&limit=30&show_to_affiliates=true&sorting=price&trip_class=0&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
currency | RUB | The airline ticket’s currency. |
origin | - | The point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols. |
destination | - | The point of destination. The IATA city code or the country code. The length - from 2 to 3 symbols. |
beginning_of_period | - | The beginning of the period, within which the dates of departure fall (in the YYYY-MM-DD format, for example, 2016-05-01). Must be specified if period_type is equal to a month. |
period_type | - | The period for which the tickets have been found (the required parameter): year — for the whole time, month — for a month. |
one_way | false | true - one way, false - back-to-back. |
page | 1 | A page number. |
limit | 30 | The total number of records on a page. The maximum value - 1000. |
show_to_affiliates | true | false - all the prices, true - just the prices, found using the partner marker (recommended). |
sorting | price | The assorting of prices: price — by the price. For the directions, only city - city assorting by the price is possible; route — by the popularity of a route; distance_unit_price — by the price for 1 km. |
trip_duration | 1 | A page number. |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success": true,
"data": [
{
"show_to_affiliates": true,
"trip_class": 0,
"origin": "BKK",
"destination": "PHS",
"depart_date": "2018-02-09",
"return_date": "2018-02-11",
"number_of_changes": 0,
"value": 36.36,
"found_at": "2017-07-24T06:33:32+04:00",
"distance": 339,
"actual": true
}
]
}
Parameter | Description |
---|---|
Origin | The point of departure. |
destination | The point of destination. |
show_to_affiliates | False - all the prices, true — just the prices, found using the partner marker (recommended) |
trip_class | The flight class: 0 — the economy class, 1 — the business class, 2 — the first class. |
depart_date | The date of departure. |
return_date | The date of return. |
number_of_changes | The number of transfers. |
value | The cost of a flight, in the currency specified. |
found_at | The time and the date, for which a ticket was found. |
distance | The distance between the point of departure and the point of destination. |
actual | The actuality of an offer. |
token | Individual affiliate token. |
The calendar of prices for a month
Brings the prices for each day of a month, grouped together by the number of transfers, back.
Example of a request:
curl --request GET \
--url 'https://api.travelpayouts.com/v2/prices/month-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v2/prices/month-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT")
https = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v2/prices/month-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v2/prices/month-matrix"
querystring = {"currency":"usd","show_to_affiliates":"true","origin":"LED","destination":"HKT"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v2/prices/month-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT
Request parameters
Parameter | Default | Description |
---|---|---|
currency | RUB | The airline ticket’s currency |
origin | - | The point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols. |
destination | - | The point of destination. The IATA city code or the country code. The length - from 2 to 3 symbols. |
month | - | The beginning of the month in the YYYY-MM-DD format. |
show_to_affiliates | true | False - all the prices, true - just the prices, found using the partner marker (recommended). |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success":true,
"data":[{
"show_to_affiliates":true,
"trip_class":0,
"origin":"LED",
"destination":"HKT",
"depart_date":"2015-10-01",
"return_date":"",
"number_of_changes":1,
"value":29127,
"found_at":"2015-09-24T00:06:12+04:00",
"distance":8015,
"actual":true
}]
}
Parameter | Description |
---|---|
origin | The point of departure. |
destination | The point of destination. |
show_to_affiliates | False - all the prices, true - just the prices, found using the partner marker (recommended). |
trip_class | The flight class: 0 — The economy class, 1 — The business class, 2 — The first class. |
depart_date | The date of departure. |
return_date | The date of return. |
number_of_changes | The number of transfers. |
value | The cost of a flight, in the currency specified. |
found_at | The time and the date, for which a ticket was found. |
distance | The distance between the point of departure and the point of destination. |
actual | The actuality of an offer. |
The prices for the alternative directions
Brings the prices for the directions between the nearest to the target cities back.
Example of a request:
curl --request GET \
--url 'https://api.travelpayouts.com/v2/prices/nearest-places-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v2/prices/nearest-places-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT")
https = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v2/prices/nearest-places-matrix?currency=usd&show_to_affiliates=true&origin=LED&destination=HKT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v2/prices/nearest-places-matrix"
querystring = {"currency":"usd","show_to_affiliates":"true","origin":"LED","destination":"HKT"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v2/prices/nearest-places-matrix?currency=usd&origin=LED&destination=HKT&show_to_affiliates=true&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
currency | RUB | The airline ticket’s currency |
origin | - | The point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols. |
destination | - | The point of destination. The IATA city code or the country code. The length - from 2 to 3 symbols. |
limit | - | The 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. |
show_to_affiliates | true | False - all the prices, true - just the prices, found using the partner marker (recommended). |
depart_date** (optional) | - | Day or month of departure (yyyy-mm-dd or yyyy-mm). |
return_date** (optional) | - | Day or month of return (yyyy-mm-dd or yyyy-mm). |
flexibility | - | Expansion 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. |
distance | - | The 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. |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"prices":[{
"value":26000.0,
"trip_class":0,
"show_to_affiliates":true,
"return_date":"2016-09-18",
"origin":"BAX",
"number_of_changes":0,
"gate":"AMADEUS",
"found_at":"2016-07-28T04:57:47Z",
"duration":null,
"distance":3643,
"destination":"SIP",
"depart_date":"2016-09-09",
"actual":true
}],
"origins":[
"BAX"
],
"errors":{
"amadeus":{
}},
"destinations":[
"SIP"
]
}
Parameter | Description |
---|---|
origin | The point of departure. |
destination | The point of destination. |
show_to_affiliates | False - all the prices, true - just the prices, found using the partner marker (recommended). |
trip_class | The flight class: 0 — the economy class, 1 — the business class, 2 — the first class. |
depart_date | The date of departure. |
return_date | The date of return. |
number_of_changes | The number of transfers. |
value | The cost of a flight, in the currency specified. |
found_at | The time and the date, for which a ticket was found. |
distance | The distance between the point of departure and the point of destination. |
actual | The actuality of an offer. |
duration | Flight duration in minutes, taking into account direct and expectations. |
errors | If the error "Some error occurred" is returned, so in this area do not have the data in the cache. |
gate | The agents, which was found on the ticket. |
token | Individual affiliate token. |
The calendar of prices for a week
Brings the prices for the nearest dates to the target ones back.
Example of a request:
curl --request GET \
--url 'https://api.travelpayouts.com/v2/prices/week-matrix?currency=usd&origin=LED&destination=HKT&show_to_affiliates=true&depart_date=2017-11-04&return_date=2017-11-18' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/v2/prices/week-matrix?currency=usd&origin=LED&destination=HKT&show_to_affiliates=true&depart_date=2017-11-04&return_date=2017-11-18")
https = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/v2/prices/week-matrix?currency=usd&origin=LED&destination=HKT&show_to_affiliates=true&depart_date=2017-11-04&return_date=2017-11-18",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/v2/prices/week-matrix"
querystring = {"currency":"usd","origin":"LED","destination":"HKT","show_to_affiliates":"true","depart_date":"2017-11-04","return_date":"2017-11-18"}
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://api.travelpayouts.com/v2/prices/week-matrix?currency=usd&origin=LED&destination=HKT&show_to_affiliates=true&depart_date=2016-09-04&return_date=2016-09-18&token=PutHereYourToken
Request parameters
Parameter | Default | Description |
---|---|---|
currency | RUB | The airline tickets currency. |
origin | - | The point of departure. The IATA city code or the country code. The length - from 2 to 3 symbols. |
destination | - | The point of destination. The IATA city code or the country code. The length - from 2 to 3 symbols. |
show_to_affiliates | true | False - all the prices, true - just the prices, found using the partner marker (recommended). |
depart_date (optional) | - | Day or month of departure (yyyy-mm-dd or yyyy-mm). |
return_date (optional) | - | Day or month of return (yyyy-mm-dd or yyyy-mm). |
token | - | Individual affiliate token. |
Response
The above command returns JSON structured like this:
{
"success":true,
"data":[
{
"show_to_affiliates":true,
"trip_class":0,
"origin":"LED",
"destination":"HKT",
"depart_date":"2016-03-01",
"return_date":"2016-03-15",
"number_of_changes":1,
"value":71725,
"found_at":"2016-02-19T00:04:37+04:00",
"distance":8015,
"actual":true
}]
}
Parameter | Description |
---|---|
origin | The point of departure. |
destination | The point of destination. |
show_to_affiliates | False - all the prices, true - just the prices, found using the partner marker (recommended). |
trip_class | The flight class: 0 — the economy class, 1 — the business class, 2 — the first class. |
depart_date | The date of departure. |
return_date | The date of return. |
number_of_changes | The number of transfers. |
value | The cost of a flight, in the currency specified. |
found_at | The time and the date, for which a ticket was found. |
distance | The distance between the point of departure and the point of destination. |
actual | The actuality of an offer. |
The definition of a user's location by IP address
The query is returned the IATA-code and the name of the nearest city from the user.
Example of a request:
curl --request GET \
--url 'https://www.travelpayouts.com/whereami?locale=ru&callback=useriata&ip=62.105.128.0' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {:x_access_token => "YOUR_API_TOKEN_HERE"}
response = RestClient.get "https://www.travelpayouts.com/whereami?locale=ru&callback=useriata&ip=62.105.128.0", headers
puts response
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.travelpayouts.com/whereami?locale=ru&callback=useriata&ip=62.105.128.0",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
from urllib2 import Request, urlopen
headers = {"X-Access-Token": "YOUR_API_TOKEN_HERE"}
request = Request("https://www.travelpayouts.com/whereami?locale=ru&callback=useriata&ip=62.105.128.0", headers=headers)
response_body = urlopen(request).read()
print response_body
Request
GET https://www.travelpayouts.com/whereami?locale=ru&callback=useriata&ip=62.105.128.0
Request parameters
Parameter | Default | Description |
---|---|---|
locale | Russian | The language in which returns the name of the city (available languages: en, ru, de, fr, it, pl, th.); |
callback | - | Specifies the name of the function, which contains a response to a query (mandatory); |
ip | - | Ip-addresses of the users (if the address is not passed, the system determines IP from the header of the request). |
Response
The above command returns JSON structured like this:
useriata ({"iata": "MOW", "name": "Moscow"})
Parameter | Description |
---|---|
iata | IATA code of the city where the user is located; |
name | The name of the city. |
Special offers
Brings the recent special offers from the airline companies back in the XML format.
Request
GET https://api.travelpayouts.com/v2/prices/special-offers?token=PutHereYourToken
Some data in JSON format
Data of countries in JSON format
The query returns a file with a list of countries from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/en/countries.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = "https://api.travelpayouts.com/data/en/countries.json"
https = Net::HTTPS.new(url.host, url.port)
request = Net::HTTPS::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/en/countries.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/data/en/countries.json"
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers)
print(response.text)
Request
GET https://api.travelpayouts.com/data/en/countries.json
Response
The above command returns JSON structured like this:
[{
"code":"NC",
"name":"New Caledonia",
"currency":"XPF",
"name_translations":{
"de":"Neukaledonien",
"en":"New Caledonia",
"tr":"Yeni Kaledonya",
"ru":"Новая Каледония",
"fr":"Nouvelle-Caledonie",
"es":"Nueva Caledonia",
"it":"Nuova Caledonia"
}}
]
Parameter | Default | Description |
---|---|---|
code | - | IATA-code of country. |
name | - | Country name. |
currency | - | Currency country. |
name_translations | - | Translation of country name. |
City data in JSON format
The query returns a file with a list of cities from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/en/cities.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/data/en/cities.json")
https = Net::HTTPS.new(url.host, url.port)
request = Net::HTTPS::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/en/cities.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/data/en/cities.json"
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers)
print(response.text)
Request
GET https://api.travelpayouts.com/data/en/cities.json
Response
The above command returns JSON structured like this:
[{
"code":"SCE",
"name":"State College",
"coordinates":{
"lon":-77.84823,
"lat":40.85372
},
"time_zone":"America/New_York",
"name_translations":{
"de":"State College",
"en":"State College",
"zh-CN":"???",
"tr":"State College",
"ru":"Стейт Колледж",
"it":"State College",
"es":"State College",
"fr":"State College",
"th":"??????????"
},
"country_code":"US"
}]
Parameter | Default | Description |
---|---|---|
code | - | City IATA-code. |
name | - | City name. |
coordinates | - | City coordinates. |
time_zone | - | Timezone relative to GMT. |
name_translations | - | Translation of city name. |
country_code | - | Country IATA-code. |
Airport data in json format
The query returns a file with a list of airports from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/en/airports.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/data/en/airports.json")
https = Net::HTTPS.new(url.host, url.port)
request = Net::HTTPS::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/en/airports.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/data/en/airports.json"
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers)
print(response.text)
Request
GET https://api.travelpayouts.com/data/en/airports.json
Response
The above command returns JSON structured like this:
[{
"code":"MQP",
"name":"Kruger Mpumalanga International Airport",
"coordinates":{
"lon":31.098131,
"lat":-25.384947
},
"time_zone":"Africa/Johannesburg",
"name_translations":{
"de":"Nelspruit",
"en":"Kruger Mpumalanga International Airport",
"tr":"International Airport",
"it":"Kruger Mpumalanga",
"fr":"Kruger Mpumalanga",
"es":"Kruger Mpumalanga",
"th":"???????????????"
},
"country_code":"ZA",
"city_code":"NLP"
}]
Parameter | Default | Description |
---|---|---|
code | - | Airport IATA code. |
name | - | Airport name. |
lon | - | Airport longitude. |
lat | - | Airport latitude. |
time_zone | - | Time zone relative to GMT. |
name_translations | - | The name of the airport in different languages. |
country_code | - | Country IATA code. |
city_code | - | City IATA code. |
Airline data in JSON format
The query returns a file with a list of airlines from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/en/airlines.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'uri'
require 'net/https'
url = URI("https://api.travelpayouts.com/data/en/airlines.json")
https = Net::HTTPS.new(url.host, url.port)
request = Net::HTTPS::Get.new(url)
request["x-access-token"] = '321d6a221f8926b5ec41ae89a3b2ae7b'
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/en/airlines.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.travelpayouts.com/data/en/airlines.json"
headers = {'x-access-token': '321d6a221f8926b5ec41ae89a3b2ae7b'}
response = requests.request("GET", url, headers=headers)
print(response.text)
Request
GET https://api.travelpayouts.com/data/en/airlines.json
Response
The above command returns JSON structured like this:
[{
"name":"Private flight",
"alias":null,
"iata":null,
"icao":null,
"callsign":null,
"country":null,
"is_active":true
}]
Parameter | Default | Description |
---|---|---|
name | - | Airline name. |
alias | - | Alliance name (if the airline is an alliance member). |
iata | - | Airline IATA code. |
icao | - | Airline ICAO code. |
callsign | - | Airline call sign. |
country | - | Airline country of registration. |
is_active | - | True: company is active, false: company is not active. |
Alliance data in JSON format
The query returns a file with a list of alliances from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/en/airlines_alliances.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {:x_access_token => "YOUR_API_TOKEN_HERE"}
response = RestClient.get "https://api.travelpayouts.com/data/en/airlines_alliances.json", headers
puts response
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/en/airlines_alliances.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
from urllib2 import Request, urlopen
headers = {"X-Access-Token": "YOUR_API_TOKEN_HERE"}
request = Request("https://api.travelpayouts.com/data/en/airlines_alliances.json", headers=headers)
response_body = urlopen(request).read()
print response_body
Request
GET https://api.travelpayouts.com/data/en/airlines_alliances.json
Response
The above command returns JSON structured like this:
[{
"name":"oneworld",
"airlines":["4M","AA","AB","BA"]
}]
Parameter | Default | Description |
---|---|---|
name | - | Alliance name. |
airlines | - | Codes for alliance member companies. |
Airplane data in json format
The query returns a file with a list of airplanes from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/planes.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {:x_access_token => "YOUR_API_TOKEN_HERE"}
response = RestClient.get "https://api.travelpayouts.com/data/planes.json", headers
puts response
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/planes.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
from urllib2 import Request, urlopen
headers = {"X-Access-Token": "YOUR_API_TOKEN_HERE"}
request = Request("https://api.travelpayouts.com/data/planes.json", headers=headers)
response_body = urlopen(request).read()
print response_body
Request
GET https://api.travelpayouts.com/data/planes.json
Response
The above command returns JSON structured like this:
[{
"code":"100",
"name":"Fokker 100"
}]
Parameter | Default | Description |
---|---|---|
code | - | Plane IATA code. |
name | - | Plane name. |
Routes list in json format
The query returns a file with a list of routes from the database.
Request example
curl --request GET \
--url 'https://api.travelpayouts.com/data/routes.json' \
--header 'x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b'
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {:x_access_token => "YOUR_API_TOKEN_HERE"}
response = RestClient.get "https://api.travelpayouts.com/data/routes.json", headers
puts response
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.travelpayouts.com/data/routes.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: 321d6a221f8926b5ec41ae89a3b2ae7b"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
from urllib2 import Request, urlopen
headers = {"X-Access-Token": "YOUR_API_TOKEN_HERE"}
request = Request("https://api.travelpayouts.com/data/routes.json", headers=headers)
response_body = urlopen(request).read()
print response_body
Request
GET https://api.travelpayouts.com/data/routes.json
Response
The above command returns JSON structured like this:
[{
"airline_iata":"2B",
"airline_icao":null,
"departure_airport_iata":"AER",
"departure_airport_icao":null,
"arrival_airport_iata":"DME",
"arrival_airport_icao":null,
"codeshare":false,
"transfers":0,
"planes":[
"CR2"
]
}]
Parameter | Default | Description |
---|---|---|
airline_iata | - | IATA of an airline. |
airline_icao | - | ICAO of an airline. |
departure_airport_iata | - | IATA of an airport of departure. |
departure_airport_icao | - | ICAO of an airport of departure. |
arrival_airport_iata | - | IATA of an airport of arrival. |
arrival_airport_icao | - | ICAO of an airport of arrival. |
codeshare | - | It shows whether the flight performs the same company that sells the ticket. |
transfers | - | The number of directs. |
planes | - | IATA of an airplane. |
Flights search API: Real-time and multi-city search
With the help of API, you can get the results of requests in real time and create a Multi-City search.
By default, one partner may send no more than 200 queries per hour for one IP, using the airline tickets search API. This restriction may be changed if a situation so requires.
Аccess to the flights search API
Requirements for Search API
- Each search query must be initiated by the user and the results must be shown to the user in full. The results for each query must contain a “buy" button next to each flight option.
- The reference to the agency's website must be received only when the user clicks the "Buy" button. Automatic collection of all links from the answer is prohibited. Violation of this rule will disable the API search for the partner.
- It's forbidden to use our search API with the API of other metasearches of flights.
- It's forbidden to use requests with localhost IP addresses (127.0.0.1-127.255.255.255).
- It's forbidden to automatically collect data from search results using the search API.
- Page with found flights should be hidden from search engine bots using the robots.txt file. For example, if flights tickets are displayed on the page www.sitename.com/search, then robots.txt should contain the lines:
User-Agent: * Disallow: /search/
- The conversion rate for searches via the Buy link must be 9% or more. The conversion rate from the Buy button to actual purchases must be at least 5%.
- Ajax requests to the API don’t work because the access token is passed unencrypted. You must make requests to the API from the server.
How to get access
To access the flights search API you should be registered in our travel affiliate program and submit your request on with the following information:
- URL of your website;
- Design prototypes of a search result;
- Description of your project;
- How you will use the search API?
- Why aren’t the standard methods of integration (search forms, White Label, API access to data) suitable for you.
- Requirements for flights search API access.
Roundtrip
Body example
{
"signature": "MD5_signature",
"marker": "Put_Your_Marker_Here",
"host": your_server_host,
"user_ip": user_ip_address,
"locale": "en",
"trip_class": "Y",
"passengers": {
"adults": 1,
"children": 0,
"infants": 0
},
"segments": [
{
"origin": "MOW",
"destination": "LON",
"date": "2018-05-25"
},
{
"origin": "LON",
"destination": "MOW",
"date": "2018-06-18"
}
]
}
Request parameters
Parameter | Type | Description |
---|---|---|
marker | string | the unique identifier of the affiliate. You can find your marker in the affiliate personal account |
host | string | host's request (must be replaced by the address of your website where the API will be used) |
user_ip | string | user's IP address |
locale | string | language of the search result (en-us, en-gb, ru, de, es, fr, pl). Аrom the locale depends on the set of agencies on which the search is performed |
trip_class | string | flight class (Y – Economy, C – Business) |
passengers | — | passenger Information |
adults | integer | the number of adult passengers (from 1 to 9) |
children | integer | the number of children (from 0 to 6) |
infants | integer | the number of infants (from 0 to 6) |
segments | — | a list of the trip components: |
know_english | string | an parameter responsible for the presence of English-speaking gates in the output. Accepted values: true (if it is necessary to display English-language gates to the user) and false (false by default) |
currency | string | the currency in which the price of the ticket is displayed, after switching to the agency's website (provided that the agency supports this currency) |
signature | string | the request signature is constructed from token, marker, and all the values of the query parameters sorted alphabetically and separated by a colon. Learn how to create a signature look here |
To get "Round trip" tickets, add a JSON to the body of the request:
Request example
curl -v -X POST -d '{"signature":"%MD5_signature%","marker":"%Put_Your_Marker_Here%","host":"beta.as.ru","user_ip":"127.0.0.1","locale":"ru","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"MOW","destination":"LON","date":"2021-05-25"},{"origin":"LON","destination":"MOW","date":"2021-06-18"}]}' -H 'Content-type:application/json' https://api.travelpayouts.com/v1/flight_search
Response
The answer comes in JSON format. The response contains the parameters:
{
"chain_name": "jetradar_rt_search_native_format",
"locale": "en",
"user_env": {
},
"meta": {
"uuid": "d9266de5-7578-418f-9ddc-6b176ae45923"
},
"host": "beta.aviasales.ru",
"segments": [
{
"origin": "CPH",
"original_origin": "CPH",
"origin_country": "DK",
"destination": "ROM",
"date": "2021-06-24",
"destination_country": "IT",
"original_destination": "ROM"
},
{
"origin": "ROM",
"original_origin": "ROM",
"origin_country": "IT",
"destination": "CPH",
"date": "2021-06-25",
"destination_country": "DK",
"original_destination": "CPH"
}
],
"affiliate_has_sales": true,
"show_ads": true,
"destination_country": "IT",
"passengers": {
"children": 0,
"adults": 1,
"infants": 0
},
"currency_rates": {
"lak": 0.0075,
"czk": 2.95961
},
"travelpayouts_api_request": true,
"auid": null,
"server_name": "zoo39.int.avs.io.yasen.bee.13",
"know_english": "false",
"currency": "usd",
"range": "false",
"geoip_city": "Unknown",
"metropoly_airports": {
"CPH": [
"CPH",
"CPH",
"ZGH",
"RKE"
],
"ROM": [
"ROM",
"IRR",
"FCO",
"ROM",
"XRJ",
"IRT",
"CIA"
]
},
"search_depth": 60,
"signature": "fb7ded0ddd86270a262d832322f46093",
"trip_class": "Y",
"affiliate": true,
"initiated_at": "2021-04-26 05:09:42.031853",
"user_id": null,
"start_search_timestamp": 1524719382.03045,
"gates_count": 0,
"market": "dk",
"user_ip": null,
"internal": false,
"_ga": null,
"clean_marker": "xxxxx",
"open_jaw": false,
"origin_country": "DK",
"marker": "xxxxx",
"search_id": "d9266de5-7578-418f-9ddc-6b176ae45923",
"geoip_country": "Unknown"
}
Parameter | Description |
---|---|
locale | the language of the search result |
search_id | the unique identifier for the search query used to search results |
geoip_city | the geoip of the city where the request was made |
trip_class | the class of trip |
affiliate | the affiliate ID |
marker | the unique identifier of the affiliate |
user_ip | the user's IP address |
gates_count | the total number of agencies |
segments | a list of the trip components: |
meta | technical information |
uuid | unique identifier of the request |
passengers | passenger information |
adults | the number of adult passengers |
children | the number of children |
infants | the number of infants |
host | host's request |
currency_rates | exchange rate |
geoip_country | the geoip of the country where the request was made |
One way
Request initialization
To get "One-way" tickets, add a JSON into the body of the request.
Body example
{
"signature": "%MD5_signature%",
"marker": "%Put_Your_Marker_Here%",
"host": "beta.as.ru",
"user_ip": "127.0.0.1",
"locale": "ru",
"trip_class": "Y",
"passengers": {
"adults": 1,
"children": 0,
"infants": 0
},
"segments": [
{
"origin": "MOW",
"destination": "LED",
"date": "2021-06-18"
}
]
}
Request parameters
Parameter | Type | Description |
---|---|---|
marker | string | the unique identifier of the affiliate. You can find your marker in the affiliate personal account |
host | string | host's request (must be replaced by the address of your website where the API will be used) |
user_ip | string | user's IP address |
locale | string | language of the search result (en-us, en-gb, ru, de, es, fr, pl). Аrom the locale depends on the set of agencies on which the search is performed |
trip_class | string | flight class (Y – Economy, C – Business) |
passengers | — | passenger Information |
adults | integer | the number of adult passengers (from 1 to 9) |
children | integer | the number of children (from 0 to 6) |
infants | integer | the number of infants (from 0 to 6) |
segments | — | a list of the trip components: |
know_english | string | an parameter responsible for the presence of English-speaking gates in the output. Accepted values: true (if it is necessary to display English-language gates to the user) and false (false by default) |
currency | string | the currency in which the price of the ticket is displayed, after switching to the agency's website (provided that the agency supports this currency); |
signature | string | the request signature is constructed from token, marker, and all the values of the query parameters sorted alphabetically and separated by a colon. Learn how to create a signature look here. |
To get data, use the initialization code of the search:
Request example
curl -v -X POST -d '{"signature":"%MD5_signature%","marker":"%Put_Your_Marker_Here%","host":"beta.as.ru","user_ip":"127.0.0.1","locale":"ru","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"MOW","destination":"LED","date":"2021-06-18"}]}' -H 'Content-type:application/json' https://api.travelpayouts.com/v1/flight_search
Open jaw
Request initialization
Open jaw is a round-trip ticket in which the traveller does not arrive in the same city of departure and/or does not depart from the same city where he/she first landed. For example, London — Paris — Berlin — London.
To get "Open jaw" tickets, add a JSON into the body of the request:
Body example
{
"signature": "%MD5_signature%",
"marker": "%Put_Your_Marker_Here%",
"host": "beta.as.ru",
"user_ip": "127.0.0.1",
"locale": "ru",
"trip_class": "Y",
"passengers": {
"adults": 1,
"children": 0,
"infants": 0
},
"segments": [
{
"origin": "MOW",
"destination": "LED",
"date": "2021-02-18"
},
{
"origin": "LED",
"destination": "BER",
"date": "2021-02-25"
},
{
"origin": "BER",
"destination": "LON",
"date": "2021-03-05"
}
]
}
Request parameters
Parameter | Type | Description |
---|---|---|
marker | string | the unique identifier of the affiliate. You can find your marker in the affiliate personal account |
host | string | host's request (must be replaced by the address of your website where the API will be used) |
user_ip | string | user's IP address |
locale | string | language of the search result (en-us, en-gb, ru, de, es, fr, pl). Аrom the locale depends on the set of agencies on which the search is performed |
trip_class | string | flight class (Y – Economy, C – Business) |
passengers | — | passenger Information |
adults | integer | the number of adult passengers (from 1 to 9) |
children | integer | the number of children (from 0 to 6) |
infants | integer | the number of infants (from 0 to 6) |
segments | — | a list of the trip components: |
know_english | string | an parameter responsible for the presence of English-speaking gates in the output. Accepted values: true (if it is necessary to display English-language gates to the user) and false (false by default) |
currency | string | the currency in which the price of the ticket is displayed, after switching to the agency's website (provided that the agency supports this currency); |
signature | string | the request signature is constructed from token, marker, and all the values of the query parameters sorted alphabetically and separated by a colon. Learn how to create a signature look here. |
To get data, use the initialization code of the search:
Request example
curl -v -X POST -d '{"signature":"%MD5_signature%","marker":"%Put_Your_Marker_Here%","host":"beta.as.ru","user_ip":"127.0.0.1","locale":"ru","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"MOW","destination":"LED","date":"2017-06-18"},{"origin":"LED","destination":"BER","date":"2021-06-25"},{"origin":"BER","destination":"LON","date":"2021-07-05"}]}' -H 'Content-type:application/json' https://api.travelpayouts.com/v1/flight_search
Getting search results
In the body of the response is the parameter search_id; insert it into the URL:
https://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%
Then send the request to the server for search results:
GET https://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%
Request example
curl -v -H 'Accept-Encoding:gzip,deflate,sdch' https://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%
--compressed
Request example
Response example
[{
"segments":[
{
"destination_country":"RU",
"original_destination":"LED",
"origin":"MOW",
"origin_country":"RU",
"original_origin":"MOW",
"date":"2021-05-25",
"destination":"LED"
},
{
"destination_country":"RU",
"original_destination":"MOW",
"origin":"LED",
"origin_country":"RU",
"original_origin":"LED",
"date":"2021-06-18",
"destination":"MOW"
}],
"banner_info":{
},
"internal":false,
"airports":{
"LED":{
"name":"Пулково",
"time_zone":"Europe/Moscow",
"country":"Россия",
"rates":"259",
"city":"Санкт-Петербург"
},
"DME":{
"name":"Домодедово",
"time_zone":"Europe/Moscow",
"country":"Россия",
"rates":"392",
"city":"Москва"
},
"SVO":{
"rates":"307",
"country":"Россия",
"name":"Шереметьево",
"average_rate":"3.63",
"city":"Москва",
"time_zone":"Europe/Moscow"
},
"VKO":{
"name":"Внуково",
"time_zone":"Europe/Moscow",
"country":"Россия",
"rates":"211",
"city":"Москва"
}},
"gates_info":{
"20":{
"average_rate":4.43,
"rates":2967,
"currency_code":"rub",
"is_airline":false,
"productivity":16.9991,
"label":"OneTwoTrip",
"airline_iatas":{
},
"payment_methods":[
"card"
],
"mobile_version":false
}},
"city_distance":634,
"meta":{
"uuid":"c9c6de8c-3fb4-404e-b88c-e9e0a605f183",
"gates":[
{
"duration":22.402996063232422,
"id":20,
"count":1456,
"good_count":1456
}]},
"airlines":{
"SU":{
"average_rate":"4.01",
"rates":"2362",
"alliance_name":"SkyTeam",
"name":"Аэрофлот",
"id":10
},
"UN":{
"average_rate":"3.98",
"rates":"2639",
"alliance_name":null,
"name":"Трансаэро",
"id":492
},
"S7":{
"average_rate":"3.95",
"rates":"2430",
"alliance_name":"OneWorld",
"name":"S7",
"id":444
},
"UT":{
"rates":"1843",
"alliance_name":null,
"name":"ЮТэйр",
"id":507
},
"U6":{
"average_rate":"3.62",
"rates":"1158",
"alliance_name":null,
"name":"Уральские авиалинии",
"id":503
}},
"filters_boundary":{
"arrival_datetime_0":{
"min":1418869200,
"max":1418950500
},
"arrival_datetime_1":{
"min":1419486600,
"max":1419554400
},
"flights_duration":{
"min":70,
"max":120
},
"stops_count":{
"0":4431
},
"departure_time_1":{
"min":"04:30",
"max":"22:55"
},
"departure_time_0":{
"min":"00:50",
"max":"23:30"
},
"departure_minutes_0":{
"min":50,
"max":1410
},
"departure_minutes_1":{
"min":270,
"max":1375
},
"price":{
"min":4431,
"max":8689
}},
"flight_numbers":[
[
"SU30",
"SU32"
],
[
"SU31",
"SU33"
]],
"affiliate_has_sales":false,
"proposals":[
{
"terms":{
"20":{
"currency":"rub",
"price":18418,
"unified_price":18418,
"url":18000000,
"multiplier":1e-06,
"proposal_multiplier":1,
"flights_baggage":[
[
false
],
[
false
]
],
"flights_handbags":[
[
"1PC10"
],
[
"1PC10"
]
],
"baggage_source":[
[
3
],
[
3
]
],
"handbags_source":[
[
3
],
[
3
]
]
}},
"xterms":{
"180":{
"Y_0PC;Y_0PC":{
"currency":"rub",
"price":18418,
"unified_price":18418,
"url":18000000,
"multiplier":1e-06,
"proposal_multiplier":1,
"flights_baggage":[
[
false
],
[
false
]
],
"flights_handbags":[
[
"1PC10"
],
[
"1PC10"
]
],
"baggage_source":[
[
3
],
[
3
]
],
"handbags_source":[
[
3
],
[
3
]
]
}
}
},
"sign":"7573ea707c2ff84b243241961412ed34",
"segment":[
{
"flight":[
{
"arrival":"LED",
"aircraft":"AIRBUS A320",
"local_departure_timestamp":1434588600,
"operating_carrier":"UT",
"duration":85,
"local_arrival_timestamp":1432549200,
"departure_date":"2021-05-25",
"departure_time":"11:00",
"arrival_date":"2021-05-25",
"arrival_time":"12:25",
"delay":0,
"departure":"VKO",
"number":369
}]},
{
"flight":[
{
"arrival":"DME",
"aircraft":"AIRBUS A320",
"local_departure_timestamp":1434588600,
"operating_carrier":"SU",
"duration":90,
"local_arrival_timestamp":1432549200,
"departure_date":"2021-06-18",
"departure_time":"10:05",
"arrival_date":"2021-06-18",
"arrival_time":"11:35",
"delay":0,
"departure":"LED",
"number":6131
}]}]},
]}],
"validating_carrier": "SU"
}],
"_ga":null,
"signature":"4bb635b9353a1e933907d41841e23414",
"search_id":"c9c6de8c-3fb4-404e-b88c-e9e0a605f183"
},
{
"search_id":"c9c6de8c-3fb4-404e-b88c-e9e0a605f183"
}]
The response includes the data:
Parameter | Description |
---|---|
search_id | unique identifier for the search query |
flight_numbers | umbers of the flight |
meta | |
uuid | request ID; |
city_distance | distance between the cities of origin and destination; |
gates_info | information about the agent (Ticket Seller): |
signature | signature of request |
segments | array data of flights: |
flight_numbers | flight numbers |
airlines | information about the airlines: |
proposals | an array of variants |
sign | unique id of the ticket, to integrate information from different agencies in one ticket; |
flight | flight details: |
rating | internal information about flight rating |
terms | information about the flight’s cost: |
stops_airports | IATA codes of departure airports, destination and transfers; |
airports | information about airports; |
xterms | contains information similar to terms, plus may contain additional data on tariffs (if it is transmitted from agencies / airlines) |
is_direct | true if the flight is non-stop |
segments_airports | IATA codes of the main departure and destination airports |
is_charter | flight is charter or not (false or true) |
segment_durations | total flights duration (for example, there and back) |
total_duration | total flight time with stops time |
max_stops | maximum number of stops |
segments_rating, flight_weight, popularity, tags | system parameters |
market | market of routes (deprecated); |
initiated_at | date and time of search (deprecated); |
open_jaw | true if it is part of open jaw (deprecated); |
clean_marker | affiliate marker (deprecated); |
currency | currency type (deprecated); |
filters_boundary | array data for filtering: |
Additional Information in the response
Some airline companies and agencies provide additional information about flights, aircraft, and onboard services. These fields and their content are described below. You may use this information on your websites or ignore it — the main information about the tickets is given above.
Parameter | Description |
---|---|
banner_info | service information provided by an airline company |
airlines/AF/ | information from a specific airline company (where AF is the IATA designator code):
|
frequentFlyerPrograms | loyalty program for clients |
aircrafts | the number of aircraft owned by an airline company |
carryOnStandard | presence of a hand-luggage transportation standard |
lowcost | is/not a low-cost airline company |
freeCheckedBag | opportunity for luggage transportation for free within the extent permissible |
meals | airline company’s on-board types of menus |
checkin | ways to register provided by an airline company:
|
How to get a link to the agency website
Request example
curl -v -H 'Accept-Encoding:gzip,deflate,sdch' https://api.travelpayouts.com/v1/flight_searches/%search_id%/clicks/%terms.url%.json
--compressed
To get a link to the site of the ticket booking agencies send a request to the following address:
GET https://api.travelpayouts.com/v1/flight_searches/%search_id%/clicks/%terms.url%.json
where search_id is the ID from the answer of the request, terms.url — URL parameter from the response.
You will receive a response like in the example.
Response example
{
"params": {},
"method": "GET",
"url": "https://www.svyaznoy.travel/?utm_source=as.ru&utm_medium=cpa&utm_campaign=meta_avia#MOW0906/BKK1506/A1/C0/I0/S0/22316/EK-132;EK-374/EK-373;EK-131&marker=7uh46i0v2",
"gate_id": 62,
"click_id": 22135952358110
}
To move on to the booking, give your visitors a link from the parameter "url"
.
The “lifetime” of such links is 15 minutes, after which you will need to search again for the current prices and generate a new reference to the transition.
In our example, this is a link of the form:
https://www.svyaznoy.travel/?utm_source=as.ru&utm_medium=cpa&utm_campaign=meta_avia#MOW0906/BKK1506/A1/C0/I0/S0/22316/EK-132;EK-374/EK-373;EK-131&marker=7uh46i0v2
Hotels data API
Authorization
The authorization is based on affilliate token.
Hotel search by name or location
Search for a specific location or name places of a hotel (city, island).
Attention! If you send a request without a token, the number of queries will be limited. The values of restrictions are passed in the response header:
- X-Ratelimit-Interval - limit interval in seconds
- X-Ratelimit-Remaining - how many requests left of this limit
- X-Ratelimit-Limit - the value limit
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/lookup.json?query=moscow&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/lookup.json?query=moscow&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/lookup.json?query=moscow&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/lookup.json"
querystring = {"query":"moscow","lang":"ru","lookFor":"both","limit":"1","token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/lookup.json?query=moscow&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere
Request parameters
Required parameters are highlighted in bold.
- query – main parameter, it is set:
- as a text
- by longitude and latitude (also displays the nearest objects)
- lang – display language. It can take any iso-language code (pt, en, fr, de, id, it, pl, es, th, ru); if the database doesn’t include a translation for the requested language, it returns the English name of the object. By default, lang="en"
- lookFor – objects displayed in the results:
- city
- hotel
- both (city&hotel)
- limit – limitation of output results from 1 to 10, default - 10
- convertCase – automatically change the keyboard layout (actual for Russian users, for example, when requesting "vjcrdf" will be found "москва"). Values - 1 or 0. Default - 1
- token - your affiliate token
Response
Sample response
{
"results": {
"locations": [
{
"cityName": "Москва",
"fullName": "Москва, Россия",
"countryCode": "RU",
"countryName": "Россия",
"iata": [
"BKA",
"DME",
"SVO",
"VKO",
"MOW"
],
"id": "12153",
"hotelsCount": "930",
"location": {
"lat": "55.752222200",
"lon": "37.615555600"
},
"_score": 3.2695
}
],
"hotels": [
{
"label": "Отель Novotel Moscow City",
"locationName": "Москва, Россия",
"locationId": "12153",
"id": "1074388",
"fullName": "Отель Novotel Moscow City, Москва, Россия",
"location": {
"lat": "55.747160",
"lon": "37.539302"
}
}
]
},
"status": "ok"
}
The block "locations" includes:
- cityName – city name
- fullName – name of city and country
- countryCode – IATA code of country
- countryName – country name
- iata – IATA airport code in this city, there may be several
- id – location id in the database
- hotelsCount – number of hotels in this location
- location:
- lat – latitude of location
- lon – longitude of location
- score – internal parameter, used for sorting
- token - your affiliate token
The block "hotels" includes:
- label – name of hotel
- locationName – location of hotel
- locationId – location id in the database
- Id – hotel id in the database
- fullName – full name of the hotel and the location of it
- location:
- lat – latitude of hotel
- lon – longitude of hotel
Searching a hotel or location by coordinates
Search for a specific location or hotel (city, island) by coordinates.
Attention! If you send a request without a token, the number of queries will be limited. The values of restrictions are passed in the response header:
- X-Ratelimit-Interval - limit interval in seconds
- X-Ratelimit-Remaining - how many requests left of this limit
- X-Ratelimit-Limit - the value limit
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/lookup.json?query=55.0291,82.9059&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/lookup.json?query=55.0291,82.9059&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/lookup.json?query=55.0291,82.9059&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/lookup.json"
querystring = {"query":"55.0291,82.9059","lang":"ru","lookFor":"both","limit":"1","token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/lookup.json?query=55.0291,82.9059&lang=ru&lookFor=both&limit=1&token=PasteYourTokenHere
Request parameters
Required parameters are highlighted in bold.
- query – main parameter, it is set:
- as a text
- by the longitude and latitude (also displays the nearest objects)
- lang – display language. It can take any iso-language code (pt, en, fr, de, id, it, pl, es, th, ru) - if the database doesn’t include a translation for the requested language, it returns the English name of the object. By default lang="en"
- lookFor – objects displayed in the results:
- city
- hotel
- both (city&hotel)
- limit – limitation of output results from 1 to 10, default - 10
- convertCase – automatically change the keyboard layout (actual for Russian users, for example, when requesting "vjcrdf" will be found "москва"). Values - 1 or 0. Default - 1
- token - your affiliate token
Response
Sample response
{
"results": {
"locations": [
{
"id": "12167",
"type": "City",
"countryIso": "RU",
"name": "Новосибирск",
"state": "",
"fullname": "Новосибирск, Россия",
"geo": {
"lat": "55.028705000",
"lon": "82.906898000"
}
}
],
"hotels": [
{
"id": "380923",
"name": "AZIMUT Отель Сибирь",
"locationId": "12167",
"location": {
"lat": "55.029140",
"lon": "82.905990"
}
}
]
},
"status": "ok"
}
The block "locations" includes:
- id – id of locations in the database
- type – type of locations (city, isle)
- countryIso – country code
- name – name of locations
- state – code of state
- fullname – full name of the location with the name of the country
- geo:
- lat – latitude of location
- on – longitude of location
The block "hotels" includes:
- Id – id of hotel in the database
- name – name of hotel
- locationId – location id in the database
- location:
- lat – latitude of hotel
- lon – longitude of hotel
Displays the cost of living in hotels
The request is used to get the price of hotel rooms from the cache for the period. It doesn't contain information about room availability.
Attention! If you send a request without a token, the number of queries will be limited. The values of restrictions are passed in the response header:
- X-Ratelimit-Interval - limit interval in seconds
- X-Ratelimit-Remaining - how many requests left of this limit
- X-Ratelimit-Limit - the value limit
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/cache.json?location=Saint-Petersburg&hotelId=277083&checkIn=2019-09-13&checkOut=2019-09-18¤cy=rub&limit=1&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/cache.json?location=Saint-Petersburg&hotelId=277083&checkIn=2019-09-13&checkOut=2019-09-18¤cy=rub&limit=1&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/cache.json?location=Saint-Petersburg&hotelId=277083&checkIn=2019-09-13&checkOut=2019-09-18¤cy=rub&limit=1&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/cache.json"
querystring = {"location":"Saint-Petersburg","hotelId":"277083","checkIn":"2019-09-13","checkOut":"2019-09-18","currency": "rub", "limit": "1", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/cache.json?location=Saint-Petersburg&hotelId=277083&checkIn=2019-09-13&checkOut=2019-09-18¤cy=rub&limit=1&token=PasteYourTokenHere
Request parameters
- location - location name (IATA code can be used location)
- checkIn - date of check-in
- checkOut - date of check-out
- locationId - id of location (can be used instead of the location)
- hotelId - id of the hotel
- hotel - name of the hotel (when entering the name necessarily indicate the location or locationId
- adults - number of guests (by default, 2)
- children - number of children (2 to 18 years)
- infants - number of infants (0 to 2 years)
- limit - number of hotels. If this parameter is used in a query without specifying a precise ID or name of the hotel, the following applies:
- limit = 4 (default) - will return for one hotel each category (Stars)
- limit = 5 - return two five-stars hotel and one of the other categories
- limit = 6 - two 5 and 4-star hotel and the other one
- limit = 7 - two 5, 4 and 3-star hotels and one comfortable
- limit = 8 - all of two. And so on, with the growth parameters in turn increasing the number of hotels in every star. If the specified star hotels are no more, the issue will begin to fall and hotels 1 0 star by the same rule
- customerIp - parameter to specify the user IP if the request is not sent directly, but through a proxy server
- currency - currency of price (rub, usd, eur).
- token - your affiliate token
Response
Sample response
{
"location": {
"country": "Russia",
"geo": {
"lon": 37.617508,
"lat": 55.752041
},
"state": null,
"name": "Moscow"
},
"priceAvg": 60897.74,
"pricePercentile": {
"3": 28863.56,
"10": 28863.56,
"35": 47805.27,
"50": 59531.09,
"75": 65435,
"99": 120128.17
},
"hotelName": "Mercure Arbat Moscow",
"stars": 4,
"locationId": 12153,
"hotelId": 333561,
"priceFrom": 28863.56
}
- stars - number of the hotel's stars
- locationId - location id of this hotel
- priceFrom - minimum price per stay in a hotel room for the period
- priceAvg - average price per stay in a hotel room for the period
- pricePercentile - segmentation price for proportions (e.g., record type "50": 59531.09 means that 50% of the price is in the range of 59531.09 to rub)
- hotelName - name of hotel
- location - information about the location of the hotel:
- geo - coordinates of the hotel
- name - name of location (city)
- state - state in which the city is located
- country - a country of hotel
- hotelId - id of hotel
List of hotels in the archive
This request return the file with a list of all hotels for the specified locale.
Sample request
curl --request GET \
--url 'http://yasen.hotellook.com/tp/v1/hotels?language=en' \
require 'uri'
require 'net/https'
url = URI("http://yasen.hotellook.com/tp/v1/hotels?language=en")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://yasen.hotellook.com/tp/v1/hotels?language=en",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://yasen.hotellook.com/tp/v1/hotels"
querystring = {"language":"en"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://yasen.hotellook.com/tp/v1/hotels?language=en
Request parameters
The language parameter can take the values:
- ru (Russian)
- en (English)
- th (Thai)
- de (German)
- es (Spanish)
- fr (French)
- it (Italian)
- pl (Polish)
Response
The file with a list of hotels includes the following data:
- id - unique id of the hotel
- name - name of the hotel
- location_name - name of the place location of the hotel
- location_id - a unique id location of the hotel
- location_iata - IATA code for the location of the hotel
- country_name - name of the country in which the hotel is located
- photos_count - number of photos of the hotel in the database
The hotels file is updated once a week in the morning (GMT) on Saturday.
Note! To download the list of hotels you do not need access to the search hotels API.
Hotels Selections
The request recovers the list of specific hotels according to the ID of a location. A collection is formed according to the specified period. If the period is not specified, a collection shall be formed from the hotels found for the last three days.
Sample request
curl --request GET \
--url 'http://yasen.hotellook.com/tp/public/widget_location_dump.json?currency=rub&language=ru&limit=5&id=12209&type=popularity&check_in=2019-02-02&check_out=2019-02-17&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://yasen.hotellook.com/tp/public/widget_location_dump.json?currency=rub&language=ru&limit=5&id=12209&type=popularity&check_in=2019-02-02&check_out=2019-02-17&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://yasen.hotellook.com/tp/public/widget_location_dump.json?currency=rub&language=ru&limit=5&id=12209&type=popularity&check_in=2019-02-02&check_out=2019-02-17&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://yasen.hotellook.com/tp/public/widget_location_dump.json"
querystring = {"currency":"rub", "language":"ru", "limit":"5", "id":"12209", "type":"popularity", "check_in":"2019-02-02", "check_out":"2019-02-17", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://yasen.hotellook.com/tp/public/widget_location_dump.json?currency=rub&language=ru&limit=5&id=12209&type=popularity&check_in=2019-02-02&check_out=2019-02-17&token=PasteYourTokenHere
Request parameters
- check_in — date of check-in
- check_out — date of check-out
- currency — currency of response
- language — language of reaponse (pt, en, fr, de, id, it, pl, es, th, ru)
- limit — limitation of output results from 1 to 100, default - 10
- type — type of hotels from request
/tp/public/available_selections.json
- id — id of the city
- token — your affiliate token
Response
Sample response
{
"popularity": [
{
"hotel_id": 713859,
"distance": 6.68,
"name": "President Hotel",
"stars": 4,
"rating": 87,
"property_type": "hotel",
"hotel_type": [
"Solo Hotel"
],
"last_price_info": {
"price": 39707,
"old_price": 42761,
"discount": 7,
"insertion_time": 1485464441,
"nights": 15,
"search_params": {
"adults": 2,
"children": {},
"checkIn": "2019-02-02",
"checkOut": "2019-02-17"
},
"price_pn": 2647,
"old_price_pn": 2851
},
"has_wifi": true
}
]
}
- hotel_id – unique hotels’ ID
- distance – distance from the city’s center
- name – hotel’s name
- stars – number of stars
- rating – hotel’s rating, assigned by its visitors
- property_type – type of a hotel
- hotel_type – description of a hotel’s type
- last_price_info – information about the last found price of a hotel (if any)
- price – price of accommodation during the whole period with a discount
- old_price - price of accommodation without a discount
- discount – amount of a discount
- insertion_time – time, when the collection was found
- nights – number of nights
- search_params – search parameters
- price_pn – price of a night in a hotel room with a discount
- old_price_pn - price of a night in a hotel room without a discount
- has_wifi – availability of Wi-Fi
The types of hotel collections
The request recovers the list of all available separate collections. This type is used to search for hotels with a discount.
Sample request
curl --request GET \
--url 'http://yasen.hotellook.com/tp/public/available_selections.json?id=12209&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://yasen.hotellook.com/tp/public/available_selections.json?id=12209&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://yasen.hotellook.com/tp/public/available_selections.json?id=12209&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://yasen.hotellook.com/tp/public/available_selections.json"
querystring = {"id":"12209", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://yasen.hotellook.com/tp/public/available_selections.json?id=12209&token=PasteYourTokenHere
Request parameters
- id — id of the city
- token — your affiliate token
Response
Sample response
[
"center",
"tophotels",
"highprice",
"3-stars",
"4-stars",
"5-stars",
"restaurant",
"pets",
"pool",
"cheaphotel_ufa",
"luxury_ufa",
"price",
"rating",
"distance",
"popularity",
"2stars",
"3stars",
"4stars",
"5stars"
]
- center – hotels, located in the center of a city
- tophotels – best hotels
- highprice – most expensive hotels
- 3-stars, 4-stars, 5-stars – automatic searching of the hotels, having 3, 4 or 5 stars
- restaurant – availability of the own restaurant
- pets – opportunity to live with the pets
- pool – availability of the own pool
- cheaphotel – cheapest hotels
- luxury – luxury hotels
- price – manually formed collections by the price
- rating – hotels with the highest rating
- distance – distance from an airport
- popularity – popularity of a hotel
- 2stars, 3stars, 4stars, 5stars – manually formed collections with the corresponding number of stars
Hotels statistical data
Requests as a result of which the partner receives information about the countries, cities and hotels.
Attention! The default number of requests is limited to 60 per minute. If you need to process more requests, send a letter to support@travelpayouts.com.
Request "Country"
The request returns a file with a list of countries from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/countries.json?token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/countries.json?token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/countries.json?token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/countries.json"
querystring = {"token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/countries.json?token=PasteYourTokenHere
Request parameters
- token - your affiliate token
Response
Sample response
[
{
"id": "9",
"code": "DZ",
"name": {
"EN": [
{
"isVariation": "0",
"name": "Algeria"
}
],
"RU": [
{
"isVariation": "0",
"name": "Алжир"
}
]
}
},
{
"id": "10",
"code": "AO",
"name": {
"EN": [
{
"isVariation": "0",
"name": "Angola"
}
],
"RU": [
{
"isVariation": "0",
"name": "Ангола"
}
]
}
}
]
The response contains:
- Id – id of country
- code – code of country
- The block EN:
- isVariation – primary or secondary title. 1 - secondary, 0 - primary
- name – country name in English
- The block RU:
- isVariation – primary or secondary title
- name – country name in Russian
Request "Cities"
The request returns a file with a list of cities from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/locations.json?token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/locations.json?token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/locations.json?token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/locations.json"
querystring = {"token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/locations.json?token=PasteYourTokenHere
Request parameters
- token - your affiliate token
Response
Sample response
[
{
"id": "373",
"code": "",
"countryId": "77",
"latitude": "15.501950000",
"longitude": "73.910090000",
"name": {
"EN": [
{
"isVariation": "0",
"name": "Goa"
}
],
"RU": [
{
"isVariation": "0",
"name": "Гоа"
}
]
}
}
]
- Id – id of city
- code – iata-code of city
- countryId – id of country
- latitude – latitude of city
- longitude – longitude of city
- The block DE:
- isVariation - primary or secondary title. 1 - secondary, 0 - primary
- name – city name in German
- The block EN:
- isVariation - primary or secondary title
- name – city name in English
- The block RU:
- isVariation – primary or secondary title
- name – city name in Russian
Request "Amenities"
The request returns a file with a list of amenities from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/amenities/en.json?token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/amenities/en.json?token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/amenities/en.json?token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/amenities/en.json"
querystring = {"token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/amenities/en.json?token=PasteYourTokenHere
Request parameters
- en.json - language that you want to see result (en, ru, fr, de and etc)
- token - your affiliate token
Response
Sample response
[
{
"id": "2",
"name": "Hairdryer",
"groupName": "Room"
},
{
"id": "3",
"name": "Safe",
"groupName": "Room"
},
{
"id": "4",
"name": "TV",
"groupName": "Room"
}
]
- Id – id of amenities in the database
- name – name of amenities
- groupName - location of amenities
Request 'Hotels list'
The request returns a file with a list of hotels from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/hotels.json?locationId=895&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/hotels.json?locationId=895&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/hotels.json?locationId=895&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/hotels.json"
querystring = {"locationId":"895", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/hotels.json?locationId=895&token=PasteYourTokenHere
Request parameters
- locationId – id of location
- token – your affiliate token
Response
Sample response
{
"gen_timestamp": 1510729858.8067338,
"pois": [
{
"id": 70643,
"rating": 0,
"category": "airport",
"name": "Koggala Airport",
"location": {
"lat": 5.983056,
"lon": 80.33305
},
"geom": {
"type": "Point",
"coordinates": [
80.33305,
5.983056
]
},
"confirmed": true
}
],
"hotels": [
{
"id": 1399511245,
"cityId": 895,
"stars": 0,
"pricefrom": 30,
"rating": 0,
"popularity": 900,
"propertyType": 6,
"checkIn": "14:00",
"checkOut": "12:00",
"distance": 6,
"photoCount": 9,
"photos": [
{
"url": "http://photo.hotellook.com/image_v2/limit/h1399511245_8/320/240.auto",
"width": 320,
"height": 240
}
],
"photosByRoomType": {},
"yearOpened": null,
"yearRenovated": null,
"cntRooms": null,
"cntSuites": null,
"cntFloors": null,
"facilities": [
7
],
"shortFacilities": [],
"location": {
"lon": 81.201033,
"lat": 6.208641
},
"name": {
"en": "Sayonara Resorts"
},
"address": {
"ru": "Sayonara Resorts - Pallemalala , Weligatta , Hambantota., Тиссамахарама",
"en": "Sayonara Resorts - Pallemalala , Weligatta , Hambantota."
},
"link": "/lk/weerawila-895/sayonara_resorts-1399511245.html",
"poi_distance": {
"70642": 96987,
"70643": 99193,
"70650": 57116
}
}
]
}
Response parameters
The response contains:
- id – id of hotel in database hotellook
- cityId – id of city
- stars – number of stars
- pricefrom – average minimum cost of the period, in USD
- rating – rating visitors
- popularity – popularity of hotel
- propertyType – type of hotel (hostel, motel, villa, etc.)
- checkOut – check out time
- checkIn – check in time
- distance – distance to the center
- photoCount – number of photos
- photos:
- url – link to the photo
- width – width of photo
- height – height of photo
- facilities – id amenities in the database
- shortFacilities – availability of the amenities from the list: 'restaurant', 'parking', 'non-smoking', 'pets', 'tv', 'laundry', 'air conditioning', 'internet', 'pool', 'fitness', 'wi-fi in public areas', 'wi-fi in room', 'hairdryer', 'shared bathroom', 'safe', 'babysitting', 'children care/activities' (the list can change)
- photosByRoomType - photos of rooms types. The key - id of the room type, the value - number of photos
- location:
- lat – latitude of hotel
- lon – longitude of hotel
- name – hotel name
- address – hotel address
- link – link to this page of hotel
- poi_distance - distance to the important places (shown in the list of places id array pois and distance in meters)
- pois - an array of the important places:
- confirmed - confirmed place
- rating - place ranking
- location - location
- name - the name of the place
- geom - coordinates of the point
- category - the place category
- id - id of place in the base
Request "Types of rooms"
The request returns a file with a list of rooms type from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/roomTypes.json?language=en&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/roomTypes.json?language=en&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/roomTypes.json?language=en&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/roomTypes.json"
querystring = {"language":"en", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/roomTypes.json?language=en&token=PasteYourTokenHere
Request parameters
- language - language of reaponse (pt, en, fr, de, id, it, pl, es, th, ru)
- token - your affiliate token
Response
Sample response
{
"8":"Apartment",
"18":"Bungalow",
"15":"Business",
"73":"Business apartment",
"86":"Business deluxe"
}
Request "Types of hotels"
The request returns a file with a list of hotels type from the database.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/static/hotelTypes.json?language=en&token=PasteYourTokenHere' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/static/hotelTypes.json?language=en&token=PasteYourTokenHere")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/static/hotelTypes.json?language=en&token=PasteYourTokenHere",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/static/hotelTypes.json"
querystring = {"language":"en", "token":"PasteYourTokenHere"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET http://engine.hotellook.com/api/v2/static/hotelTypes.json?language=en&token=PasteYourTokenHere
Request parameters
- language - language of reaponse (pt, en, fr, de, id, it, pl, es, th, ru)
- token - your affiliate token
Response
Sample response
{
"0": "Other",
"1": "Hotel",
"2": "Apartment Hotel",
"3": "Bed & Breakfast",
"4": "Apartment / Condominium",
"5": "Motel",
"6": "Guest House",
"7": "Hostel",
"8": "Resort",
"9": "Agriturismo / Farm Stay",
"10": "Vacation Rental",
"11": "Lodge",
"12": "Villa"
}
Request "Hotel photos". Old method
The request returns a hotel photos from the database.
Sample request
https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg
Examples of links to the hotel's photos with Id 503387 size 48*48, 640*480 and .auto format:
https://photo.hotellook.com/image_v2/limit/h503387_1/48.jpg
https://photo.hotellook.com/image_v2/limit/h503387_1/640/480.jpg
https://photo.hotellook.com/image_v2/limit/h503387_1/800/520.auto
curl --request GET \
--url 'https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg' \
require 'uri'
require 'net/https'
url = URI("https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg"
querystring = {}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://photo.hotellook.com/image_v2/limit/hId_photoId/photosize.jpg
Request parameters
- h+Id – h + hotel's id
- photoId – number of the hotel's photo
- photosize – size of the photo (width/height)
- file_type - you can use .auto in the type part of file. It means that our system detects whether a user’s browser can accept the Webp image format. If yes, the server will send the image in Webp format (smaller size). If no, the image will be in JPEG format
Request for hotel photos. New method
The request returns a hotel photos from the database.
Example request
curl --request GET \
--url 'https://yasen.hotellook.com/photos/hotel_photos?id=27926056,4' \
require 'uri'
require 'net/https'
url = URI("https://yasen.hotellook.com/photos/hotel_photos?id=27926056,4")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://yasen.hotellook.com/photos/hotel_photos?id=27926056,4",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://yasen.hotellook.com/photos/hotel_photos"
querystring = {"id":"27926056,4"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
First request
GET https://yasen.hotellook.com/photos/hotel_photos?id=27926056,4
where id is the id of the hotels indicated through a comma.
Response
In response, there will be an array of photos id for each hotel:
Sample response
{
"4": [5162091534,5162091993], "27926056": [7505789398,7505803908]
}
Second request
Sample request
curl --request GET \
--url 'https://photo.hotellook.com/image_v2/limit/photo_id/800/520.auto' \
require 'uri'
require 'net/https'
url = URI("https://photo.hotellook.com/image_v2/limit/photo_id/800/520.auto")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://photo.hotellook.com/image_v2/limit/photo_id/800/520.auto",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://photo.hotellook.com/image_v2/limit/photo_id/800/520.auto"
querystring = {}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
After that, send a request to the address https://photo.hotellook.com/image_v2/limit/photo_id/800/520.auto
where instead of photo_id substitute id photos.
Request "Hotel's room photos (in a sprite)"
The request returns a hotel's rooms photos from the database.
Use this request to get a sprite with photos of rooms.
Sample request
curl --request GET \
--url 'https://photo.hotellook.com/rooms/sprite/h4_1/100/3/50.auto' \
require 'uri'
require 'net/https'
url = URI("https://photo.hotellook.com/rooms/sprite/h4_1/100/3/50.auto")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://photo.hotellook.com/rooms/sprite/h4_1/100/3/50.auto",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://photo.hotellook.com/rooms/sprite/h4_1/100/3/50.auto"
querystring = {}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
To get a sprite with rectangular photographs, along with the need to specify the width of the height of the photos:
https://photo.hotellook.com/rooms/sprite/h4_12/100x50/3/50x25.auto
Request
GET https://photo.hotellook.com/rooms/sprite/hhotel-id_group-id/first_width/photos_count-1/rest_photos_width.auto
Request parameters
- h + hotel-Id - letter h + Hotel identifier (from static/hotels.json)
- group-id - ID room type (from static/hotels.json and internalTypeId of the search for an answer)
- first_width - width of the first photo in the sprite
- photos_count-1 - number of photos of the room type minus one (from the static/hotels.json). For example, if the answer is that photographs of this type have four pieces, it indicates three instead of this parameter
- rest_photos_width - width of the rest of the photos in the sprite
- auto - our system checks whether a user's browser can accommodate the WebP image format. If yes, the server will provide a WebP image format. If not, the image will be in JPEG format
Additional information
To get a picture of the room, given the size, use code like:
https://photo.hotellook.com/rooms/crop/h<hotel_id>_<group_id>_<photo_idx>/<width>/<height>.auto
This photo will be scaled and cropped to the specified size.
To get a photo that is no longer a given size or type, use the code:
https://photo.hotellook.com/rooms/limit/h<hotel_id>_<group_id>_<photo_idx>/<widt*>/<height>.auto
Parameters similar to those described in the request above, except for photo_idx - an index image in the list (first index pictures - 0).
https://photo.hotellook.com/rooms/limit/h4_12_1/200/200.auto
Request 'City photo'
The request returns a city photos from the database.
Sample request
curl --request GET \
--url 'https://photo.hotellook.com/static/cities/960x720/LED.jpg' \
require 'uri'
require 'net/https'
url = URI("https://photo.hotellook.com/static/cities/960x720/LED.jpg")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://photo.hotellook.com/static/cities/960x720/LED.jpg",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://photo.hotellook.com/static/cities/960x720/LED.jpg"
querystring = {}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Request
GET https://photo.hotellook.com/static/cities/960x720/LED.jpg
Request parameters
- photosize – size of the photo (width/height)
- city_iata - IATA code of the city
Hotels search API
Requirements for Hotels API access
- Each search query must be initiated by the user and the results must be shown to the user in full. The results for each query must contain a “buy” button next to each flight option.
- The conversion rate for searches via the Buy link must be 9% or more. The conversion rate from the Buy button to actual purchases must be at least 5%.
- We'll also need to see the URL of your project, your design prototypes, a description of your project and how our API will be used.
Hotels search API description
With hotels API, a partner can create his or her own search of hotels. Access to the hotel search API is free, limited, and available on an individual basis on request from the partner.
To access the search API hotels, submit your request to support@travelpayouts.com with the following information:
- URL of your website.
- Design prototypes of search result and hotel's page.
- How you will use the search API?
- Why aren’t the standard methods of integration (search forms, White Label, API access to data) suitable for you?
Attention, please! Data about Booking.com is missing in the API of hotels. The reason for this is the policy of the company to work through the API and White Label.
Search management
Search by hotel IATA-code or cityId (ID location), or hotelId (ID hotel). All options or just one can be specified. If you specify hotelId and cityId, only hotelId will be used. If you specify iata and cityId, iata will be used.
When using this search, it is possible to access its results not immediately, but after a period of time not exceeding 15 minutes. Handling is on the request ID searchId.
Attention! The default number of requests is limited to 200 requests per hour for one IP address. If you need to process more requests, send a note to support@travelpayouts.com.
Sample request
curl --request GET \
--url 'http://engine.hotellook.com/api/v2/search/start.json?iata=HKT&checkIn=2018-08-10&checkOut=2018-08-13&adultsCount=2&customerIP=100.168.1.1&childrenCount=1&childAge1=8&lang=ru¤cy=USD&waitForResult=0&marker=УкажитеВашМаркер&signature=a475100374414df97a9c6c7d7731b3c6' \
require 'uri'
require 'net/https'
url = URI("http://engine.hotellook.com/api/v2/search/start.json?iata=HKT&checkIn=2018-08-10&checkOut=2018-08-13&adultsCount=2&customerIP=100.168.1.1&childrenCount=1&childAge1=8&lang=ru¤cy=USD&waitForResult=0&marker=УкажитеВашМаркер&signature=a475100374414df97a9c6c7d7731b3c6")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://engine.hotellook.com/api/v2/search/start.json?iata=HKT&checkIn=2018-08-10&checkOut=2018-08-13&adultsCount=2&customerIP=100.168.1.1&childrenCount=1&childAge1=8&lang=ru¤cy=USD&waitForResult=0&marker=УкажитеВашМаркер&signature=a475100374414df97a9c6c7d7731b3c6",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "http://engine.hotellook.com/api/v2/search/start.json"
querystring = {"iata":"HKT", "checkIn":"2018-08-10", "checkOut":"2018-08-13", "adultsCount":"2", "customerIP":"100.168.1.1", "childrenCount":"1", "childAge1":"8", "lang":"ru", "currency":"USD", "waitForResult":"0", "marker":"УкажитеВашМаркер", "signature":"a475100374414df97a9c6c7d7731b3c6"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
where signature is md5 of the string: "YourToken:YourMarker:adultsCount:checkIn:checkOut:childAge1:childrenCount:currency:customerIP:iata:lang:waitForResult".
More information about the signature is available here.
First request
GET http://engine.hotellook.com/api/v2/search/start.json?iata=HKT&checkIn=2018-08-10&checkOut=2018-08-13&adultsCount=2&customerIP=100.168.1.1&childrenCount=1&childAge1=8&lang=ru¤cy=USD&waitForResult=0&marker=УкажитеВашМаркер&signature=a475100374414df97a9c6c7d7731b3c6
Request parameters
Required parameters are highlighted in bold.
- cityId – the location ID (the query static/locations.json)
- hotelId – the hotel ID (the query static/hotels.json)
iata – iata code of city
Note. The request must have at least one of the required parameters iata, cityId or hotelId.
checkIn – check-in date format: yyyy–MM–dd
checkOut – check-out date format: yyyy–MM–dd
adultsCount – number of adults
customerIP – IP of the user who initiated the request
childrenCount – the number of children; possible values - from 0 to 3. Default - 0
childAge1, childAge2, childAge3 – ages of children (if childrenCount greater than 0). The default age is 1 year (max = 17)
lang – the language of the search result. Stated together with the region
- en_US
- en_GB
- ru_RU
- de_DE
- en_AU
- en_CA
- en_IE
- es_ES
- fr_FR
- it_IT
- pl_PL
- th_TH
currency – USD, RUB, EUR, ...
waitForResult – wait for the completion of all searches for partners, possible values 0 or 1
- 1 – the connection is open before all the data from the partners. The result is returned to the user query and its searchId
- 0 – the connection will be terminated immediately and returned to the user searchId (default)
Response
Sample response
{
"searchId": "5201179",
"status": "ok"
}
Second request
Sample request
http://engine.hotellook.com/api/v2/search/getResult.json?searchId=4034914&limit=10&sortBy=price&sortAsc=1&roomsCount=0&offset=0&marker=PasteYourMarkerHere&signature=364c38baee5cf11b382297bfd4338ce6
where signature is md5 of the string: "YourToken:YourMarker:limit:offset:roomsCount:searchId:sortAsc:sortBy".
Request parameters
- searchId – search Id
- limit – maximum number of hotels, from 0 to infinity, where 0 - no limit. Default - 0
- offset – to skip a number of hotels from 0 to infinity, where 0 - no hotel not passed. Default - 0
- sortBy – how to sort:
- popularity - by popularity
- price - by price
- name - by name
- guestScore – by User Rating
- stars – by number of stars Default – popularity
- sortAsc – how to sort the values:
- 1 – ascending
- 0 – descending Default – 1.
- roomsCount – the maximum number of rooms that are returned in each hotel, from 0 to infinity, where 0 - no limit. Default – 0
Response
Sample response
When you are trying to get a search result, at the end of search you get the error "errorCode: 4". This means the results are not yet ready. The search is not interrupted; you should repeat the request later.
{
"status": "ok",
"result": [
{
"fullUrl": "http://search.hotellook.com/?language=ru&marker=16886&hotelId=362691",
"maxPricePerNight": 46,
"maxPrice": 138,
"photoCount": 50,
"guestScore": 63,
"address": "23/8 Soi Hub-Aik, Phuket Road, Muang District",
"minPriceTotal": 40,
"id": 362691,
"price": 13,
"name": "Rome Place Hotel",
"url": "/search/?marker=16886&hotelId=362691",
"popularity": 47,
"location": {
"lon": 98.39146,
"lat": 7.878922
},
"stars": 3,
"distance": 10.6,
"amenities": [],
"rooms": [
{
"bookingURL": "/r/?language=ru&checkIn=2015-06-10¤cy=USD&children=5&host=v2%3A16886&marker=16886&transparent=1&roomId=0&adults=2&locationId=30553&checkOut=2015-06-13&gateId=43&hotelId=362691",
"options": {
"available": 5,
"deposit": true,
"refundable": false,
"breakfast": false
},
"type": "",
"tax": 0,
"desc": "Double or Twin STANDARD",
"fullBookingURL": "http://search.hotellook.com/r?language=ru&checkIn=2015-06-10&cy=USD&children=5&host=v2%3A16886&marker=16886&transparent=1&roomId=0&adults=2&locationId=30553&checkOut=2015-06-13&gateId=43&hotelId=362691",
"agencyName": "Travel.ru",
"agencyId": "43",
"total": 40,
"price": 13,
"internalTypeId": "1"
}
],
"rating": 63
}
]
}
Block "result" contains:
- fullUrl - the link to the hotel's page with partner's marker
- maxPrice – the highest price of the hotel rooms
- maxPricePerNight - the maximum price per night
- price – the average price per room
- minPriceTotal - the minimum cost per stay
- photoCount - the number of photos of the hotel
- guestScore - the travelers' rating
- id – the ID of hotel in the database
- name – hotel's name
- address – the hotel's address
- distance - the distance from the hotel to the city center
- amenities - amenities at the hotel (descriptions of values you can find here)
- location – the hotel's location:
- lat – latitude of hotel
- lon – longitude of hotel
- stars – the number of stars the hotel
- url – the link to the hotel website
Block "rooms" contains:
- type, desc – the type of rooms
- total – the rate for all time
- price – the daily room rate
- tax – taxes and fees
- options – additional services:
- breakfast - whether breakfast included in the rate or not
- available - the number of available rooms of this type
- deposit - payment directly on the site, if it is 0 - then pay at the hotel
- refundable - "free cancellation"
- cardRequired - without reservation card, if 0 - you can book without card and then pay at partners
- smoking - can smoke in the room
- freeWifi - whether there is free wifi in the room
- hotelWebsite - proposal leads to the official hotel website
- bookingURL – the link to the booking website
- fullBookingURL - complete link to book with filled all data about users (date of check In and check out, number of adults and childrens, currency and ets)
- internalTypeId - grouping by type of rooms
- agencyId – the id of booking agencies
- agencyName – the name of the booking agencies
- rating - the ranking of visitors. The parameters are calculated based on guest rating, which is compiled on the basis of a vote
You can get photos and other information about hotel with help of Hotel Data API.
Attention! The reference to the agency's website must be received only when the user clicks the "Buy" button. Automatic collection of all links from the answer is prohibited. Violation of this rule will disable the API search for the partner.
Hotels API request errors
All input parameters are checked and errors are shown if they are wrong:
- errorCode 1 – not all required parameters are filled
- errorCode 2 – at least one of the parameters does not match the format
- errorCode 3 – access is denied
- errorCode 4 – search is not over yet