Get API Key

Welcome to the API key generation guide. This section will walk you through the process of generating an API key for our service. Please follow the instructions carefully to ensure a smooth experience.

How to Generate Your API Key:

After successfully registering, follow these steps to generate your API key:

  1. Sign up at OpenAPI Box by completing the registration process.
  2. Once registered, log in and go to the API Services section of your dashboard.
  3. Search for Airports API in the available services.
  4. Select the API that corresponds to your service.
  5. Look for the Generate API Key option and click it.
  6. A confirmation modal will appear. Confirm your action to proceed.
  7. Once confirmed, you will see the API key generated for your account.
  8. Click the Show API Key button to reveal your API key.
  9. Click the Copy button next to the key to copy it to your clipboard.

Airports API

Get access to detailed information about airports worldwide, including location data, IATA and ICAO codes, and much more. This API is perfect for travel applications, airport-related services, and flight data integration.

Endpoints

POST /GET https://openapibox.com/api/airportsapi/YOUR-API-KEY/getInfo

Parameters
Field Name Description Required Example Values
ident Unique identifier for the airport or aircraft No (Optional) VGZR
name The name of the airport or aircraft No (Optional) Hazrat Shahjalal International Airport
type The type of the airport or facility No (Optional) large_airport, small_airport, medium_airport
continent The continent where the airport is located No (Optional) NA (North America)
iso_country The ISO country code for the airport No (Optional) BD
gps_code The GPS code of the airport No (Optional) VGHS
iata_code The IATA code of the airport No (Optional) DAC
scheduled_service Indicates if scheduled service is available No (Optional) yes / no
local_code The local code of the airport No (Optional) NYC
filter An array of fields to filter the query results No (Optional) filter[]=name filter[]=type
Demo Code Examples
                                 
https://openapibox.com/api/airportsapi/YOUR-API-KEY/getInfo?iso_country=BD&name=Hazrat&ident=VGZR&type=large_airport&continent=AS&gps_code=VGHS&iata_code=DAC&scheduled_service=yes&local_code=&filter[]=id&filter[]=ident&filter[]=name&filter[]=type&filter[]=latitude_deg&filter[]=longitude_deg

                                 
<?php

$endpoint = 'https://openapibox.com/api/airportsapi/YOUR-API-KEY/get';

// Optional parameters (you can modify these as needed)
$params = [
    'ident' => 'VGZR', // Optional: Airport identifier (e.g., 'VGZR')
    'name' => 'Hazrat Shahjalal International Airport', // Optional: Name of the airport
    'type' => 'large_airport', // Optional: Type of airport (e.g., 'large_airport')
    'continent' => 'AS', // Optional: Continent (e.g., 'AS' for Asia)
    'iso_country' => 'BD', // Optional: ISO country code (e.g., 'BD' for Bangladesh)
    'gps_code' => 'VGHS', // Optional: GPS code of the airport
    'iata_code' => 'DAC', // Optional: IATA code of the airport
    'scheduled_service' => 'yes', // Optional: Scheduled service availability (e.g., 'yes')
    'local_code' => '', // Optional: Local code of the airport
    'filter[]' => ['id', 'ident', 'name', 'type', 'latitude_deg', 'longitude_deg'], // Optional: Specific fields to include in the response
];

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query($params), // Send the parameters as a POST request
]);

$response = curl_exec($curl);

if ($response === false) {
    echo 'cURL error: ' . curl_error($curl);
} else {
    echo htmlentities($response);  // Display the response from the API
}

curl_close($curl);
?>

<?php


use GuzzleHttp\Client;

$client = new Client();

$endpoint = 'https://openapibox.com/api/airportsapi/YOUR-API-KEY/get';

