Skip to content
valentinaroma edited this page Dec 10, 2021 · 45 revisions

Requesting price/availability

Request example

curl 'http://example.com/api/search?from=BKK&to=BOM&date1=2017-09-25&date2=2017-10-01&adults=2&children=1&infants=1&cabin=Y&partner=jtrdr&password=pass&locale=en&currency=usd&market=us'

Request parameters

  • from - IATA code of departure city/airport.
  • to - IATA code of arrival city/airport.
  • date1 - YYYY-MM-DD date of departure.
  • date2 - YYYY-MM-DD date of departure for a roundtrip journey. Sould be omitted for oneway searches.
  • adults - "1" if omitted!
  • children - "0" by default.
  • infants - "0" by default.
  • cabin - preferred booking class. "Y" for economy, "C" for business, "F" for first/premium. Empty by default (no preference).
  • partner - partner company identificator. We will send 'aviasales' value.
  • password - password of current partner.
  • locale - User locale (en by default).
  • currency - User currency (usd by default).
  • market - Market where integration launches (us by default).

Response example

<?xml version='1.0' encoding='utf-8' ?>
 <variants>
  <variant>
   <price>2664</price>
   <currency>usd</currency>
   <url>BOOKING_PAGE_DEEPLINK</url>
   <seats>6</seats>
   <isCharter>false</isCharter>
   <commission>0.045</commission>
   <segment>
    <flight>
     <operatingCarrier>UN</operatingCarrier>
     <marketingCarrier>SU</marketingCarrier>
     <number>3</number>
     <departure>BKK</departure>
     <departureDate>2021-09-25</departureDate>
     <departureTime>09:55</departureTime>
     <arrival>BOM</arrival>
     <arrivalDate>2012-09-25</arrivalDate>
     <arrivalTime>11:10</arrivalTime>
     <equipment>735</equipment> 
     <cabin>Y</cabin>
     <baggage>1PC23</baggage>
     <handbags>1PC5</handbags>
     <baggageRecheck>false</baggageRecheck>
     <virtualInterline>false</virtualInterline>
     <fareCode>WOW1</fareCode>
     <isBus>false</isBus>
     <isTrain>false</isTrain>
     <technicalStop>
         <airportCode>AER</airportCode>
     </technicalStop>
     <technicalStop>
         <airportCode>AAQ</airportCode>
     </technicalStop>
    </flight>
   </segment>
   <segment>
    <flight>
      <operatingCarrier>UN</operatingCarrier>
        <marketingCarrier>SU</marketingCarrier>
        <number>3</number>
        <departure>BOM</departure>
        <departureDate>2021-10-01</departureDate>
        <departureTime>09:55</departureTime>
        <arrival>DEL</arrival>
        <arrivalDate>2017-10-01</arrivalDate>
        <arrivalTime>11:10</arrivalTime>
        <equipment>736</equipment>
        <cabin>Y</cabin>
        <baggage>1PC23</baggage>
        <handbags>1PC5</handbags>
        <baggageRecheck>false</baggageRecheck>
        <virtualInterline>false</virtualInterline>
        <fareCode>WOW1</fareCode>
        <isBus>false</isBus>
        <isTrain>false</isTrain>
        <technicalStop>
        </technicalStop>
       </flight>
    </segment>
  </variant>
<variant>
...more variants...
</variants>
  • Server should respond in 30 seconds or less.
  • All non HTTP 200 responses are errors. Response should contain text description of error.
  • All HTTP 200 responses are successful responses.
  • BOOKING_PAGE_DEEPLINK string is an URL to booking page. Booking page language and currency must match the language and currency provided in the request.

Empty response example (no proposals)

<?xml version='1.0' encoding='utf-8' ?>
<variants></variants>

Response content

  • /variants - root element containing ticket variants.
  • //variant - full flight variant
  • price (mandatory) - total price for all the passengers.
  • currency (mandatory) - currency code used in price. For example RUB.
  • url (mandatory) - deeplink to variant page for booking.
  • seats (optional) – seats available for booking by current fare. 0..9 number. 0 for no tickets available and 9 for more than 9 tickets available.
  • isCharter (optional) - qualifies itinerary as charter true|false
  • commission (optional) - commission rate for a specific proposal
  • segment - 1 element for one way, 2 for roundtrip
  • segment/flight - 1..n, more than one if there're connecting points in the requested leg
  • //flight - one hop flight information
    • operatingCarrier (mandatory) - airline IATA code (2 latin letters) aircraft belongs to this airline
    • marketingCarrier (optional) - airline IATA code (2 latin letters) of code sharing airline. Should be specified if differs with operatingCarrier
    • number (mandatory) - 2..4 digits, full flight number is (operatingCarrier + number)
    • departure (mandatory) - departure airport IATA code (3 latin letters)
    • departureDate (mandatory) - departure date, 'YYYY-MM-DD', local
    • departureTime (mandatory) - departure time, 'HH:MM', local
    • arrival (mandatory) - arrival airport IATA code (3 latin letters)
    • arrivalDate (mandatory) - arrival date, 'YYYY-MM-DD', local
    • arrivalTime (mandatory) - arrival time, 'HH:MM', local
    • equipment (optional) - IATA (or russian domestic) aircraft/bus/train equipment type code. several letters/digits
    • cabin (optional) - cabin class. could be 'F' for 'first', 'C' for 'business', 'Y' for 'economy/couch'
    • baggage (optional) — baggage string code in format {N}PC{WW} where N is a number of bags permitted by current fare and WW is a max weight of every bag. Please pass an empty string if no baggage information available, and 0PC value for hand baggage only fares.
    • handbags (optional) — handbags string code in format {N}PC{WW} where N is a number of bags permitted by current fare and WW is a max weight of every bag. Please pass an empty string if no handbags information available.
    • baggageRecheck (optional) — the feature describing the passenger has to re-check his baggage between the flight with attribute and previous one true|false.
    • virtualInterline (optional) — the feature describing the passenger has to check in again between segment with the interline and previous one true|false.
    • fareCode (optional) – fare code or fare basis for current variant.
    • isBus (optional)/isTrain(optional) — qualifies segment as part of multimodal itinerary carried by bus/train true|false.
    • //technicalStop — List of Technical Stops
      • airportCode — IATA-code of the airport

Client redirects user browser to the url from variant/url tag. Client is also able to add tracking marker (also called sub-id) string to variant/url URL to track customers. Full deeplink booking URL built as follows:

  1. Parse Deeplink URL
  2. Add marker=<marker_value> to query params section (make sure the request parameters of the original deep link URL comply with the RFC 3986 standard)
  3. Encode query params section

marker_value is a string containing 256 characters or less. Markers should be returned as a part of booking information in statistics.

Request multi city example

curl 'http://example.ru/api/search?from=MOW&to=LED&date1=2017-09-25&from2=LED&to2=IKT&date2=2017-10-01&from3=IKT&to3=VVO&date3=2017-10-03&adults=2&children=1&infants=1&cabin=Y&partner=avsl&password=pass&locale=ru&currency=rub'

Response multi city example

<?xml version='1.0' encoding='utf-8' ?>
<variants>
    <variant>
        <price>2664</price>
        <currency>rub</currency>
        <url>BOOKING_PAGE_DEEPLINK</url>
        <seats>3</seats>
        <isCharter>false</isCharter>
        <commission>0.0493</commission>
        <segment>
            <flight>
                <operatingCarrier>UN</operatingCarrier>
                <marketingCarrier>SU</marketingCarrier>
                <number>3</number>
                <departure>DME</departure>
                <departureDate>2017-09-25</departureDate>
                <departureTime>09:55</departureTime>
                <arrival>LED</arrival>
                <arrivalDate>2017-09-25</arrivalDate>
                <arrivalTime>11:10</arrivalTime>
                <equipment>735</equipment>
                <cabin>Y</cabin>
                <baggage>1PC23</baggage>
                <handbags>1PC5</handbags>
                <baggageRecheck>false</baggageRecheck>
                <virtualInterline>false</virtualInterline>
                <fareCode>WOW1</fareCode>
                <isBus>false</isBus>
                <isTrain>false</isTrain>
            </flight>
        </segment>
        <segment>
            <flight>
                <operatingCarrier>UN</operatingCarrier>
                <marketingCarrier>SU</marketingCarrier>
                <number>3</number>
                <departure>LED</departure>
                <departureDate>2017-10-01</departureDate>
                <departureTime>09:55</departureTime>
                <arrival>IKT</arrival>
                <arrivalDate>2017-10-01</arrivalDate>
                <arrivalTime>11:10</arrivalTime>
                <equipment>736</equipment>
                <cabin>Y</cabin>
                <baggage>1PC23</baggage>
                <handbags>1PC5</handbags>
                <baggageRecheck>true</baggageRecheck>
                <virtualInterline>true</virtualInterline>
                <fareCode>WOW1</fareCode>
                <isBus>false</isBus>
                <isTrain>false</isTrain>
                <technicalStop>
                    <airportCode>AER</airportCode>
                </technicalStop>
                <technicalStop>
                    <airportCode>AAQ</airportCode>
                </technicalStop>
            </flight>
        </segment>
        <segment>
            <flight>
                <operatingCarrier>SU</operatingCarrier>
                <marketingCarrier>SU</marketingCarrier>
                <number>3</number>
                <departure>IKT</departure>
                <departureDate>2017-10-03</departureDate>
                <departureTime>10:55</departureTime>
                <arrival>VVO</arrival>
                <arrivalDate>2017-10-03</arrivalDate>
                <arrivalTime>15:00</arrivalTime>
                <equipment>736</equipment>
                <cabin>Y</cabin>
                <baggage>1PC23</baggage>
                <handbags>1PC5</handbags>
                <baggageRecheck>false</baggageRecheck>
                <virtualInterline>false</virtualInterline>
                <fareCode>WOW1</fareCode>
                <isBus>false</isBus>
                <isTrain>false</isTrain>
            </flight>
        </segment>
    </variant>
    <variant>
    ...more variants...
    </variant>
