Aviasales Flights Search API: real-time and multi-city search

Travelpayouts platform is a flight API provider. With the help of free flight API, you can get the results of requests in real-time and create a Multi-City search.

By default, one affiliate may send no more than 200 queries per hour for one user’s IP address, using the airline tickets search flight API. This restriction may be changed if a situation so requires.

Аccess to the free flights API

To access the free flights API you should be signed up for the Travelpayouts partnership platform and submit your request on support@travelpayouts.com with the following information:

  • URL of your website
  • Design prototypes of search result
  • Description of your project
  • How you will use the flights search API
  • Why aren’t the standard methods of integration (search forms, White Label, API access to data) suitable for you

You can find requirements to get access from flight API provider here.

Search logic

  1. Form a request with the direction of the flight and the number of passengers.
  2. Send a request and receive a unique search ID.
  3. Submit your search ID to get flight details and ticket prices.
  4. With the help of the received data, create a search page.
  5. When you click on the Book button, you generate a link to the agency/airline website.

Round trip request

Request initialization

Method: POST

Request parameters:

  • marker (string) — the unique Travelpayouts ID of the partner. You can find your ID at the bottom left corner of your Travelpayouts account
  • host (string) — host’s request (must be replaced by the address of your website or your mobile app name 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). From the locale, origin and destination cities depend on the set of agencies on which the search is performed
  • trip_class (string) — flight class (Y — Economy, C — Business. Required uppercase)
  • passengers — passenger Information
    • passengers.adults (integer) — the number of adult passengers (from 1 to 9)
    • passengers.children (integer) — the number of children (from 0 to 6)
    • passengers.infants (integer) — the number of infants (from 0 to 6)
  • segments
    • segments.origin (string) — origin IATA or string "City, Country (IATA)". The IATA code is shown in uppercase letters (for example, "Paris, France (PAR)")
    • segments.destination (string) — destination IATA or string "City, Country (IATA)". The IATA code is shown in uppercase letters (for example, "Berlin, Germany (BER)")
    • segments.date (string) — departure date yyyy-mm-dd (for example, "2015-09-08")
  • know_english (string) (optional parameter) — a 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)
  • signature (string) — the request signature is constructed from the 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:

{
"signature": "2c37292b67762a913455b166345ae249",
 "marker": "PutYourMarkerHere",
 "host": %your_server_host%,
   "user_ip": %user_ip%,
 "locale": "en",
   "trip_class": "Y",
 "passengers": {
    "adults": 1,
    "children": 0,
     "infants": 0
   },
 "segments": [
   {
    "origin": "LAX",
    "destination": "NYC",
   "date": "2017-05-25"
   },
   {
    "origin": "NYC",
    "destination": "LAX",
     "date": "2017-06-18"
   }
   ]
} 

To get data, use the initialization code of the search:

curl -v -X POST -d '{"signature":"2d0c311eb0fe9cd84fcd1b875759c313","marker":"PutYourMarkerHere","host":"beta.aviasales.com","user_ip":"127.0.0.1","locale":"en","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"LAX","destination":"NYC","date":"2017-05-25"},{"origin":"NYC","destination":"LAX","date":"2017-06-18"}]}' -H 'Content-type:application/json' http://api.travelpayouts.com/v1/flight_search

The answer comes in JSON format. The response contains the parameters:

  • 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
  • geoip_country — the geoip of the country 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
    • date — departure date
    • origin — origin IATA
    • destination — destination IATA
  • 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
    Please note! Use currency rates to convert the prices of flights to the currency you need (because the response contains the flight price in Russian rubles).

Getting search results

Method: GET

In the body of the response is the parameter search_id; insert it into the URL:

http://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%

Then send the request to the server for search results:

curl -v -H 'Accept-Encoding:gzip,deflate,sdch' http://api.travelpayouts.com/v1/flight_search_results?uuid=ebe4fa71-bc07-40df-ae4e-4b72116583da --compressed

