# Track Flights between Airports

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

## 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<br><br><mark style="color:red;">required</mark></p> | This is your personal API key. You can find this on your Dashboard.                                    | `String` |
| <p>date<br><br><mark style="color:red;">required</mark></p>     | <p>This is the date of departure<br><br>Format - YYYYMMDD</p>                                          | `String` |
| <p>airport1<br><br><mark style="color:red;">required</mark></p> | <p>This is the IATA code of the departure airport.<br><br><mark style="color:red;">required</mark></p> | `String` |
| <p>airport2<br><br><mark style="color:red;">required</mark></p> | <p>This is the IATA code of the arrival airport.<br><br><mark style="color:red;">required</mark></p>   | `String` |

## Usage

You have to send a GET request to  `https://api.flightapi.io/trackbyroute` 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/trackbyroute/api_key?date=20230724&airport1=AMS&airport2=LIS"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the Unirest or any other module to make an HTTP GET request
const unirest = require('unirest')

unirest.get('https://api.flightapi.io/trackbyroute/api_key?date=20230724&airport1=AMS&airport2=LIS')
  .then(response => {
    console.log(response.body);
  })
  .catch(error => {
    console.log(error);
  });


```

{% endtab %}

{% tab title="Python" %}

```python
// Set your API key before making the request
import requests

resp = requests.get('https://api.flightapi.io/trackbyroute/api_key?date=20230724&airport1=AMS&airport2=LIS')
print (resp.json())
```

{% endtab %}
{% endtabs %}

### Response

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

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

```json
// Sample Response
     [
       {
          "Airline": "AeroMexico",
          "FlightNumber": "6552",
          "Status": "In Air",
          "Operated By": "KLM Royal Dutch Airlines1697",
          "DepartureTime": "9:08 PM, Apr 24",
          "ArrivalTime": "10:54 PM, Apr 24"
        },
        {
          "Airline": "Air Baltic Corp",
          "FlightNumber": "5296",
          "Status": "Arrived",
          "Operated By": "TAP Portugal673",
          "DepartureTime": "3:09 PM, Apr 24",
          "ArrivalTime": "4:59 PM, Apr 24"
         },
         {
           ...
         }
       ]
  
```

{% endcode %}

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flightapi.io/track-flights-between-airports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
