Welcome to the Airport API! This API provides detailed information on airports and airlines in India, including airport codes, locations, types, airlines operating in India, and more. It allows developers to integrate essential aviation data into their applications, websites, or services.
Abhishek Jain
Portfolio: https://abhishekjainn.vercel.app
All endpoints are accessible via the following base URL:
https://aerokey.vercel.app
The Airport API serves two main categories of data:
- Airports – Data on airports such as their codes, names, locations, types, and associated details.
- Airlines – Information about airlines, including their IATA codes, names, and related data.
The API supports various endpoints to retrieve data based on specific criteria such as airport code, name, city, state, pincode, etc.
Retrieve a list of all airports.
-
Request:
GET /v1/airports
-
Response:
{ "total": 1000, "airports": [...], "message": "Success", "status": 200 }
Retrieve airport details by airport code (IATA or ICAO).
-
Request:
GET /v1/airports/code/:code
Replace
:code
with the airport code. -
Response:
{ "airport_code": "DEL", "airport_name": "Indira Gandhi International Airport", "city_name": "New Delhi", "state_name": "Delhi", "airport_type": "International", "pincode": "110037", "state_code": "DL", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airport not found", "status": 404 }
Retrieve airport details by airport name.
-
Request:
GET /v1/airports/name/:name
-
Response:
{ "airport_code": "DEL", "airport_name": "Indira Gandhi International Airport", "city_name": "New Delhi", "state_name": "Delhi", "airport_type": "International", "pincode": "110037", "state_code": "DL", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airport not found", "status": 404 }
Retrieve airport details by city name.
-
Request:
GET /v1/airports/city/:city
-
Response:
{ "airport_code": "DEL", "airport_name": "Indira Gandhi International Airport", "city_name": "New Delhi", "state_name": "Delhi", "airport_type": "International", "pincode": "110037", "state_code": "DL", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airport not found", "status": 404 }
Retrieve airports in a specific state.
-
Request:
GET /v1/airports/state/:state
-
Response:
[ { "airport_code": "BOM", "airport_name": "Chhatrapati Shivaji Maharaj International Airport", "city_name": "Mumbai", "state_name": "Maharashtra", "airport_type": "International", "pincode": "400099", "state_code": "MH", "message": "Success", "status": 200 } ]
-
Error Response:
{ "message": "No airports found in this state", "status": 404 }
Retrieve airport details based on its pincode.
-
Request:
GET /v1/airports/pincode/:pincode
-
Response:
{ "airport_code": "BLR", "airport_name": "Kempegowda International Airport", "city_name": "Bengaluru", "state_name": "Karnataka", "airport_type": "International", "pincode": "560300", "state_code": "KA", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airport not found", "status": 404 }
Retrieve airports in a specific state based on state code.
-
Request:
GET /v1/airports/statecode/:statecode
-
Response:
[ { "airport_code": "DEL", "airport_name": "Indira Gandhi International Airport", "city_name": "New Delhi", "state_name": "Delhi", "airport_type": "International", "pincode": "110037", "state_code": "DL", "message": "Success", "status": 200 } ]
-
Error Response:
{ "message": "No airports found for this state code", "status": 404 }
Retrieve airports based on type (e.g., International, Domestic).
-
Request:
GET /v1/airports/airporttype/:airporttype
-
Response:
[ { "airport_code": "DEL", "airport_name": "Indira Gandhi International Airport", "city_name": "New Delhi", "state_name": "Delhi", "airport_type": "International", "pincode": "110037", "state_code": "DL", "message": "Success", "status": 200 } ]
-
Error Response:
{ "message": "No airports found", "status": 404 }
Retrieve a list of all airlines.
-
Request:
GET /v1/airlines
-
Response:
{ "airlines": [...] }
Retrieve airline details by its IATA code.
-
Request:
GET /v1/airlines/code/:iata
-
Response:
{ "iata_code": "AI", "airline_name": "Air India", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airline not found", "status": 404 }
Retrieve airline details by its name.
-
Request:
GET /v1/airlines/name/:name
-
Response:
{ "iata_code": "AI", "airline_name": "Air India", "message": "Success", "status": 200 }
-
Error Response:
{ "message": "Airline not found", "status": 404 }
All requests are made via HTTP GET. The request parameters are passed in the URL path or query string.
Responses are returned in JSON format. They include the following fields:
message
: A descriptive message about the request's success or failure.status
: HTTP status code indicating the result of the request.
The API will return appropriate HTTP error codes in case of issues. Common error responses include:
404 Not Found
: The resource (airport or airline) was not found.- `500 Internal
Server Error`: An unexpected server error occurred.
- Node.js (version 12 or above)
- NPM or Yarn
git clone https://github.com/Abhishekkjainn/Aerokey.git
cd Aerokey
npm install
npm start
The API will be available at http://localhost:3000
.
This project is licensed under the MIT License - see the LICENSE file for details.