where "ebe4fa71-bc07-40df-ae4e-4b72116583da" — this is search_id.

As a result of the search, you will get the JSON array, where each proposals element is a response (flight ticket) from a definite agency.

To get all data repeat the request until you get an associative array with one element — search_id. The periodicity of sending requests isn’t restricted.

Please note! Our server requires 30–60 seconds for data collection. You can make a pause after receiving a search_id parameter and notify the user that the loading is in process — this is implemented on aviasales.com. Or you can show the results as soon as you receive them from us.

One way request

Request initialization

Method: POST

To get "One way" tickets, add a JSON into the body of the request:

{
"marker": "PutYourMarkerHere",
"host": "beta.aviasales.com",
"user_ip": "127.0.0.1",
"locale": "en",
"trip_class": "Y",
"passengers": {
"adults": 1,
"children": 0,
"infants": 0
},
"segments": [
{
"origin": "LAX",
"destination": "NYC",
"date": "2017-06-18"
}
]
}

To get data, use the initialization code of the search:

curl -v -X POST -d '{"signature":"2a3e1bda117d113569bb6f8b60dba075","marker":"PutYourMarkerHere","host":"beta.aviasales.com","user_ip":"127.0.0.1","locale":"en","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"LAX","destination":"NYC","date":"2017-06-18"}]}' -H 'Content-type:application/json' http://api.travelpayouts.com/v1/flight_search

Getting search results

Method: GET

In the body of the response is the parameter search_id; insert it into the URL:

http://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%

Then send the request to the server for search results:

curl -v -H 'Accept-Encoding:gzip,deflate,sdch' http://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id% --compressed

As a result of the search, you will get the JSON array, where each proposal element is a response (flight ticket) from a definite agency.

To get all data repeat the request until you get an associative array with one element — search_id. The periodicity of sending requests isn’t restricted.

Open jaw request

Request initialization

Method: POST

Open jaw is a round-trip ticket in which the traveler 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:

{
    "signature":"64dd4ff2f8a6f690b69d6a72429bf827",
    "marker":"PutYourMarkerHere",
    "host":"beta.aviasales.com",
    "user_ip":"127.0.0.1",
    "locale":"en",
    "trip_class":"Y",
    "passengers":{
       "adults":1,
       "children":0,   
       "infants":0
    },
    "segments":[
    {
      "origin":"LAX",
      "destination":"NYC",
       "date":"2017-02-18"
    },
    {
      "origin":"NYC",
       "destination":"BER",
       "date":"2017-02-25"
    },
    {
       "origin":"BER",
       "destination":"LON",
       "date":"2017-03-05"
    }
    ]
}

To get data, use the initialization code of the search:

curl -v -X POST -d '{"signature":"08caa94413dc805880f835ba9d8ba98f","marker":"PutYourMarkerHere","host":"beta.aviasales.com","user_ip":"127.0.0.1","locale":"en","trip_class":"Y","passengers":{"adults":1,"children":0,"infants":0},"segments":[{"origin":"LAX","destination":"NYC","date":"2017-06-18"},{"origin":"NYC","destination":"BER","date":"2017-06-25"},{"origin":"BER","destination":"LON","date":"2017-07-05"}]}' -H 'Content-type:application/json' http://api.travelpayouts.com/v1/flight_search

Getting search results

Method: GET

In the body of the response is the parameter search_id; insert it into the URL:

http://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id%

Then send the request to the server for search results:

curl -v -H 'Accept-Encoding:gzip,deflate,sdch' http://api.travelpayouts.com/v1/flight_search_results?uuid=%search_id% --compressed

As a result of the search, you will get the JSON array, where each proposals element is a response (flight ticket) from a definite agency.

To get all data repeat the request until you get an associative array with one element — search_id. The periodicity of sending requests isn’t restricted.

Response example

Attention! The link to the search results is relevant for 15 minutes. After this time, you must send a search query again.

