# Multi Trip API

API endpoint for this API is: **`https://api.flightapi.io/multitrip`**

## Guide

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can generate an API key from your Dashboard at any time.

Here is the list of default parameters you have to use with this API:

| Parameters                                                         | Description                                                                                                                                                                                         | Type     |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| <p>api\_key</p><p><br><mark style="color:red;">required</mark></p> | This is your personal API key. You can find this on your Dashboard.                                                                                                                                 | `String` |
| <p>trips</p><p><br><mark style="color:red;">required</mark></p>    | Number of Flights one wants to take. Minimum value is **3** and maximum value is **5**.                                                                                                             | `String` |
| <p>arp1</p><p><br><mark style="color:red;">required</mark></p>     | This is the IATA code of first departure airport.                                                                                                                                                   | `String` |
| <p>arp2<br><br><mark style="color:red;">required</mark></p>        | This is the IATA code of first arrival airport.                                                                                                                                                     | `String` |
| <p>date1</p><p><br><mark style="color:red;">required</mark></p>    | <p>Date of departure from the first airport.<br><br>Format - <em>YYYY-MM-DD</em></p>                                                                                                                | `String` |
| <p>arp3<br><br><mark style="color:red;">required</mark></p>        | This is the IATA code of the second departure airport.                                                                                                                                              | `String` |
| <p>arp4<br><br><mark style="color:red;">required</mark></p>        | This is the IATA code of the second arrival airport.                                                                                                                                                | `String` |
| <p>date2<br><br><mark style="color:red;">required</mark></p>       | <p>Date of departure from the second airport.<br><br>Format - <em>YYYY-MM-DD</em></p>                                                                                                               | `String` |
| <p>arp5<br><br><mark style="color:red;">required</mark></p>        | <p>This is the IATA code of the third departure airport.<br><br><a data-footnote-ref href="#user-content-fn-1">Use only when numberofFlights is <strong>3</strong>.</a></p>                         | `String` |
| <p>arp6<br><br><mark style="color:red;">required</mark></p>        | <p>This is the IATA code of the third arrival airport.<br><br><a data-footnote-ref href="#user-content-fn-1">Use only when numberofFlights is <strong>3</strong>.</a></p>                           | `String` |
| <p>date3<br><br><mark style="color:red;">required</mark></p>       | <p>Date of departure from the third airport.<br><br><a data-footnote-ref href="#user-content-fn-1">Use only when numberofFlights is <strong>3</strong>.</a></p>                                     | `String` |
| <p>adults</p><p><br><mark style="color:red;">required</mark></p>   | This is the number of adults.                                                                                                                                                                       | `String` |
| <p>children<br><br><mark style="color:red;">required</mark></p>    | This is the number of childrens.                                                                                                                                                                    | `String` |
| <p>infants<br><br><mark style="color:red;">required</mark></p>     | This is the number of infants.                                                                                                                                                                      | `String` |
| <p>cabinclass<br><br><mark style="color:red;">required</mark></p>  | <p>This is the class of the seat in the plane.<br><br>Possible Values- "<strong>Economy</strong>", "<strong>Business</strong>", "<strong>First</strong>" or "<strong>Premium\_Economy</strong>"</p> | `String` |
| <p>currency<br><br><mark style="color:red;">required</mark></p>    | You can use any currency code like **USD**, **INR**, **EUR**, etc                                                                                                                                   | `String` |

## Usage

You have to send a GET request to  `https://api.flightapi.io/multitrip` along with all the parameters.&#x20;

Take a look at how you might call this API using various different coding languages.

{% tabs %}
{% tab title="curl" %}

```bash
curl "https://api.flightapi.io/multitrip/65eb6ytue784475dccfa32?arp1=JAI&arp2=DEL&arp3=DEL&arp4=MAA&arp5=MAA&arp6=CCU&date1=2025-06-22&date2=2025-06-28&date3=2025-07-03&adults=1&infants=0&children=0&cabinclass=Economy&currency=USD"
```

{% endtab %}

{% tab title="Node" %}

