Skip to main content

Get flights between two airports

curl -X GET "http://localhost:3000/v1/flights?from=LAX&to=JFK&date=2024-03-20" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/v1/flights
Get all flights between two airports for a specific date

Query parameters

from
string
required
Departure airport IATA codeExample: LAX
to
string
required
Arrival airport IATA codeExample: JFK
date
string
required
Flight date in ISO formatExample: 2024-03-20

Response

success
boolean
Indicates if the request was successful
date
string
The date for which flights were searched
route
object
Route information
flightCount
number
Total number of flights found
flights
array
Array of flight objects

Response example

{
  "success": true,
  "date": "2024-03-20",
  "route": {
    "from": "LAX",
    "to": "JFK"
  },
  "flightCount": 15,
  "flights": [
    {
      "airline": {
        "name": "American Airlines",
        "iataCode": "AA",
        "icaoCode": "AAL"
      },
      "flight": {
        "iataNumber": "AA100",
        "icaoNumber": "AAL100",
        "number": "100"
      },
      "departure": {
        "iataCode": "LAX",
        "icaoCode": "KLAX",
        "scheduledTime": "2024-03-20T08:00:00Z",
        "estimatedTime": "2024-03-20T08:05:00Z",
        "gate": "42A",
        "terminal": "4",
        "delay": "5"
      },
      "arrival": {
        "iataCode": "JFK",
        "icaoCode": "KJFK",
        "scheduledTime": "2024-03-20T16:30:00Z",
        "estimatedTime": "2024-03-20T16:35:00Z",
        "gate": "7",
        "terminal": "8"
      },
      "status": "scheduled",
      "type": "departure"
    }
  ]
}

Error responses

401
object
Unauthorized - Invalid or missing JWT token
{
  "message": "Unauthorized"
}
500
object
Internal server error
{
  "message": "Internal server error"
}

Get airline from flight number

curl -X POST "http://localhost:3000/v1/flights/airline" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"search": "6E9920"}'
POST
/v1/flights/airline
Get airline with search query. This doesn’t check if the number is correct.

Request body

The search query, like flight number with airline codeExample: 6E9920

Response

id
string
Airline ID
name
string
Airline name
icao
string
ICAO code
iata
string
IATA code
image
string
Airline logo image URL

Response example

{
  "id": "airline_123",
  "name": "IndiGo",
  "icao": "IGO",
  "iata": "6E",
  "image": "https://cdn.aero.com/airlines/6E.png"
}

Error responses

404
object
Airline not found
{
  "message": "Airline not found"
}
500
object
Internal server error
{
  "message": "Internal server error"
}

Get all tracked flights

curl -X GET "http://localhost:3000/v1/flights/tracked" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/v1/flights/tracked
Returns a list of all flights that have been tracked in the system, sorted by most recently created. Limited to 50 most recent flights.

Response

success
boolean
Indicates if the request was successful
total
number
Total number of tracked flights
flights
array
Array of flight objects with complete flight information

Response example

{
  "success": true,
  "total": 42,
  "flights": [
    {
      "id": "flight_abc123",
      "flightNo": "AA100",
      "callSign": "AAL100",
      "airline": {
        "name": "American Airlines",
        "iata": "AA",
        "icao": "AAL"
      },
      "departure": {
        "airport": {
          "iata": "LAX",
          "icao": "KLAX",
          "name": "Los Angeles International Airport"
        },
        "scheduledTime": {
          "utc": "2024-03-20T08:00:00Z",
          "local": "2024-03-20T00:00:00-08:00"
        }
      },
      "arrival": {
        "airport": {
          "iata": "JFK",
          "icao": "KJFK",
          "name": "John F. Kennedy International Airport"
        },
        "scheduledTime": {
          "utc": "2024-03-20T16:30:00Z",
          "local": "2024-03-20T12:30:00-04:00"
        }
      },
      "date": "2024-03-20T08:00:00Z"
    }
  ]
}

Error responses

401
object
Unauthorized - Invalid or missing JWT token
{
  "message": "Unauthorized"
}
500
object
Internal server error
{
  "message": "Internal server error"
}

Build docs developers (and LLMs) love