[
    {
        "proposals": [
            {
                "terms": {
                    "48": {
                        "currency": "eur",
                        "price": 1202,
                        "unified_price": 109455,
                        "url": 4800160,
                        "multiplier": 0.0006393978128433228,
                        "proposal_multiplier": 1,
                        "flights_handbags": [
                            [
                                "1PC",
                                "1PC"
                            ],
                            [
                                "1PC",
                                "1PC"
                            ]
                        ],
                        "handbags_source": [
                            [
                                4,
                                4
                            ],
                            [
                                4,
                                4
                            ]
                        ]
                    }
                },
                "xterms": {
                    "48": {
                        "IS50AENB,IS50AENB;IS50AENB,IS50AENB": {
                            "currency": "eur",
                            "price": 1202,
                            "unified_price": 109455,
                            "url": 4800160,
                            "multiplier": 0.0006393978128433228,
                            "proposal_multiplier": 1
                        }
                    }
                },
                "segment": [
                    {
                        "flight": [
                            {
                                "aircraft": "Boeing 737-800 (winglets)",
                                "arrival": "AMS",
                                "arrival_date": "2022-05-08",
                                "arrival_time": "15:45",
                                "arrival_timestamp": 1652017500,
                                "delay": 0,
                                "departure": "CDG",
                                "departure_date": "2022-05-08",
                                "departure_time": "14:30",
                                "departure_timestamp": 1652013000,
                                "duration": 75,
                                "equipment": "73H",
                                "local_arrival_timestamp": 1652024700,
                                "local_departure_timestamp": 1652020200,
                                "marketing_carrier": "KL",
                                "number": "1234",
                                "operating_carrier": "KL",
                                "operated_by": "KL",
                                "rating": 7.8525,
                                "technical_stops": null,
                                "trip_class": "C"
                            },
                            {
                                "aircraft": "EMBRAER EMB 190 / EMB 195",
                                "arrival": "LHR",
                                "arrival_date": "2022-05-08",
                                "arrival_time": "17:50",
                                "arrival_timestamp": 1652028600,
                                "delay": 110,
                                "departure": "AMS",
                                "departure_date": "2022-05-08",
                                "departure_time": "17:35",
                                "departure_timestamp": 1652024100,
                                "duration": 75,
                                "equipment": "E90",
                                "local_arrival_timestamp": 1652032200,
                                "local_departure_timestamp": 1652031300,
                                "marketing_carrier": "KL",
                                "number": "1031",
                                "operating_carrier": "KL",
                                "operated_by": "KL",
                                "rating": 7.695,
                                "technical_stops": null,
                                "trip_class": "C"
                            }
                        ],
                        "rating": {
                            "total": 7.844,
                            "detailed": {
                                "transfer": 8,
                                "arrival_time": 9.566666666666666,
                                "departure_time": 9.125
                            }
                        },
                        "transfers": [
                            {
                                "duration": {
                                    "seconds": 6600
                                },
                                "at": "AMS",
                                "to": "AMS",
                                "airports": [
                                    "AMS"
                                ],
                                "airlines": [
                                    "KL"
                                ],
                                "country_code": "NL",
                                "city_code": "AMS",
                                "visa_rules": {
                                    "required": false
                                },
                                "night_transfer": false,
                                "tags": [],
                                "duration_seconds": 6600
                            }
                        ]
                    }
                ],
                "total_duration": 495,
                "stops_airports": [
                    "AMS",
                    "LHR",
                    "AMS",
                    "CDG"
                ],
                "is_charter": false,
                "max_stops": 1,
                "max_stop_duration": 110,
                "min_stop_duration": 60,
                "carriers": [
                    "KL",
                    "AF"
                ],
                "segment_durations": [
                    260,
                    235
                ],
                "segments_time": [
                    [
                        1652020200,
                        1652032200
                    ],
                    [
                        1652116200,
                        1652133900
                    ]
                ],
                "segments_airports": [
                    [
                        "CDG",
                        "LHR"
                    ],
                    [
                        "LHR",
                        "CDG"
                    ]
                ],
                "sign": "fbb0d4885b79df22026503f6f460bfc0",
                "is_direct": false,
                "flight_weight": 0,
                "popularity": 0,
                "segments_rating": 7.687333333333332,
                "tags": [
                    "short_layover"
                ],
                "validating_carrier": "KL"
            }
        ],
        "airports": {
            "XNB": {
                "name": "Chelsea Twr EY Bus Station",
                "city": "Dubai",
                "city_code": "DXB",
                "country": "United Arab Emirates",
                "country_code": "AE",
                "time_zone": "Asia/Dubai",
                "coordinates": {
                    "lat": 25.264444,
                    "lon": 55.31167
                }
         	}
         },
        "search_id": "f7bb35e6-1180-4421-8e18-7c3105f4b692",
        "chunk_id": "7a5db944-b647-11ec-b06e-e24d0f1425a0",
        "meta": {
            "uuid": "f7bb35e6-1180-4421-8e18-7c3105f4b692",
            "gates": [
                {
                    "count": 200,
                    "good_count": 200,
                    "bad_count": null,
                    "duration": 12.1298065,
                    "id": 331,
                    "gate_label": "myholidays",
                    "merged_codeshares": 0,
                    "error": {
                        "code": 0,
                        "tos": ""
                    },
                    "created_at": 1649317865348514425,
                    "server_name": "lux/start-chain-vp9mm",
                    "cache": false,
                    "cache_search_uuid": ""
                }
            ]
        },
        "airlines": {
            "KL": {
                "id": 318,
                "iata": "KL",
                "average_rate": 3.52,
                "rates": 663,
                "name": "KLM",
                "alliance_id": 3,
                "alliance_name": "SkyTeam",
                "brand_color": "00A1E4"
            }
        },
        "gates_info": {
            "331": {
                "id": 331,
                "label": "MyHolidays",
                "payment_methods": [
                    "card"
                ],
                "currency_code": "usd"
            }
        },
        "flight_info": {
            "CSK811": {
                "amenities": {
                    "wifi": {
                        "exists": true,
                        "paid": false,
                        "type": "wifi",
                        "summary": "free_wifi"
                    },
                    "layout": {
                        "row_layout": "3_3",
                        "type": "forward",
                        "quality": "standard"
                    },
                    "power": {
                        "exists": true,
                        "paid": false,
                        "type": "usb",
                        "summary": "free_usb"
                    },
                    "food": {
                        "exists": true,
                        "paid": false,
                        "type": "premium_meal",
                        "summary": "free_premium_meal"
                    },
                    "entertainment": {
                        "exists": false,
                        "paid": false,
                        "type": "none",
                        "summary": "no_none"
                    },
                    "beverage": {
                        "type": "alcoholic_and_nonalcoholic",
                        "quality": "standard",
                        "alcoholic_paid": false,
                        "nonalcoholic_paid": false,
                        "exists": true
                    }
                },
                "seat": {
                    "width": 43,
                    "pitch": 76,
                    "type": "standard_legroom"
                }
            }
        },
        "filters_boundary": {
            "arrival_time_1": {
                "max": "23:00",
                "min": "08:35"
            },
            "flights_duration": {
                "max": 940,
                "min": 75
            },
            "stops_duration": {
                "max": 625,
                "min": 55
            },
            "price": {
                "max": 534900,
                "min": 36588
            },
            "stops_count": {
                "0": 36588,
                "1": 63147
            },
            "arrival_time_0": {
                "max": "22:30",
                "min": "07:30"
            },
            "arrival_datetime_0": {
                "max": 1652099700,
                "min": 1651995000
            },
            "departure_minutes_1": {
                "max": 1235,
                "min": 359
            },
            "airports": {
                "arrival": [
                    "LCY",
                    "LGW",
                    "LHR",
                    "QQS"
                ],
                "departure": [
                    "CDG",
                    "XPG"
                ]
            },
            "departure_time_0": {
                "max": "21:55",
                "min": "07:10"
            },
            "departure_minutes_0": {
                "max": 1315,
                "min": 430
            },
            "departure_time_1": {
                "max": "20:35",
                "min": "05:59"
            },
            "arrival_datetime_1": {
                "max": 1652137200,
                "min": 1652085300
            }
        },
        "segments": [
            {
                "origin": "PAR",
                "origin_country": "FR",
                "original_origin": "PAR",
                "destination": "LON",
                "destination_country": "GB",
                "original_destination": "LON",
                "date": "2022-05-08",
                "depart_date": "2022-05-08"
            },
            {
                "origin": "LON",
                "origin_country": "GB",
                "original_origin": "LON",
                "destination": "PAR",
                "destination_country": "FR",
                "original_destination": "PAR",
                "date": "2022-05-09",
                "depart_date": "2022-05-09"
            }
        ],
        "market": "gb",
        "clean_marker": "270899",
        "open_jaw": false,
        "currency": "usd",
        "initiated_at": "2022-04-07 07:51:05.348514"
    },
    {
        "search_id": "f7bb35e6-1180-4421-8e18-7c3105f4b692"
    }
]