// Optional parameters
$params = [
    'ident' => 'VGZR', // Optional: Airport identifier (e.g., 'VGZR')
    'name' => 'Hazrat Shahjalal International Airport', // Optional: Name of the airport
    'type' => 'large_airport', // Optional: Type of airport (e.g., 'large_airport')
    'continent' => 'AS', // Optional: Continent (e.g., 'AS' for Asia)
    'iso_country' => 'BD', // Optional: ISO country code (e.g., 'BD' for Bangladesh)
    'gps_code' => 'VGHS', // Optional: GPS code of the airport
    'iata_code' => 'DAC', // Optional: IATA code of the airport
    'scheduled_service' => 'yes', // Optional: Scheduled service availability (e.g., 'yes')
    'local_code' => '', // Optional: Local code of the airport
    'filter' => ['id', 'ident', 'name', 'type', 'latitude_deg', 'longitude_deg'], // Optional: Specific fields to include in the response
];

try {
    $response = $client->post($endpoint, [
        'form_params' => $params,
    ]);

    $statusCode = $response->getStatusCode();
    $body = $response->getBody()->getContents();

    echo "Response Code: $statusCode\n";
    echo "Response Body:\n";
    echo htmlentities($body); // Display the response as escaped HTML content

} catch (\GuzzleHttp\Exception\RequestException $e) {
    echo 'Request failed: ' . $e->getMessage();
    if ($e->hasResponse()) {
        echo "\n" . $e->getResponse()->getBody();
    }
}

?>

// API endpoint
const endpoint = "https://openapibox.com/api/airportsapi/YOUR-API-KEY/get";

// Optional parameters
const params = {
    ident: 'VGZR', // Optional: Airport identifier (e.g., 'VGZR')
    name: 'Hazrat Shahjalal International Airport', // Optional: Name of the airport
    type: 'large_airport', // Optional: Type of airport (e.g., 'large_airport')
    continent: 'AS', // Optional: Continent (e.g., 'AS' for Asia)
    iso_country: 'BD', // Optional: ISO country code (e.g., 'BD' for Bangladesh')
    gps_code: 'VGHS', // Optional: GPS code of the airport
    iata_code: 'DAC', // Optional: IATA code of the airport
    scheduled_service: 'yes', // Optional: Scheduled service availability (e.g., 'yes')
    local_code: '', // Optional: Local code of the airport
    filter: ['id', 'ident', 'name', 'type', 'latitude_deg', 'longitude_deg'], // Optional: Fields to filter
};

// Function to make a POST request to the API
async function fetchAirports() {
    try {
        const response = await fetch(endpoint, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded', // Proper encoding for form data
            },
            body: new URLSearchParams(params), // Serialize parameters for POST
        });

        if (!response.ok) {
            throw new Error(`HTTP error! Status: ${response.status}`);
        }

        const data = await response.json(); // Parse JSON response
        console.log('API Response:', data); // Log the response to the console
    } catch (error) {
        console.error('Error fetching airports:', error.message);
    }
}

// Call the function
fetchAirports();



import requests

# API endpoint
endpoint = "https://openapibox.com/api/airportsapi/YOUR-API-KEY/get"

# Optional parameters
params = {
    'ident': 'VGZR',  # Optional: Airport identifier (e.g., 'VGZR')
    'name': 'Hazrat Shahjalal International Airport',  # Optional: Name of the airport
    'type': 'large_airport',  # Optional: Type of airport (e.g., 'large_airport')
    'continent': 'AS',  # Optional: Continent (e.g., 'AS' for Asia)
    'iso_country': 'BD',  # Optional: ISO country code (e.g., 'BD' for Bangladesh')
    'gps_code': 'VGHS',  # Optional: GPS code of the airport
    'iata_code': 'DAC',  # Optional: IATA code of the airport
    'scheduled_service': 'yes',  # Optional: Scheduled service availability (e.g., 'yes')
    'local_code': '',  # Optional: Local code of the airport
    'filter[]': ['id', 'ident', 'name', 'type', 'latitude_deg', 'longitude_deg'],  # Optional: Fields to filter
}

# Make a POST request to the API
try:
    response = requests.post(endpoint, data=params)

    # Check if the request was successful
    if response.status_code == 200:
        data = response.json()  # Parse JSON response
        print('API Response:', data)  # Print the response
    else:
        print(f'Error: {response.status_code} - {response.text}')
except requests.exceptions.RequestException as e:
    print(f'Error making request: {e}')



