> For the complete documentation index, see [llms.txt](https://traveloapi.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://traveloapi.gitbook.io/api/flight-api/flight-search.md).

# Flight Search

Welcome to the developer documentation of the Traveloapi Flight API Reference. This API let you build full featured websites and applications with all the power of flight search, without having to implement the complex stuff that we've already done. Traveloapi Flight API Reference allows users to search for Flight. API consumer can use this service to integrate it with their application.

{% hint style="info" %}
Get Access to API - To access the services of API you must have key credentials provided by Traveloapi.
{% endhint %}

## Flight Search

<mark style="color:green;">`POST`</mark> `https://traveloapi.com/yourapi/flightmain/flight_search`&#x20;

#### Path Parameters

| Name          | Type   | Description                                                                                                                                                                                                                                      |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| gatkey        | string | gatkey (provided by traveloapi)Pass gatkey with url                                                                                                                                                                                              |
| SearchDetails | string | This parameter gets and sets the entire flight search – specified properties entered by user. These search parameters should be submiited as query string with URL                                                                               |
| Origin        | string | This value represents source city name. Three alphabetic IATA code should be entered by user to get valid source city. This field should not contain More than and less than 3 characters.                                                       |
| Destination   | string | It represents destination city/airport name .It cannot be same as source value. Three alphabetic IATA code should be entered by user to get valid destination city. This field should not contain More than and less than 3 characters.          |
| BeginDate     | string | It represents journey date. This value should be entered as string not less than and More than 10 characters in date format ‘yyyy-mm-dd’.(Date and time are taken in miliseconds)                                                                |
| TripType      | string | This is an Enumeration type parameter which has a specified list of values OneWay=0 and RoundTrip=1                                                                                                                                              |
| Adults        | string | Domain for this field contains values from 1-9. At least one adult must be selected.                                                                                                                                                             |
| Childs        | string | Domain range for this field is 0-9.                                                                                                                                                                                                              |
| Infants       | string | This field’s domain has values from 0-2. Number of infants cannot be more than number of adults as per single booking.                                                                                                                           |
| Cabin         | string | This field has enumeration values (Economy =0,Business=2)                                                                                                                                                                                        |
| EngineID      | string | This parameter has been defined as Enumeration type which has specified list of constant values. Each int value has been assigned to a different airline Indigo = 0, Spicjet = 1, GoAir = 5, TravelPort = 7, AirAsia=10, AirCosta = 6, Trujet=11 |

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

`````javascript
{
  "Errors": null,
  "Insurance": null,
  "Journeys": [
    {
      "JourneyDetail": null,
      "Segments": [
        {
          "BondType": "OutBound",
          "Bonds": [
            {
              "BoundType": "OutBound",
              "IsBaggageFare": false,
              "IsSSR": false,
              "ItineraryKey": null,
              "JourneyTime": "1h 30m",
              "Legs": [
                {
                  "AircraftCode": "19l0icBAAA/BJusxGMAAAA==",
                  "AircraftType": "738",
                  "AirlineName": "9W",
                  "AirlinePnr": null,
                  "ArrivalDate": "Thu-29Nov2018",
                  "ArrivalTerminal": "",
                  "ArrivalTime": "04:25",
                  "AvailableSeat": "5",
                  "BaggageUnit": "PC",
                  "BaggageWeight": "1",
                  "BookSeat": null,
                  "BoundType": "OutBound",
                  "Cabin": "Economy",
                  "CabinClasses": null,
                  "Capacity": 0,
                  "CarrierCode": "9W",
                  "CurrencyCode": null,
                  "DepartureDate": "Thu-29Nov2018",
                  "DepartureTerminal": "2",
                  "DepartureTime": "02:55",
                  "Destination": "HYD",
                  "Duration": "01h 30m",
                  "FareBasisCode": null,
                  "FareClassOfService": "S",
                  "FareRulesKey": "19l0icBAAA/BSusxGMAAAA==",
                  "FlightDesignator": null,
                  "FlightDetailRefKey": "19l0icBAAA/BKusxGMAAAA==",
                  "FlightName": "Jet AirWays",
                  "FlightNumber": "348",
                  "GDSPnr": null,
                  "Group": "0",
                  "IsConnecting": false,
                  "IsSeatOpen": false,
                  "LayoverAt": null,
                  "LayoverDuration": null,
                  "NumberOfStops": "0",
                  "OperatedBy": null,
                  "Origin": "BOM",
                  "ProviderCode": "1G!`738``5`PC`1`Economy``9W`2`0`False`0````S``01h 30m``S",
                  "Remarks": "",
                  "SSRDetails": null,
                  "Sold": 0,
                  "Status": null
                }
              ],
              "addOnDetail": null
            }
          ],
          "CurrencyCode": null,
          "Deeplink": "",
          "EngineID": 7,
          "Fare": {
            "BasicFare": 2692,
            "BrandKeys": null,
            "ExchangeRate": 0,
            "PaxFares": [
              {
                "AirlinePnr": null,
                "BaggageUnit": "PC",
                "BaggageWeight": "1",
                "BaseTransactionAmount": 0,
                "BasicFare": 2692,
                "Branded": null,
                "CancelPenalty": 4366,
                "Cashback": 0,
                "ChangePenalty": 3186,
                "Commission": 0,
                "DFValue": "0",
                "EquivCurrencyCode": null,
                "Fare": [
                  {
                    "Amount": 171,
                    "ChargeCode": "K3",
                    "ChargeType": null
                  },
                  {
                    "Amount": 154,
                    "ChargeCode": "PSF",
                    "ChargeType": null
                  },
                  {
                    "Amount": 142,
                    "ChargeCode": "ADF",
                    "ChargeType": null
                  },
                  {
                    "Amount": 600,
                    "ChargeCode": "YQ",
                    "ChargeType": null
                  },
                  {
                    "Amount": 125,
                    "ChargeCode": "YR",
                    "ChargeType": null
                  }
                ],
                "FareBasisCode": "Economy",
                "FareInfoKey": "19l0icBAAA/BSusxGMAAAA==",
                "FareInfoValue": "gws-eJxNTkEKg0AMfIzMfZKCbm5rdUUPXUstyF76/2c0qxYaSGaSmZDEGJUSRFTjXzT4NLZjyS8gg55zGaEtCfGmgKIJmy7PFde++Twf2olSXZwstQ4YbklPqQbKUe/rwzVq5wZHQT2LSn2AH0mz09yPb9uHjQxmFtr+EtnB//wCAFgq/Q==",
                "GDSPnr": null,
                "IsZeroCancellation": false,
                "MarkUP": 0,
                "PaxType": 0,
                "Refundable": true,
                "STF": 0,
                "ServiceFee": 0,
                "TDS": 0,
                "TotalFare": 3884,
                "TotalTax": 1192,
                "TransactionAmount": 0,
                "TransactionFee": 0,
                "ZeroCancellationCharge": 100,
                "ZeroCancellationValidity": "28"
              }
            ],
            "TotalFareWithOutMarkUp": 3884,
            "TotalTaxWithOutMarkUp": 1192
          },
          "FareIndicator": 0,
          "FareRule": "CAN-BEF 4_0:4366.0|CHG-BEF 4_0:3186.0|EMTFee-500|CANCEL-BEF 4_0:4366.0|CHANGE-BEF 4_0:3186.0",
          "Fares": null,
          "IsBaggageFare": false,
          "IsBranded": false,
          "IsCache": false,
          "IsHoldBooking": false,
          "IsInternational": false,
          "IsRoundTrip": false,
          "IsSpecial": false,
          "IsSpecialId": false,
          "ItineraryKey": "3A9146120A07425AC25F44A39D99E8C4",
          "JourneyIndex": 0,
          "MemoryCreationTime": "/Date(1542875860304+0530)/",
          "NearByAirport": false,
          "PaxSSRs": null,
          "PromoCode": null,
          "Remark": null,
          "SSDetails": "Free Meals",
          "SearchId": "260,ADT:BF=2692 Tax=1192,CHD:BF=0 Tax=0,INF:BF=0 Tax=0,DFValue=0,APFV=3884`1192`2692`4366.0`3186.0`0`0`Economy``PC`1`True`0`0`0`0`,CPFV=,IPFV=,ATB=`K3:171`PSF:154`ADF:142`YQ:600`YR:125,CTB=,ITB=,TBA=2692,TTA=1192,TFA=3884",
          "Sessionfilepath": null,
          "description": null
        },
        ],
  "TraceId": "TRAVL40157662192"
}
    
`````

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "message": "Invalid Request",
    "status": "error",
    
}
```

{% endtab %}
{% endtabs %}

### Example  Oneway Request :

```typescript
{
  "FlightSearchDetails": [
    {
      "Origin": " BOM",
      "Destination": " GOI",
      "BeginDate": "2018-11-29"
    }
  ],
  "EngineID": [
    7,
    0,
    1,
    5,
    10,
    6,
    11
  ],
  "TripType": 0,
  "Cabin": 0,
  "Adults": "1",
  "Childs": "0",
  "Infants": "0"
  
}
```

### Example Roundtrip Request :

```coffeescript
{
  "FlightSearchDetails": [
    {
      "Origin": " BOM",
      "Destination": " GOI",
      "BeginDate": "2018-12-21"
    },
    
    {
      "Origin": " GOI",
      "Destination": " BOM",
      "BeginDate": "2018-12-29"
    }
    
    
    
  ],
  "EngineID": [
    7,
    0,
    1,
    5,
    10,
    6,
    11
  ],
  "TripType": 1,
  "Cabin": 0,
  "Adults": "1",
  "Childs": "0",
  "Infants": "0"
  
}
```