Full response example: response-example.json

The response includes the data:

  • search_id — unique identifier for the search query
  • flight_numbers — numbers of the flight
  • meta:
    • gates — information about phases of gates in the search process:
      • gates.good_count — number of relevant tickets (if the agency has returned the ticket for the wrong dates or they are misspelled, they are filtered out by the system)
      • gates.count — number of tickets uploaded from the agency
      • gates.duration — processing time of request
      • gates.id — ID agency
      • gates.error — error information:
        • tos — content of error
  • uuid — request ID 
  • city_distance — distance between the cities of origin and destination
  • gates_info — information about the agent (tickets provider). The number is gate id:
    • gates_info.currency_code — payment currency code
    • gates_info.is_airline — is an airline
    • gates_info.average_rate — average rating of agencies
    • gates_info.rates — rating agency (count voters)
    • gates_info.mobile_version — having a mobile version of the site
    • gates_info.airline_iatas — IATA airline code, if the gate sells tickets
    • gates_info.payment_methods — payment methods
    • gates_info.label — agency name
    • gates_info.signature — signature of request
  • segments — array data of flights:
    • segments.destination_country — code of the country of destination
    • segments.original_destination — code of the city of destination
    • segments.origin — origin IATA
    • segments.destination — destination IATA
    • segments.origin_country — the origin country
    • segments.date — departure date
  • flight_numbers — flight numbers
  • airlines — information about the airlines:
    • airlines.deeplink_site_name — address of the airline’s website
    • airlines.id — identification number of the airline
    • airlines.site_name — name of the airline’s website
    • airlines.alliance_name — alliance of the airline
    • airlines.average_rate — average rating
    • airlines.rates — number of ratings
    • airlines.deeplink_id — ID links to airline’s website
    • airlines.name — name of airline
  • proposals — an array of variants:
    • proposals.segment
      • proposals.segment.flight — flight details:
        • flight.departure — departure IATA code
        • flight.duration — flight duration in minutes
        • flight.departure_date — departure date (UNIX-time)
        • flight.departure_time — departure time (UNIX-time)
        • flight.departure_timestamp — departure time in UNIX format
        • flight.local_departure_timestamp — local departure time in UNIX format
        • flight.arrival_time — arrival time (UNIX-time)
        • flight.local_arrival_timestamp — local arrival time in UNIX format
        • flight.number — flight number. To generate a full flight number, use the number and marketing_carrier parameters
        • flight.delay — duration of stop between flights (in minutes)
        • flight.marketing_carrier — IATA code of the airline that sells the ticket. Use it to generate a flight number. If this field is empty, use operating_carrier
        • flight.operating_carrier — IATA code of the airline that performs the carriage
        • flight.arrival_date — arrival date
        • flight.aircraft — type of aircraft
        • flight.rating_summary — some rating information about agency or airline (can be blank)
        • flight.is_bus, flight.is_train — true, if in this segment they do not travel by plane, but by bus or train
        • flight.technical_stops — IATA code of all airports technical stops
        • flight.arrival — IATA code of arrival
      • proposals.segment.rating — internal information about flight rating
      • proposals.segment.transfers — transfer information:
        • transfers.at — IATA code of the airport where the plane arrives for transfer
        • transfers.to — IATA code of the airport from which the plane departs
        • transfers.airports — list of IATA codes of transfer airports
        • transfers.airlines — a list of IATA codes of airlines participating in the flight
        • transfers.country_code — IATA country code of the transfer country
        • transfers.city_code — IATA code of the transfer city
        • transfers.night_transfer — is it a night transfer
        • transfers.duration_seconds — duration of the transfer in seconds
        • transfers.durationdeprecated
    • proposals.carriers — iata code of airline carriers
    • proposals.terms — information about the flight’s cost:
      • terms.price — trip price in original currency (type listed in the field terms.currency)
      • terms.currency — currency type
      • terms.flights_baggage — the number of pieces of baggage and its weight:
        • flights_baggage."" — there is no information about baggage
        • flights_baggage.false — baggage is not included in the price
        • flights_baggage.0PC — without baggage
        • flights_baggage.{int}PC{int} — number of bags by %somevalue% kilogram. For example, 2PC23 — means two baggage pieces of 23 kg 
        • flights_baggage.{int}PC - number of bags without weight information. For example, 1PC means one piece of luggage.
        • flights_baggage.{int} — number of bags does not matter, the total weight is limited
      • terms.flights_handbags — information about handbags
      • terms.url — code to generate links for buyers (as forming the link; see below)
    • proposals.sign — unique id of the ticket, to integrate information from different agencies in one ticket
    • proposals.stops_airports — IATA codes of departure airports, destination and transfers
    • proposals.airports — information about airports
    • proposals.xterms — contains information similar to terms, plus may contain additional data on tariffs (if it is transmitted from agencies / airlines)
    • proposals.is_direct — true if the flight is non-stop
    • proposals.segments_airports — IATA codes of the main departure and destination airports
    • proposals.is_charter — flight is charter or not (false or true)
    • proposals.segment_durations — total flights duration (for example, there and back)
    • proposals.total_duration — total flight time with stops time
    • proposals.max_stops — maximum number of stops
    • proposals.validating_carrier — IATA code of the issuing airline (deprecated)
    • proposals.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)
  • flight_info — information about routes:
    • {RouteNumber}
      • flight_info.ontime_percent — delay persant
      • flight_info.min — min number of delay
      • flight_info.max — max number of delay
      • flight_info.mean — average number of delay
      • flight_info.IATA — IATA code
      • flight_info.city — city where airport is located
      • flight_info.average_rate — average rating of airport
      • flight_info.rates — number of ratings
      • flight_info.country — country where airport is located
      • flight_info.name — airport name
      • flight_info.time_zone — time zone of airport
  • filters_boundary — array data for filtering (deprecated):
    • filters_boundary.stops_duration — time between flights (maximum and minimum)
    • filters_boundary.flights_duration — flights duration (maximum and minimum)
    • filters_boundary.arrival_datetime_0 — arrival datetime (maximum and minimum)
    • filters_boundary.price — price of flights (maximum and minimum)
    • filters_boundary.departure_time_0 — departure time (maximum and minimum)
    • filters_boundary.stops_count — stops count
  •  

