Airport API Documentation

Welcome to the official documentation for the Airport API! This API provides detailed information on airports and airlines in India, such as airport codes, locations, types, and airlines operating in India.

Base URL: https://aerokey-api.vercel.app

Author: Abhishek Jain

API Endpoints

1. Get all Airports

Request:

GET /v1/airports

Response:

  {
    "total": 1000,
    "airports": [...],
    "message": "Success",
    "status": 200
  }
      

This endpoint retrieves a list of all airports.

2. Get Airport by Code

Request:

GET /v1/airports/code/: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 Message (if not found):

  {
    "message": "Airport not found",
    "status": 404
  }
      

This endpoint allows you to retrieve information for a specific airport by its airport code.

3. Get Airport by 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 Message (if not found):

  {
    "message": "Airport not found",
    "status": 404
  }
      

This endpoint allows you to retrieve information for a specific airport by its name.

4. Get Airport by City

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 Message (if not found):

  {
    "message": "Airport not found",
    "status": 404
  }
      

This endpoint allows you to retrieve information for a specific airport by its city.

5. Get Airports by 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 Message (if no airports found):

  {
    "message": "No airports found in this state",
    "status": 404
  }
      

This endpoint allows you to retrieve airports in a specific state.

6. Get Airport by 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 Message (if not found):

  {
    "message": "Airport not found",
    "status": 404
  }
      

This endpoint allows you to retrieve information for a specific airport by its pincode.

7. Get Airports by 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 Message (if no airports found):

  {
    "message": "No airports found for this state code",
    "status": 404
  }
      

This endpoint allows you to retrieve airports in a specific state code.

8. Get Airports by Type

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 Message (if no airports found):

  {
    "message": "No airports found",
    "status": 404
  }
      

This endpoint allows you to retrieve airports based on their type (e.g., International, Domestic).

Airline Endpoints

1. Get all Airlines

Request:

GET /v1/airlines

Response:

  {
    "airlines": [...]
  }
      

This endpoint retrieves a list of all airlines.

2. Get Airline by IATA Code

Request:

GET /v1/airlines/code/:iata

Response:

  {
    "iata_code": "AI",
    "airline_name": "Air India",
    "message": "Success",
    "status": 200
  }
      

Error Message (if not found):

  {
    "message": "Airline not found",
    "status": 404
  }
      

This endpoint allows you to retrieve an airline's information by its IATA code.

3. Get Airline by Name

Request:

GET /v1/airlines/name/:name

Response:

  {
    "iata_code": "AI",
    "airline_name": "Air India",
    "message": "Success",
    "status": 200
  }
      

Error Message (if not found):

  {
    "message": "Airline not found",
    "status": 404
  }
      

This endpoint allows you to retrieve an airline's information by its name.