Authentication overview
DomainDb Info employs API key authentication to manage access to its suite of domain data APIs, including the Domain Search API, WHOIS API, and Domain Availability API. This method requires developers to obtain a unique, secret key from their DomainDb Info account dashboard. This API key serves as the primary credential for identifying and authorizing requests made to the API endpoints. By including the API key in each request, users confirm their identity and grant the API server permission to process their query and return the requested domain information.
The use of API keys is a common practice for web services due to its simplicity and ease of implementation for both developers and API providers. However, it necessitates careful handling and robust security practices to prevent unauthorized access. DomainDb Info's API documentation provides specific instructions on how to incorporate the API key into requests, ensuring secure and functional integration across various programming languages and environments.
Supported authentication methods
DomainDb Info primarily supports API key authentication. This method involves transmitting a unique string (the API key) with each request to the API. While other authentication mechanisms exist, such as OAuth 2.0 or mutual TLS, DomainDb Info's infrastructure is designed around the simplicity and effectiveness of API keys for its domain data services.
API keys are suitable for server-to-server communication or applications where the API key can be securely stored and managed without direct exposure to end-users. This approach is effective for DomainDb Info's use cases, which often involve backend systems performing automated domain lookups or data enrichment processes.
The following table summarizes the key aspects of DomainDb Info's supported authentication method:
| Method | When to Use | Security Level | Description |
|---|---|---|---|
| API Key | Server-side applications, internal tools, scripts, or where keys can be securely stored. | Moderate | A secret token passed typically as a query parameter. Identifies the calling application/user. Requires careful handling to prevent exposure. |
Getting your credentials
Accessing the DomainDb Info API requires an API key, which you can obtain directly from your account dashboard. Follow these steps to generate and retrieve your API key:
- Create an Account: Navigate to the DomainDb Info homepage and sign up for a new account if you do not already have one. This typically involves providing an email address and creating a password.
- Log In: Once your account is created, log in to your DomainDb Info dashboard.
- Navigate to API Settings: Within your dashboard, locate the section related to API access or developer settings. This is usually labeled "API Key," "Developer Settings," or similar.
- Generate API Key: If an API key is not automatically provided, there will be an option to generate a new key. Click this button to create your unique API key. Some platforms allow you to create multiple keys for different applications or revoke existing ones.
- Copy Your API Key: Once generated, your API key will be displayed. Copy this key immediately and store it in a secure location. It is crucial to treat your API key as a sensitive credential, similar to a password. Do not embed it directly into client-side code or publicly accessible repositories.
According to DomainDb Info's API documentation, your API key grants you access to your allocated lookup quota, which includes a free tier of 200 lookups per day. Paid plans offer increased lookup volumes, starting at $15/month for 20,000 lookups.
Authenticated request example
To make an authenticated request to the DomainDb Info API, you must include your API key as a query parameter in the request URL. The specific parameter name is typically api_key. Here's how you might structure a request using various programming languages:
Python
import requests
API_KEY = "YOUR_API_KEY"
DOMAIN = "example.com"
url = f"https://api.domaindb.info/v1/info/{DOMAIN}?api_key={API_KEY}"
response = requests.get(url)
if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code} - {response.text}")
Node.js
const fetch = require('node-fetch'); // or use axios, https built-in module
const API_KEY = "YOUR_API_KEY";
const DOMAIN = "example.com";
const url = `https://api.domaindb.info/v1/info/${DOMAIN}?api_key=${API_KEY}`;
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
PHP
<?php
$apiKey = "YOUR_API_KEY";
$domain = "example.com";
$url = "https://api.domaindb.info/v1/info/" . urlencode($domain) . "?api_key=" . urlencode($apiKey);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
$data = json_decode($response, true);
print_r($data);
}
curl_close($ch);
?>
These examples demonstrate how to construct a GET request for domain information, embedding the API key directly in the URL query string. Always replace "YOUR_API_KEY" with your actual API key obtained from your DomainDb Info account.
Security best practices
Securing your API key is critical to preventing unauthorized access to your DomainDb Info account and potential misuse of your lookup quota. Adhere to these best practices:
- Keep API Keys Confidential: Treat your API key as a password. Never embed it directly into client-side code (e.g., JavaScript in a browser) or include it in publicly accessible source code repositories (e.g., GitHub without proper environment variable usage).
- Use Environment Variables: For server-side applications, store API keys as environment variables rather than hardcoding them into your application's source code. This practice separates sensitive credentials from your codebase, making it easier to manage and less prone to accidental exposure. For example, in Node.js, you might use
process.env.DOMAINDB_API_KEY. - Restrict IP Addresses (If Available): If DomainDb Info offers IP address whitelisting, configure your API key to only accept requests originating from a specific set of trusted IP addresses. This adds an extra layer of security, as even if your key is compromised, it cannot be used from an unauthorized location. Consult the DomainDb Info API documentation to see if this feature is supported.
- Use HTTPS: Always ensure that all API requests are made over HTTPS. This encrypts the communication between your application and the DomainDb Info servers, protecting your API key and other data from interception by eavesdroppers during transit. The Mozilla Developer Network's guide on secure contexts emphasizes the importance of HTTPS for web security.
- Monitor API Key Usage: Regularly review your API usage statistics in the DomainDb Info dashboard. Unusual spikes in usage or requests from unexpected locations could indicate a compromised key.
- Rotate API Keys: Periodically generate a new API key and replace the old one in your applications. This practice, known as key rotation, reduces the window of opportunity for a compromised key to be exploited.
- Implement Rate Limiting and Error Handling: While DomainDb Info implements its own rate limits, your application should also include robust error handling and potentially client-side rate limiting to manage your usage effectively and respond gracefully to API errors, which could sometimes indicate authentication issues.
- Secure Your Development Environment: Ensure that your development machines and build systems are secure. Malicious software or improper access controls on these systems could expose your API keys.
By adhering to these security measures, you can significantly reduce the risk of unauthorized access to your DomainDb Info account and maintain the integrity of your application's interaction with the API.