```javascript
const axios = require('axios');

const url = "https://api.flightapi.io/multitrip/65eb6ytue784475dccfa32";
const params = {
  arp1: "JAI",
  arp2: "DEL",
  arp3: "DEL",
  arp4: "MAA",
  arp5: "MAA",
  arp6: "CCU",
  date1: "2025-06-22",
  date2: "2025-06-28",
  date3: "2025-07-03",
  adults: "1",
  infants: "0",
  children: "0",
  cabinclass: "Economy",
  currency: "USD"
};

axios.get(url, { params })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error("Error:", error.response ? error.response.data : error.message);
  });


```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.flightapi.io/multitrip/65eb6ytue784475dccfa32"
params = {
    "arp1": "JAI",
    "arp2": "DEL",
    "arp3": "DEL",
    "arp4": "MAA",
    "arp5": "MAA",
    "arp6": "CCU",
    "date1": "2025-06-22",
    "date2": "2025-06-28",
    "date3": "2025-07-03",
    "adults": "1",
    "infants": "0",
    "children": "0",
    "cabinclass": "Economy",
    "currency": "USD"
    "trips": "3"
}

response = requests.get(url, params=params)

if response.status_code == 200:
    print(response.json())
else:
    print(f"Request failed with status code {response.status_code}")

```

{% endtab %}
{% endtabs %}

### Response

The sample response of the API will look somewhat like this.

{% code overflow="wrap" fullWidth="false" %}

```json
// Sample Response