</variants>

Sales reporting

Request example

curl 'http://example.com/api/statistics?date1=2016-05-01&date2=2016-06-01&partner=aviasales&password=secret'

Request parameters

  • date1 - YYYY-MM-DD date.
  • date2 - YYYY-MM-DD date.
  • partner - partner identifier.
  • password - password of current partner.

Response should contain all bookings created between date1 and date2.

Response example:

<bookings>
  <booking>
    <id>JHKHVR</id>
    <PNR>AEFE3S</PNR>
    <created_at>2012-05-02 00:02:01</created_at>
    <marker>1232:1222.t</marker>
    <price>1199</price>
    <profit>200</profit>
    <currency>RUB</currency>
    <state>PAID</state>
    <segment>
      <flight>
        <operatingCarrier>UN</operatingCarrier>
        <number>3</number>
        <departure>DME</departure>
        <departureDate>2012-09-25</departureDate>
        <departureTime>09:55</departureTime>
        <arrival>LED</arrival>
        <arrivalDate>2012-09-25</arrivalDate>
        <arrivalTime>11:10</arrivalTime>
        <equipment>735</equipment>
        <cabin>Y</cabin>
      </flight>
    </segment>
    <adults>1</adults>
    <children>0</children>
    <infants>0</infants>
  </booking>
  ...more bookings...
</bookings>

Response content

  • /bookings - root element containgin all bookings.
  • //booking - information on one booking.
  • id - unique identifier of booking.
  • PNR - PNR of booking.
  • created_at - YYYY-MM-DD HH:MM date and time of booking in UTC time.
  • marker - marker sent to booking deeplink in GET parameter marker.
  • from - origin IATA.
  • to - destination IATA.
  • price - prices of tickets.
  • profit - metasearch agency profit for this booking.
  • currency - currency for fields price and profit.
  • state - state of booking. Possible values PROCESSING/PAID/CANCELLED.
  • segment - same as in search results.
  • //flight - one hop flight information
    • operatingCarrier - airline IATA code (2 latin letters) aircraft belongs to this airline
    • number - 2..4 digits, full flight number is (operatingCarrier + number)
    • departure - departure airport IATA code (3 latin letters)
    • departureDate - departure date, 'YYYY-MM-DD', local
    • departureTime - departure time, 'HH:MM', local
    • arrival - arrival airport IATA code (3 latin letters)
    • arrivalDate - arrival date, 'YYYY-MM-DD', local
    • arrivalTime - arrival time, 'HH:MM', local
    • equipment - IATA (or russian domestic) aircraft/bus/train equipment type code. several letters/digits
    • cabin - cabin class. could be 'F' for 'first', 'C' for 'business', 'Y' for 'economy/couch'
  • adults - Adults.
  • children - Children.
  • infants - Infants.

Please use this online tool to validate your implementation of gate API: https://aviasales-gate-tester.herokuapp.com/

Supported directions

Request example

curl 'http://example.ru/api/supported_directions?partner=aviasales&password=secret'

Response example:

LON,PAR

PAR,LON

...

NYC,MOW

MOW,NYC

Response content

We expect to receive in response a pair of IATA codes of departure and arrival cities.

Clone this wiki locally