How to get a link to the agency website

Attention! The link to the agency’s website must be received only when the user clicks the "Book" button. Automatic collection of all links from the answer is prohibited. Violation of this rule will disable the API search for the partner.

To get a link to the site of the ticket booking agencies:

1. Send a request to the following address: http://api.travelpayouts.com/v1/flight_searches/search_id/clicks/terms.url.json?marker=AffiliateMarker

where search_id is the ID from the response of the request, terms.url — the parameter url from the response, marker — affiliate marker.

2. You will receive a response like this:

{
"gate_id": 112,
"click_id": 1638059365479303264,
"str_click_id": "1638059365479303264",
"url": "https://www.flightnetwork.com/flights/showflight?cid=175&qid=b4efe7e975ff9eee42d420600345160e&utm_source=jetradar&utm_medium=3rdparty&client_ref=fnjtrus_tg2b&utm_campaign=metasearch&currency=usd&cmpid=3P-CPC-JTR-USA-XXX-FLT-MET-PYP-cg0zkzxavu5c-DIR-XXX-2014-01-28",
"method": "GET",
"params": {}
}

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.flightnetwork.com/flights/showflight?cid=175&qid=b4efe7e975ff9eee42d420600345160e&utm_source=jetradar&utm_medium=3rdparty&client_ref=fnjtrus_tg2b&utm_campaign=metasearch&currency=usd&cmpid=3P-CPC-JTR-USA-XXX-FLT-MET-PYP-cg0zkzxavu5c-DIR-XXX-2014-01-28&marker=7uh46i0v2