{
  "legs": [
    {      
      "id": "JAI-GOA:UK564~5:LX155~6:LX3618~6:LH6920~6:0",
      "departureTime": "19:55",
      "arrivalTime": "12:50",
      "duration": "20h 25m",
      "departureAirportCode": "JAI",
      "arrivalAirportCode": "GOA",
      "airlineCodes": [
        "LX",
        "UK",
        "LH"
      ],
      "stopoverAirportCodes": [
        "BOM",
        "ZRH",
        "MUC"
      ],
      "allianceCodes": [
        "",
        "star_alliance"
      ],
      "stopoversCount": 3,
      "departureTimeMinutes": 1195,
      "arrivalTimeMinutes": 770,
      "departureDateTime": "2023-07-05T19:55:00.000+05:30",
      "arrivalDateTime": "2023-07-06T12:50:00.000+02:00",
      "stopoverDurationMinutes": 445,
      "durationMinutes": 1225,
      "overnight": true,
      "stopoverDuration": "07h 25m",
      "durationDays": 1,
      "longStopover": true,
      "segments": [
        {
          "durationMinutes": 125,
          "stopoverDurationMinutes": 175,
          "departureAirportCode": "JAI",
          "arrivalAirportCode": "BOM",
          "airlineCode": "UK",
          "cabin": "economy",
          "designatorCode": "UK564",
          "departureDateTime": "2023-07-05T19:55:00.000+05:30",
          "arrivalDateTime": "2023-07-05T22:00:00.000+05:30"
        },
        {
          "durationMinutes": 530,
          "stopoverDurationMinutes": 185,
          "departureAirportCode": "BOM",
          "arrivalAirportCode": "ZRH",
          "airlineCode": "LX",
          "cabin": "economy",
          "designatorCode": "LX155",
          "departureDateTime": "2023-07-06T00:55:00.000+05:30",
          "arrivalDateTime": "2023-07-06T06:15:00.000+02:00"
        },
        {
          "durationMinutes": 50,
          "stopoverDurationMinutes": 85,
          "departureAirportCode": "ZRH",
          "arrivalAirportCode": "MUC",
          "airlineCode": "LX",
          "operatingAirlineCode": "LH",
          "cabin": "economy",
          "designatorCode": "LX3618",
          "departureDateTime": "2023-07-06T09:20:00.000+02:00",
          "arrivalDateTime": "2023-07-06T10:10:00.000+02:00"
        },
        {
          "durationMinutes": 75,
          "stopoverDurationMinutes": 0,
          "departureAirportCode": "MUC",
          "arrivalAirportCode": "GOA",
          "airlineCode": "LH",
          "operatingAirlineCode": "EN",
          "cabin": "economy",
          "designatorCode": "LH6920",
          "departureDateTime": "2023-07-06T11:35:00.000+02:00",
          "arrivalDateTime": "2023-07-06T12:50:00.000+02:00"
        }
      ],
      "operatingAirlineCodes": [
        "EN"
      ],
      "stopoverCode": "MORE_THAN_ONE_STOP",
      "shortStopover": false,
      "earlyDeparture": false,
      "lateArrival": false,
      "newAircraft": false,
      "oldAircraft": true,
      "highlyRatedCarrier": false,
      "score": 628.5
    }       
  ],
  "tags": [
    
  ],
  "search": {
    "id": "f03653ce738ae2e5msr",
    "cabin": "economy",
    "adultsCount": 1,
    "childrenCount": 0,
    "infantsCount": 0,
    "siteCode": "US",
    "currencyCode": "USD",
    "locale": "en",
    "deviceType": "desktop",
    "appType": "WEB_APP",
    "createdAt": "2023-05-27T11:51:26.651Z",
    "key": "[JAI:GOA:2023-07-05]~1~0~0~US~economy~desktop~WEB_APP",
    "userCountryCode": "US",
    "wgCampaign": "",
    "legs": [
      {
        "id": "JAI:GOA:2023-07-05",
        "outboundDate": "2023-07-05",
        "departureAirportCode": "JAI",
        "arrivalAirportCode": "GOA",
        "departureCity": {
          "code": "JAI",
          "name": "Jaipur",
          "enName": "Jaipur",
          "countryCode": "IN",
          "countryName": "India",
          "countryEnName": "India",
          "worldRegionCode": "i",
          "worldRegionName": "Asia",
          "worldRegionEnName": "Asia"
        },
        "arrivalCity": {
          "code": "GOA",
          "name": "Genoa",
          "enName": "Genoa",
          "countryCode": "IT",
          "countryName": "Italy",
          "countryEnName": "Italy",
          "worldRegionCode": "e",
          "worldRegionName": "Europe",
          "worldRegionEnName": "Europe"
        },
        "departureAirport": {
          "name": "Jaipur Airport",
          "code": "JAI",
          "cityCode": "JAI"
        },
        "arrivalAirport": {
          "name": "Genoa Airport",
          "code": "GOA",
          "cityCode": "GOA"
        }
      }
    ]
  },"airlines": [
    {
      "name": "Air Dolomiti",
      "code": "EN"
    },
    {
      "name": "Air France",
      "code": "AF"
    },
    {
      "name": "Emirates",
      "code": "EK"
    },
    {
      "name": "Etihad Airways",
      "code": "EY"
    },
    {
      "name": "KLM",
      "code": "KL"
    },
    {
      "name": "KLM Cityhopper",
      "code": "WA"
    },
    {
      "name": "Lufthansa",
      "code": "LH"
    },
    {
      "name": "Turkish Airlines",
      "code": "TK"
    },
    {
      "name": "Virgin Atlantic Airways",
      "code": "VS"
    },
    {
      "name": "Vistara",
      "code": "UK"
    }
  ],
  "airports": [
    {
      "name": "Abu Dhabi International Airport",
      "code": "AUH",
      "cityCode": "AUH"
    },
    {
      "name": "Geneva Airport",
      "code": "GVA",
      "cityCode": "GVA"
    },
    {
      "name": "Genoa Airport",
      "code": "GOA",
      "cityCode": "GOA"
    },
    {
      "name": "Hamad International Airport",
      "code": "DOH",
      "cityCode": "DOH"
    },
    {
      "name": "Istanbul Airport",
      "code": "IST",
      "cityCode": "IST"
    },
    {
      "name": "Jaipur Airport",
      "code": "JAI",
      "cityCode": "JAI"
    },
    {
      "name": "Zurich Airport",
      "code": "ZRH",
      "cityCode": "ZRH"
    }
  ],
  "trips": [
    {
      "id": "f03653ce738ae2e5msr:KL3661~5-KL872~6-KL1565~6",
      "code": "KL3661~5-KL872~6-KL1565~6",
      "legIds": [
        "JAI-GOA:KL3661~5:KL872~6:KL1565~6:0"
      ]
    },
    {
      "id": "f03653ce738ae2e5msr:6E5237~5-EY203~5-EY85~6-AZ1383~6",
      "code": "6E5237~5-EY203~5-EY85~6-AZ1383~6",
      "legIds": [
        "JAI-GOA:6E5237~5:EY203~5:EY85~6:AZ1383~6:0"
      ]
    },
    {
      "id": "f03653ce738ae2e5msr:6E2405~5-AZ769~6-AZ1383~6",
      "code": "6E2405~5-AZ769~6-AZ1383~6",
      "legIds": [
        "JAI-GOA:6E2405~5:AZ769~6:AZ1383~6:0"
      ]
    }
  ],
  "fares": [
    {
      "paymentFees": [
        {
          "paymentMethodId": 15,
          "currencyCode": "USD",
          "amount": 0,
          "amountUsd": 0,
          "totalAmount": 0,
          "totalAmountUsd": 0
        },
        {
          "paymentMethodId": 10,
          "currencyCode": "USD",
          "amount": 0,
          "amountUsd": 0,
          "totalAmount": 0,
          "totalAmountUsd": 0
        },
        {
          "paymentMethodId": 3,
          "currencyCode": "USD",
          "amount": 0,
          "amountUsd": 0,
          "totalAmount": 0,
          "totalAmountUsd": 0
        }
      ],
      "id": "f03653ce738ae2e5msr:mytrip.com.us:7755cd345469a40f",
      "price": {
        "totalAmount": 465,
        "totalAmountUsd": 464.88,
        "amount": 465,
        "amountUsd": 464.88,
        "originalAmount": 464.88,
        "originalAmountUsd": 464.88,
        "amountPerAdult": 464.88,
        "amountPerChild": 0,
        "amountPerInfant": 0,
        "taxAmount": 0,
        "taxAmountUsd": 0,
        "totalTaxAmount": 0,
        "totalTaxAmountUsd": 0,
        "currencyCode": "USD",
        "paymentFeeAmountUsd": 0,
        "bookingFee": 0,
        "bookingFeeUsd": 0,
        "totalBookingFee": 0,
        "totalBookingFeeUsd": 0
      },
      "providerCode": "mytrip.com.us",
      "handoffUrl": "https://handoff.wego.com/flights/continue?currency=USD&url_locale=en&site_code=US&device_type=desktop&app_type=WEB_APP&domain=www.wego.com&fare_id=f03653ce738ae2e5msr:mytrip.com.us:7755cd345469a40f&route=JAI-GOA&search_id=f03653ce738ae2e5msr&trip_id=JAI:GOA:2023-07-05&pwa=false&api_version=2&integration_code=mytrip.com&region=ap-southeast-1&placement_type=metasearch",
      "ecpc": 0.560586,
      "remainingSeatsCount": 0,
      "conditionIds": [
        
      ],
      "legConditionIds": [
        
      ],
      "refundable": false,
      "exchangeable": false,
      "tags": [
        
      ],
      "score": 286.12,
      "tripId": "f03653ce738ae2e5msr:I5773~5-AZ769~6-AZ1383~6"
    }
  ]
  }
  
```

{% endcode %}

{% hint style="info" %}
It is just a sample API response. Some objects will have more attributes. New arrays will also be there.
{% endhint %}

### Understanding the Response

In the JSON response, you may observe that many objects include references (IDs or codes) to objects from other lists. This pattern is employed in our API to prevent redundant data and reduce the overall size by allowing multiple objects to reference the same data.

<figure><img src="https://3461487639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F64KQudssITthDnR3aDZs%2Fuploads%2F1JClNLxbMBTWnCsvgyF8%2Funder-resp.png?alt=media&#x26;token=f732a70a-3244-4906-bd5b-4cdacbbbf2b6" alt=""><figcaption><p>Everything is associated with IDs</p></figcaption></figure>

[^1]:
