Authentication overview

ADS-B Exchange employs API keys as its primary authentication method for programmatic access to its real-time and historical flight data. An API key is a unique, alphanumeric string that identifies the calling application or user and links them to a specific usage plan. This mechanism allows ADS-B Exchange to manage access permissions, enforce rate limits, and provide data according to the user's subscription tier. The API key must be included with each request to the ADS-B Exchange API endpoints to ensure successful authentication and authorization. Without a valid API key, requests will typically result in an authentication failure or error response, preventing data retrieval.

The system distinguishes between different access levels, such as free access for users contributing data via an ADS-B feeder and various paid tiers designed for personal, commercial, or enterprise applications. Each tier is associated with specific API key capabilities, determining factors like query frequency, data volume, and access to advanced historical datasets. Developers are responsible for securing their API keys to prevent unauthorized access and potential misuse of their allocated data quotas, as outlined in the ADS-B Exchange API documentation.

Supported authentication methods

ADS-B Exchange primarily supports API key authentication for its public-facing APIs. This method is common for API providers that need to control access, track usage, and differentiate between various service tiers without requiring complex user interaction for each request. Other methods, such as OAuth 2.0 or mutual TLS, are not typically offered for direct API consumption by end-users or applications through the standard developer portal. API keys are generally suitable for server-to-server communication or applications where the API key can be securely stored and managed.

The following table summarizes the authentication method supported by ADS-B Exchange:

Method When to Use Security Level
API Key Accessing real-time/historical flight data, server-side applications, client-side applications with secure key management. Moderate (depends heavily on key management)

For more complex scenarios involving user delegation or fine-grained permissions across multiple services, alternative authentication protocols like OAuth 2.0 are often employed by other API providers. However, for ADS-B Exchange's specific use case of providing read-only access to flight data, API keys simplify the authentication process for developers while still allowing for usage tracking and access control.

Getting your credentials

To obtain an API key for ADS-B Exchange, you typically need to follow these steps:

  1. Account Creation: Register an account on the official ADS-B Exchange website. This is often the first step to access any developer resources or service tiers.
  2. Subscription Selection: Depending on your intended usage, you will need to select an appropriate data plan. ADS-B Exchange offers various tiers, including free access for personal feeders, and paid subscriptions for personal, commercial, and enterprise use cases, as detailed on their data access page.
  3. API Key Generation: Once you have an active account and a suitable subscription, your API key will generally be accessible within your user dashboard or a dedicated developer section of the website. The exact process for generating or retrieving the key may vary slightly but is typically intuitive.

For users who operate an ADS-B feeder and contribute data to the network, a free API key for personal use may be automatically provided, allowing access to a subset of the API's capabilities. Commercial and enterprise users will need to subscribe to a paid plan to receive API keys with higher rate limits and broader data access. Always refer to the official ADS-B Exchange API documentation for the most current and precise instructions on credential acquisition.

Authenticated request example

When making requests to the ADS-B Exchange API, your API key must be included as a query parameter in the request URL. The specific parameter name is typically apiKey. Below are examples demonstrating how to make an authenticated request using common programming languages.

Python Example

This Python example uses the requests library to query the ADS-B Exchange API for nearby aircraft, including the API key in the URL parameters.


import requests

API_KEY = "YOUR_ADSBE_API_KEY_HERE"  # Replace with your actual API key
BASE_URL = "https://api.adsbexchange.com/v2/" # Example base URL, refer to docs

# Example endpoint: Get all aircraft within a bounding box
# Always refer to the ADS-B Exchange API documentation for current endpoints
endpoint = "lat/40.7128/lon/-74.0060/dist/25/"

headers = {
    "Accept": "application/json"
}

params = {
    "apiKey": API_KEY
}

try:
    response = requests.get(f"{BASE_URL}{endpoint}", headers=headers, params=params)
    response.raise_for_status()  # Raise an HTTPError for bad responses (4xx or 5xx)
    data = response.json()
    print("Successfully retrieved data:")
    # Process data here, e.g., print(data['aircraft_count'])
    print(data)
except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")
except ValueError:
    print("Failed to decode JSON response.")

JavaScript (Node.js with Fetch) Example

This Node.js example uses the native fetch API to perform a similar request, appending the API key to the URL.


const API_KEY = "YOUR_ADSBE_API_KEY_HERE"; // Replace with your actual API key
const BASE_URL = "https://api.adsbexchange.com/v2/"; // Example base URL, refer to docs

// Example endpoint: Get all aircraft within a bounding box
// Always refer to the ADS-B Exchange API documentation for current endpoints
const endpoint = "lat/40.7128/lon/-74.0060/dist/25/";

async function getAircraftData() {
  try {
    const response = await fetch(`${BASE_URL}${endpoint}?apiKey=${API_KEY}`, {
      method: 'GET',
      headers: {
        'Accept': 'application/json'
      }
    });

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

    const data = await response.json();
    console.log("Successfully retrieved data:");
    // Process data here
    console.log(data);
  } catch (error) {
    console.error("An error occurred:", error);
  }
}

getAircraftData();

In both examples, the API_KEY variable holds the credential. It's crucial to substitute "YOUR_ADSBE_API_KEY_HERE" with your actual, valid API key. Always check the ADS-B Exchange API documentation for the most up-to-date endpoints, parameters, and usage guidelines.

Security best practices

Securing your ADS-B Exchange API keys is essential to prevent unauthorized data access, protect your account from misuse, and avoid exceeding your usage limits. Following these best practices enhances the overall security posture of your applications:

  • Do Not Hardcode API Keys: Embedding API keys directly into your source code is a significant security risk. If your code is exposed, your API key can be compromised. Instead, use environment variables, configuration files, or a secrets management service to store and access your keys. For example, in a server environment, you could load the API key from a .env file.
  • Use Environment Variables: For server-side applications, storing API keys as environment variables is a common and recommended practice. This keeps the key separate from your codebase and allows for easy rotation and different keys for different deployment environments (development, staging, production).
  • Restrict Access to API Keys: Limit who has access to your API keys. Only individuals or systems that absolutely require the key should have access to it. Implement strict access controls on any system where API keys are stored.
  • Secure Client-Side Implementations: If you must use an API key in a client-side application (e.g., a web browser or mobile app), be aware that the key can potentially be exposed to end-users. In such cases, consider using a proxy server to make API calls, where the key is securely stored on your server and not directly exposed to the client. This also allows you to implement additional rate limiting and security measures.
  • Regular Key Rotation: Periodically change your API keys. This practice, known as key rotation, reduces the window of opportunity for a compromised key to be exploited. If a key is compromised, rotating it invalidates the old key and forces attackers to find a new one.
  • Monitor Usage: Regularly check your API usage statistics within your ADS-B Exchange account. Unusual spikes in usage could indicate a compromised API key or an application error.
  • Implement Least Privilege: If ADS-B Exchange were to offer different types of API keys with varying permissions (though currently it's a single key model), always use the key with the minimum necessary privileges for a given task. This limits the damage if a key is compromised.
  • Encrypt Stored Keys: If you must store API keys in configuration files or databases, ensure they are encrypted at rest using strong encryption algorithms.
  • Secure Communication: Always use HTTPS for all API requests to ensure that your API key and data are encrypted during transit, preventing eavesdropping. ADS-B Exchange APIs are served over HTTPS by default, aligning with modern TLS best practices.

By adhering to these security guidelines, developers can minimize the risk associated with API key management and ensure the integrity and confidentiality of their interactions with the ADS-B Exchange API.