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 all flights between two airports for a specific date
Query parameters
Departure airport IATA codeExample: LAX
Arrival airport IATA codeExample: JFK
Flight date in ISO formatExample: 2024-03-20
Response
Indicates if the request was successful
The date for which flights were searched
Total number of flights found
Array of flight objects
Flight number information
Arrival information (same structure as departure)
Flight status: scheduled, active, landed, cancelled, incident, diverted, or unknown
Flight type: arrival or departure
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
Unauthorized - Invalid or missing JWT token{
"message": "Unauthorized"
}
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"}'
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
Response example
{
"id": "airline_123",
"name": "IndiGo",
"icao": "IGO",
"iata": "6E",
"image": "https://cdn.aero.com/airlines/6E.png"
}
Error responses
Airline not found{
"message": "Airline not found"
}
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"
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
Indicates if the request was successful
Total number of tracked flights
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
Unauthorized - Invalid or missing JWT token{
"message": "Unauthorized"
}
Internal server error{
"message": "Internal server error"
}