Features of the formation of links to some gates

Some gates don’t give direct links, but transmit data in the params array. Such agencies contain the method parameter with the value "POST" in the array (in normal gates this parameter is equal to "GET"). An example of such a response:

{
    "params": {
        "FlightNumber1": "7793",
        "PointOfSaleCountry": "US",
        "Origin2": "BLQ",
        "UserLanguage": "en",
        "Adult": "1",
        "Destination2": "MLA",
        "DisplayedPriceCurrency": "EUR",
        "DepartureDate2": "2016-08-18",
        "Origin1": "MLA",
        "FlightNumber2": "7794",
        "ReferralId": "GoogleFlightSearch",
        "Destination1": "BLQ",
        "TripType": "RoundTrip",
        "UserCurrency": "USD",
        "DisplayedPrice": "153.98",
        "BookingCode1": "Y",
        "Carrier1": "FR",
        "Cabin1": "Economy",
        "DepartureDate1": "2016-07-25",
        "BookingCode2": "Y",
        "Cabin2": "Economy",
        "Carrier2": "FR"
    },
    "click_id": 56773565449083,
    "gate_id": "50",
    "method": "POST",
    "url": "https://www.bookryanair.com/SkySales/booking.aspx?utm_source=aviasales_com"
}

To redirect a user to the site of such an agency and track the transition, you need to make a redirect page.

