Authentication overview
Geokeo utilizes a straightforward API key authentication system to control access to its geocoding, reverse geocoding, and IP geolocation APIs. This method is common for web services requiring simple yet effective client verification without the complexities of multi-factor authentication or OAuth flows. Each request sent to the Geokeo API must include a valid API key, which identifies the calling application and authorizes its access based on the associated subscription plan and usage limits.
The API key functions as a unique identifier and secret token. When a client sends a request, the Geokeo server validates this key against its records. Successful validation grants access to the requested API endpoint and records the usage against the client's account. This system supports Geokeo's free tier of 2,500 requests per day and its tiered pricing model, ensuring that usage is accurately tracked and billed according to the Geokeo pricing summary.
Developers are responsible for securely managing their API keys to prevent unauthorized access and potential misuse, which could lead to exceeding rate limits or incurring unexpected charges. The simplicity of API key authentication makes it suitable for many applications, particularly those where server-side requests are dominant and where the API key can be stored securely away from client-side exposure. For more complex scenarios, alternative authentication methods like OAuth 2.0 offer delegated authorization, but Geokeo's current model prioritizes ease of integration for its core services.
Supported authentication methods
Geokeo exclusively supports API key authentication. This method involves including a unique string, your API key, in every request to the Geokeo API. There are no alternative authentication mechanisms such as OAuth 2.0, JWT (JSON Web Tokens), or mutual TLS (mTLS) for accessing Geokeo's services. The API key serves as both the identification and authentication credential for your application.
The API key is typically passed as a query parameter in the request URL. This approach is widely adopted for its simplicity and ease of implementation across various programming languages and environments. While convenient, it necessitates careful management to prevent exposure, especially in client-side applications or publicly accessible code repositories.
Geokeo's system is designed around this single authentication method to streamline access for developers focusing on geocoding and IP geolocation tasks. This focus allows for consistent integration patterns and reduces the learning curve associated with more complex authentication protocols. The Geokeo API documentation provides specific examples of how to include the API key in requests.
| Method | When to Use | Security Level |
|---|---|---|
| API Key (Query Parameter) | Server-side applications, scripts, testing, internal tools. | Moderate (requires secure storage and HTTPS transmission) |
Getting your credentials
To obtain your Geokeo API key, you must first register for an account on the Geokeo website. The process typically involves creating a user account, which then grants access to a personal dashboard where your unique API key is generated and displayed. Follow these general steps:
- Visit the Geokeo Website: Navigate to the Geokeo homepage.
- Sign Up/Log In: Create a new account if you don't have one, or log in to your existing account. This usually involves providing an email address and setting a password.
- Access Dashboard: Upon successful login, you will be directed to your Geokeo user dashboard.
- Locate API Key: Within the dashboard, there will typically be a section or tab specifically dedicated to API keys or API access. Your unique API key will be displayed there.
- Copy Key: Copy the displayed API key. This is the credential you will use in all your API requests.
It is important to note that Geokeo provides a free tier allowing up to 2,500 requests per day, which you can access immediately after obtaining your API key. Should you need higher request volumes, you can upgrade your plan directly from your dashboard. The API key remains the same regardless of your subscription tier, but your daily request limit will increase according to your chosen plan.
For detailed, step-by-step instructions on account creation and API key retrieval, always refer to the official Geokeo documentation, as user interface elements may change over time. It is recommended to treat your API key as a sensitive piece of information, similar to a password.
Authenticated request example
Authenticating a request to the Geokeo API involves appending your API key as a query parameter in the request URL. The parameter name for the API key is typically apikey or api_key, as specified in the service's documentation. The following examples demonstrate how to make an authenticated request using common programming languages. For these examples, replace YOUR_API_KEY with your actual Geokeo API key.
cURL Example
cURL is a command-line tool and library for transferring data with URLs, often used for testing API endpoints.
curl "https://api.geokeo.com/v1/geocode/q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&apikey=YOUR_API_KEY"
Python Example
Using the requests library in Python, you can easily construct and send authenticated GET requests.
import requests
api_key = "YOUR_API_KEY"
address = "1600 Amphitheatre Parkway, Mountain View, CA"
url = f"https://api.geokeo.com/v1/geocode/q={address}&apikey={api_key}"
response = requests.get(url)
if response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code} - {response.text}")
JavaScript (Fetch API) Example
For client-side or Node.js applications, the Fetch API provides a modern way to make network requests.
const apiKey = "YOUR_API_KEY";
const address = "1600 Amphitheatre Parkway, Mountain View, CA";
const url = `https://api.geokeo.com/v1/geocode/q=${encodeURIComponent(address)}&apikey=${apiKey}`;
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error fetching geocoding data:', error);
});
PHP Example
PHP applications can use file_get_contents or the cURL extension for making HTTP requests.
<?php
$apiKey = "YOUR_API_KEY";
$address = "1600 Amphitheatre Parkway, Mountain View, CA";
$url = "https://api.geokeo.com/v1/geocode/q=" . urlencode($address) . "&apikey=" . $apiKey;
$response = @file_get_contents($url);
if ($response === FALSE) {
echo "Error fetching geocoding data.";
} else {
$data = json_decode($response, true);
print_r($data);
}
?>
These examples demonstrate the fundamental pattern of including the API key directly in the URL as a query parameter. Always ensure that the API endpoint and parameter names match those specified in the official Geokeo API documentation.
Security best practices
Securing your Geokeo API key is crucial to prevent unauthorized usage, protect your account from exceeding rate limits, and avoid unexpected charges. While API key authentication is simple, its security heavily relies on proper key management. Adhering to these best practices can mitigate common security risks:
- Never Expose Keys in Client-Side Code: Directly embedding API keys in client-side JavaScript, mobile apps, or any publicly accessible code makes them vulnerable to extraction. Attackers can easily view your key and use it for their own purposes. Always make API calls from your server-side code where the key can be securely stored.
-
Use Environment Variables: Store your API key as an environment variable on your server or in your development environment. This keeps the key out of your codebase and configuration files, making it harder for unauthorized parties to discover. For instance, in Node.js, you might access it via
process.env.GEOKEO_API_KEY. - Restrict API Key Usage (if available): Some API services offer features to restrict API keys by IP address or HTTP referrer. While Geokeo's documentation does not explicitly detail such restrictions for its API keys, it's a general best practice for API key management. If Geokeo were to implement such features, configuring these restrictions would add a significant layer of security, ensuring that even if a key is compromised, it can only be used from authorized locations or domains. As noted by Google Maps Platform API key best practices, limiting key usage is a fundamental security measure.
- Transmit Over HTTPS Only: Always ensure that all API requests to Geokeo are made over HTTPS (HTTP Secure). HTTPS encrypts the communication channel between your application and the Geokeo server, preventing your API key from being intercepted by eavesdropping attacks during transmission. Geokeo's API endpoints are designed to be accessed via HTTPS, reinforcing this security measure.
- Rotate API Keys Periodically: Regularly generating a new API key and revoking the old one (key rotation) reduces the window of opportunity for a compromised key to be exploited. While Geokeo's dashboard might not offer automated rotation, you can manually generate a new key and update your applications.
- Monitor Usage and Set Alerts: Regularly review your API usage statistics in the Geokeo dashboard. Set up alerts for unusual spikes in usage that could indicate a compromised key or an application error. Rapid detection allows for quick action, such as revoking the key.
- Implement Rate Limiting on Your Side: Beyond Geokeo's own rate limits, implement application-level rate limiting to control how frequently your application calls the API. This can help prevent a loop or error in your code from inadvertently consuming your entire quota or triggering excessive charges.
- Keep Development/Test Keys Separate: Use distinct API keys for development, testing, and production environments. This ensures that a compromise of a non-production key does not affect your live application and allows for easier revocation without impacting production services.
By diligently applying these security practices, developers can significantly enhance the protection of their Geokeo API keys and ensure the integrity and continuity of their geocoding services. Always consult the official Geokeo documentation for any platform-specific security recommendations or features.