Getting started overview
Integrating with the DomainDb Info API requires obtaining an API key and then using it to authenticate your requests. The platform supports common HTTP methods for interacting with its endpoints, providing domain-related data such as WHOIS information, registration details, and availability status. This guide outlines the steps for account creation, API key retrieval, and executing your initial API call.
DomainDb Info offers SDKs for multiple programming languages including Python, PHP, and Node.js, which can streamline the integration process. For direct API interaction, requests are typically made to a base URL with your API key included as a query parameter or header, depending on the specific endpoint's requirements. Response formats are usually JSON, consistent with common web API practices as described by the W3C JSON Data Interchange standards.
Here’s a quick reference for the setup process:
| Step | What to do | Where |
|---|---|---|
| 1. Sign Up | Create a new DomainDb Info account. | DomainDb Info homepage |
| 2. Get API Key | Locate your unique API key in your account dashboard. | Account settings or API dashboard |
| 3. Choose Integration Method | Decide between an SDK or direct HTTP request. | Developer's preferred language/environment |
| 4. Make First Request | Execute a simple domain lookup query. | Code editor/terminal |
| 5. Parse Response | Process the JSON response from the API. | Code editor |
Create an account and get keys
To begin using the DomainDb Info API, you must first create an account. This process typically involves providing an email address and setting a password. Upon successful registration, you will gain access to a personal dashboard where your API key is generated and managed.
- Navigate to the DomainDb Info website: Go to the DomainDb Info homepage.
- Sign up for a new account: Look for a "Sign Up" or "Get API Key" button and follow the registration prompts. This usually involves entering your email and creating a password.
- Verify your email (if prompted): Some services require email verification to activate your account. Check your inbox for a confirmation link.
- Access your API Key: Once logged in, navigate to your account dashboard, API settings, or a similar section. Your unique API key will be displayed there. It is crucial to keep this key secure, as it authenticates your requests and grants access to your allocated lookup limits.
- Understand usage limits: The free tier provides 200 lookups per day. Review the DomainDb Info pricing page for details on paid plans if higher volumes are needed, starting at $15/month for 20,000 lookups.
This API key is a string that identifies your application and is required for every API call. It's an example of an API token, a common authentication method as discussed in RFC 6750 for Bearer Token Usage.
Your first request
After obtaining your API key, you can make your first request to test the integration. This example demonstrates a basic domain lookup using the WHOIS API endpoint for example.com. The API key is typically passed as a query parameter named key or api_key.
API Endpoint: https://api.domaindb.info/v1/whois
Example Request Parameters:
domain: The domain name to look up (e.g.,example.com)key: Your API key
Example using cURL
This cURL command demonstrates how to query the WHOIS information for a domain. Replace YOUR_API_KEY with your actual API key.
curl -X GET "https://api.domaindb.info/v1/whois?domain=example.com&key=YOUR_API_KEY"
Example using Python
The following Python code snippet uses the requests library to perform the same WHOIS lookup. Ensure you have requests installed (pip install requests).
import requests
import json
API_KEY = "YOUR_API_KEY" # Replace with your actual API key
DOMAIN = "example.com"
url = f"https://api.domaindb.info/v1/whois?domain={DOMAIN}&key={API_KEY}"
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
data = response.json()
print(json.dumps(data, indent=2))
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
Example using Node.js
This Node.js example uses the built-in https module for a GET request.
const https = require('https');
const API_KEY = "YOUR_API_KEY"; // Replace with your actual API key
const DOMAIN = "example.com";
const options = {
hostname: 'api.domaindb.info',
port: 443,
path: `/v1/whois?domain=${DOMAIN}&key=${API_KEY}`,
method: 'GET'
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const jsonResponse = JSON.parse(data);
console.log(JSON.stringify(jsonResponse, null, 2));
} catch (e) {
console.error('Failed to parse JSON response:', e);
}
});
});
req.on('error', (e) => {
console.error(`Request error: ${e.message}`);
});
req.end();
A successful response will typically return a JSON object containing WHOIS data for the requested domain. This data can include registration dates, nameservers, registrant contact information (subject to GDPR and other privacy regulations), and more, as detailed in the DomainDb Info API reference documentation.
Common next steps
Once you have successfully made your first API call, consider these next steps to further integrate DomainDb Info into your application:
- Explore other endpoints: Beyond WHOIS, investigate the Domain Search API for broader queries or the Domain Availability API for checking if a domain is registered or free. Each API's functionality is detailed in the official DomainDb Info API documentation.
- Implement error handling: Integrate robust error handling into your code to gracefully manage API rate limits, invalid requests, or network issues. The API typically returns HTTP status codes (e.g., 400 for bad request, 403 for forbidden, 429 for rate limit exceeded) and descriptive error messages in JSON format.
- Manage API keys securely: Avoid hardcoding API keys directly into your source code. Instead, use environment variables, configuration files, or a secrets management service to store and retrieve your API key securely. This practice is a best practice for securing API keys.
- Monitor usage: Regularly check your API usage against your daily or monthly limits to avoid unexpected interruptions. Your DomainDb Info dashboard provides usage statistics.
- Utilize SDKs: If you are working in one of the supported languages (Python, PHP, Ruby, Node.js, Go, Java), consider using the provided SDKs to simplify API interaction, as they often handle authentication, request formatting, and response parsing automatically.
- Bulk lookups: For applications requiring checks on multiple domains, explore the bulk lookup features to optimize your requests and adhere to rate limits efficiently.
- Custom fields: DomainDb Info allows requesting custom fields in responses, which can help tailor the data you receive to your specific application needs and reduce payload size.
Troubleshooting the first call
Encountering issues during your initial API call is common. Here are some troubleshooting steps:
- Check your API Key: Ensure your API key is correctly copied and pasted into your request. An incorrect key will result in authentication errors (often HTTP 403 Forbidden). Double-check for extra spaces or missing characters.
- Verify the Endpoint URL: Confirm that the base URL and endpoint path are accurate. Even a small typo can lead to a 404 Not Found error. Refer to the DomainDb Info API documentation for exact endpoint paths.
- Inspect Request Parameters: Make sure all required parameters, like
domain, are included and correctly formatted. Missing or malformed parameters can cause 400 Bad Request errors. - Review HTTP Status Codes: The API will return standard HTTP status codes.
200 OK: Success.400 Bad Request: Your request was malformed or missing required parameters. Review your request body and parameters.401 Unauthorized: Missing or invalid API key.403 Forbidden: Your API key does not have permission for the requested action, or your daily limit has been reached.404 Not Found: The requested endpoint or resource was not found.429 Too Many Requests: You have exceeded your rate limit. Wait before making further requests.5xx Server Error: An issue on the DomainDb Info server side.- Examine the Response Body: For non-200 responses, the API often includes a JSON error message in the response body that provides specific details about what went wrong. Parse this message to understand the error.
- Check Network Connectivity: Ensure your development environment has internet access and no firewall rules are blocking outgoing requests to
api.domaindb.info. - Consult Documentation: The DomainDb Info API reference provides detailed information on all endpoints, required parameters, and expected responses, including error formats.
- Contact Support: If you've exhausted other options, reach out to DomainDb Info's support team for assistance.