This API exposes REST services for querying airports and flights, integrated with AviationStack.
Results are stored locally and are accessible even if the external provider fails.
Base URL:
https://aviation-integration-944235041157.us-central1.run.app/
- Swagger UI:
/docs - Flights example:
/api/v1/flights?dep_iata=GUA - Airports example:
/api/v1/airports?search=guatemala
- GET
/api/health - Description: Checks the availability of MySQL, Redis, and Mailer.
- Successful response:
{
"status": "ok",
"timestamp": "2025-06-14T10:20:00.000Z",
"uptime": 1200,
"node_version": "v20.0.0",
"services": {
"mysql": "ok",
"redis": "ok",
"mailer": "ok"
}
}- Possible errors:
500→ One or more services are down.
-
GET
/api/v1/airlines -
Description: List of airlines (persisted locally after the first call).
-
Parameters:
search(string, optional): Text to search by airline name, IATA code, or country.limit(int, optional): Maximum number of results to return (default 20, max 1000).offset(int, optional): Offset for pagination.
-
Usage example:
/api/v1/airlines?search=american&limit=10&offset=0 -
Successful response:
{
"pagination": {
"limit": 10,
"offset": 0,
"count": 1,
"total": 1
},
"data": [
{
"id": 1,
"airline_name": "American Airlines",
"iata_code": "AA",
"icao_code": "AAL",
"callsign": "AMERICAN",
"type": "scheduled",
"status": "active",
"fleet_size": "963",
"fleet_average_age": "10.9",
"date_founded": "1934",
"hub_code": "DFW",
"iata_prefix_accounting": "1",
"country_name": "United States",
"country_iso2": "US"
}
]
}- Errors:
422→ Validation error in parameters
-
GET
/api/v1/airports -
Description: List of airports (stored locally after the first call).
-
Parameters:
search(string, optional): Text to search by name, city, or country.limit(int, optional): Maximum number of results to return (default 20).offset(int, optional): Offset for pagination.
-
Usage example:
/api/v1/airports?search=guatemala&limit=10&offset=0 -
Successful response:
{
"pagination": {
"limit": 10,
"offset": 0,
"count": 1,
"total": 1
},
"data": [
{
"id": 1,
"airport_name": "La Aurora International Airport",
"iata_code": "GUA",
"icao_code": "MGGT",
"latitude": "14.5833",
"longitude": "-90.5275",
"timezone": "America/Guatemala",
"gmt": "-6",
"country_name": "Guatemala",
"country_iso2": "GT",
"city_iata_code": "GUA"
}
]
}-
GET
/api/v1/flights -
Description: List of flights with multiple filters. Data is synchronized with AviationStack at least once per day.
-
Available search parameters (all optional):
dep_iata: Departure airport IATA codearr_iata: Arrival airport IATA codeflight_number: Flight numberflight_date: Flight date (YYYY-MM-DD)flight_status:scheduled|active|landed|cancelled|incident|divertedlimit: number of results (max: 1000)offset: offset for pagination
-
Example:
/api/v1/flights?dep_iata=GUA&flight_status=scheduled&limit=20 -
Response:
{
"pagination": {
"limit": 20,
"offset": 0,
"count": 1,
"total": 1
},
"data": [
{
"id": 1,
"flight_date": "2025-06-15",
"flight_status": "scheduled",
"departure": {
"iata": "GUA",
"airport": "La Aurora International Airport"
// ...
},
"arrival": {
"iata": "MEX",
"airport": "Mexico City Intl"
// ...
},
"airline": {
"iata": "AM",
"name": "Aeromexico"
},
"flight": {
"number": "123",
"iata": "AM123",
"icao": "AMX123"
}
}
]
}| Code | Meaning | Likely cause |
|---|---|---|
| 422 | Unprocessable Entity | One or more parameters are invalid |
| 429 | Too Many Requests | Call limit reached |
| 500 | Internal Server Error | Unexpected error or external service down |
- 422 Example:
{
"error": {
"status": 422,
"message": "Validation error",
"errors": [
{
"msg": "\"dep_iata\" length must be at least 3 characters long",
"path": "dep_iata"
}
]
}
}You can explore and test the API at:
- All data is cached in Redis for 90 seconds to avoid overuse of the provider.
- If the external API is down, data can be served from the local database (fallback).
- Each query is logged in the
api_callstable.