To track the partner marker, the page should contain the following code:

<img width="0" height="0" id="pixel" src="//yasen.aviasales.com/adaptors/pixel_click.png?click_id=CLICK_ID&gate_id=GATE_ID">

where click_id is the value of a parameter from an array with a response (in the example above, this parameter is 56773565449083), gate_id is the gate identifier (in the example above it is 50).

You can add the pause to the page while the image is loading, during which the user is shown a message that they are being redirected to the agency’s website.

On the page, the method parameter is also checked and, depending on the result, one of the scenarios is executed:

  • if the GET method — redirects the direct link from the url parameter
  • if the POST method — a form is formed with parameters from the array params and the user is redirected from this page by reference from the url field in the response above

The version of the redirect page can be viewed here.

Airline and agency logos

Airline logos are available at: https://pics.avs.io/width/height/iata.png

Agency logos can be obtained from: https://pics.avs.io/as_gates/width/height/id.png

where width is the logo width, height is the logo height, iata is the airline IATA code, id — the agency ID from the flight search API response (see the terms field). 

An example: https://pics.avs.io/200/200/UN.png.

To get a retina version of the logo, use the link format like https://pics.avs.io/as_gates/width/height/id@2x.png

An example: https://pics.avs.io/as_gates/110/40/70@2x.png