package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
)

// Struct to represent the parameters
type Params struct {
	Ident             string   `json:"ident,omitempty"`
	Name              string   `json:"name,omitempty"`
	Type              string   `json:"type,omitempty"`
	Continent         string   `json:"continent,omitempty"`
	IsoCountry        string   `json:"iso_country,omitempty"`
	GpsCode           string   `json:"gps_code,omitempty"`
	IataCode          string   `json:"iata_code,omitempty"`
	ScheduledService  string   `json:"scheduled_service,omitempty"`
	LocalCode         string   `json:"local_code,omitempty"`
	Filter            []string `json:"filter[]"`
}

func main() {
	// Define the API endpoint
	endpoint := "https://openapibox.com/api/airportsapi/YOUR-API-KEY/get"

	// Optional parameters
	params := Params{
		Ident:            "VGZR", // Optional: Airport identifier (e.g., 'VGZR')
		Name:             "Hazrat Shahjalal International Airport", // Optional: Name of the airport
		Type:             "large_airport", // Optional: Type of airport (e.g., 'large_airport')
		Continent:        "AS", // Optional: Continent (e.g., 'AS' for Asia)
		IsoCountry:       "BD", // Optional: ISO country code (e.g., 'BD' for Bangladesh)
		GpsCode:          "VGHS", // Optional: GPS code of the airport
		IataCode:         "DAC", // Optional: IATA code of the airport
		ScheduledService: "yes", // Optional: Scheduled service availability (e.g., 'yes')
		LocalCode:        "", // Optional: Local code of the airport
		Filter:           []string{"id", "ident", "name", "type", "latitude_deg", "longitude_deg"}, // Optional: Fields to filter
	}

	// Convert params to JSON
	data, err := json.Marshal(params)
	if err != nil {
		log.Fatalf("Error marshaling params: %v", err)
	}

	// Create a new POST request with the parameters as JSON
	req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(data))
	if err != nil {
		log.Fatalf("Error creating request: %v", err)
	}

	// Set appropriate headers
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

	// Send the request
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatalf("Error sending request: %v", err)
	}
	defer resp.Body.Close()

	// Check if the request was successful
	if resp.StatusCode != http.StatusOK {
		log.Printf("Error: %v\n", resp.Status)
		body, _ := ioutil.ReadAll(resp.Body)
		log.Printf("Response body: %s", body)
		return
	}

	// Parse the JSON response
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatalf("Error reading response body: %v", err)
	}

	// Print the response
	fmt.Println("API Response:", string(body))
}



Example Responses


[
  {
    "id": 76980,
    "ident": "VGZR",
    "type": "large_airport",
    "name": "Hazrat Shahjalal International Airport",
    "latitude_deg": "23.843347",
    "longitude_deg": "90.397783",
    "elevation_ft": "30",
    "continent": "AS",
    "iso_country": "BD",
    "iso_region": "BD-3",
    "municipality": "Dhaka",
    "scheduled_service": "yes",
    "gps_code": "VGHS",
    "iata_code": "DAC",
    "local_code": "",
    "home_link": "",
    "wikipedia_link": "https://en.wikipedia.org/wiki/Shahjalal_International_Airport",
    "keywords": "VGZR, Zia International Airport, Dacca International Airport, Hazrat Shahjalal International Airport",
    "created_at": "2024-12-31T07:54:19.000000Z",
    "updated_at": "2024-12-31T07:54:19.000000Z"
  }
]



{
  "code": 1002,
  "message": "Invalid API Key"
}

Response Details

Field Name Values
Airport Name Hazrat Shahjalal International Airport
Airport Type Large Airport
Latitude 23.843347
Longitude 90.397783
Elevation (ft) 30
Continent AS
ISO Country BD
ISO Region BD-3
Municipality Dhaka
Scheduled Service Yes
GPS Code VGHS
IATA Code DAC
Local Code Not Available
Wikipedia Link Hazrat Shahjalal International Airport
Keywords VGZR, Zia International Airport, Dacca International Airport, Hazrat Shahjalal International Airport