Getting started overview

Integrating with Geokeo involves a sequence of steps designed to enable quick access to its geospatial APIs. The core process includes account creation, API key retrieval, and the execution of an authenticated request. Geokeo provides APIs for converting addresses into geographical coordinates (geocoding), converting coordinates into human-readable addresses (reverse geocoding), and identifying a geographical location from an IP address.

The service offers a free tier of 2,500 requests per day, which allows developers to test and implement the API without initial financial commitment. This guide outlines the foundational steps to make a successful API call, focusing on a basic geocoding request as an example. Access to the API is managed through a unique API key obtained after registration.

While this guide focuses on immediate setup, further details on request parameters, response formats, and advanced features are available in the official Geokeo documentation.

Create an account and get keys

To access the Geokeo API, a developer account is required. This account provides the necessary API key for authentication, which must be included with every API request. Follow these steps to set up your account and retrieve your API key:

  1. Navigate to the Geokeo Homepage: Open your web browser and go to the Geokeo homepage.

  2. Register for an Account: Look for a "Sign Up" or "Register" button, typically located in the top right corner of the page. Click it to initiate the registration process.

  3. Provide Registration Details: You will be prompted to enter an email address and create a password. Complete the required fields and agree to any terms of service or privacy policies.

  4. Verify Email (If Required): Some registration processes include an email verification step. Check your inbox for a verification email from Geokeo and follow the instructions to confirm your account.

  5. Log In to Your Dashboard: Once registered and potentially verified, log in to your Geokeo account using your newly created credentials.

  6. Locate Your API Key: In your Geokeo user dashboard, there will typically be a section dedicated to API Keys or Credentials. Your unique API key should be displayed there. Copy this key, as it will be used to authenticate your API requests.

It is recommended to store your API key securely and avoid hardcoding it directly into client-side applications or public repositories. For server-side applications, use environment variables or a configuration management system.

Your first request

After obtaining your API key, you can make your first geocoding request. The examples below demonstrate how to perform a basic address geocoding lookup using cURL, Python, and JavaScript. Replace YOUR_API_KEY with your actual Geokeo API key.

Geocoding API Endpoint

The primary endpoint for geocoding an address is:

https://geokeo.com/api/v1/geocode

This endpoint requires query parameters for the address and your API key.

Example 1: cURL

A cURL request can be executed directly from your terminal. This example geocodes the address "1600 Amphitheatre Parkway, Mountain View, CA".

curl -X GET "https://geokeo.com/api/v1/geocode?q=1600%20Amphitheatre%20Parkway,%20Mountain%20View,%20CA&api_key=YOUR_API_KEY"

Example 2: Python

This Python example uses the requests library to make an HTTP GET request. Ensure you have the requests library installed (pip install requests).

import requests

api_key = "YOUR_API_KEY"
address = "1600 Amphitheatre Parkway, Mountain View, CA"

url = f"https://geokeo.com/api/v1/geocode?q={address}&api_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(data)
except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")

Example 3: JavaScript (Node.js with node-fetch)

This JavaScript example uses the node-fetch library for Node.js environments. Install it via npm (npm install node-fetch@2 for common usage, or npm install node-fetch for modern Node.js versions and ES modules).

const fetch = require('node-fetch'); // Use 'node-fetch' for Node.js, 'fetch' is native in browsers

const apiKey = "YOUR_API_KEY";
const address = "1600 Amphitheatre Parkway, Mountain View, CA";

async function geocodeAddress() {
    const url = `https://geokeo.com/api/v1/geocode?q=${encodeURIComponent(address)}&api_key=${apiKey}`;
    try {
        const response = await fetch(url);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        const data = await response.json();
        console.log(data);
    } catch (error) {
        console.error("Error during geocoding:", error);
    }
}

geocodeAddress();

Expected Response Format

A successful geocoding request will return a JSON object containing location data. The structure typically includes coordinates, formatted address information, and other relevant details, such as address components and confidence scores. For example, a successful response might look like this (abbreviated):

{
  "status": "ok",
  "results": [
    {
      "formatted_address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
      "geometry": {
        "lat": 37.4223877,
        "lng": -122.0843669
      },
      "address_components": [...],
      "confidence": 0.9
    }
  ]
}

Refer to the Geokeo API documentation for a complete description of the response fields.

Common next steps

After successfully making your first request, consider these common next steps to further integrate Geokeo into your applications:

  1. Explore Other API Endpoints: Geokeo offers reverse geocoding and IP geolocation APIs. Experiment with these to understand their functionality and response structures.

    • Reverse Geocoding: Convert latitude/longitude coordinates back into a human-readable address. (e.g., https://geokeo.com/api/v1/reverse?lat={latitude}&lng={longitude}&api_key=YOUR_API_KEY)
    • IP Geolocation: Determine the geographical location based on an IP address. (e.g., https://geokeo.com/api/v1/ip?ip={ip_address}&api_key=YOUR_API_KEY)
  2. Implement Error Handling: Build robust error handling into your application to manage various HTTP status codes (e.g., 400 for bad request, 401 for unauthorized, 429 for rate limiting, 500 for server errors) and API-specific error messages. This ensures a stable user experience even when API calls fail.

  3. Manage API Key Security: Never expose your API key in client-side code or public repositories. For web applications, route API calls through a secure backend server. For mobile applications, consider using a proxy server or secure key storage mechanisms. For further security best practices, consult resources like the Google Maps Platform API key security FAQ which provides general guidance applicable to many API services.

  4. Monitor Usage and Billing: Regularly check your Geokeo dashboard to monitor your API usage against the free tier limits and any paid plan you may have. Set up alerts if available to prevent unexpected overages.

  5. Optimize Requests: For performance and cost efficiency, consider implementing caching for frequently requested addresses. Avoid redundant calls for the same data within a short period.

  6. Review Rate Limits: Be aware of the Geokeo API rate limits to prevent your application from being temporarily blocked. Implement exponential backoff or a queueing mechanism for retries if your application is likely to exceed these limits.

Troubleshooting the first call

If your initial Geokeo API call encounters issues, review the following common problems and solutions:

Step What to do Where
Verify API Key Ensure your api_key parameter exactly matches the key from your Geokeo dashboard. Check for typos or leading/trailing spaces. Geokeo Dashboard & your API request code
Check URL Encoding Confirm that your query parameters, especially the address string (q), are properly URL-encoded. Spaces and special characters must be encoded (e.g., %20 for space). Your API request code
Review Endpoint URL Verify that the base URL for the API endpoint (e.g., https://geokeo.com/api/v1/geocode) is correct and free of typos. Geokeo Documentation & your API request code
Inspect Response Status Code Examine the HTTP status code returned by the API. HTTP response from API call
Read Error Message If the API returns a JSON error message, read its content. This message often provides specific details about what went wrong. JSON response body from API call
Internet Connectivity Ensure your development environment has an active and stable internet connection. Your local machine/server
Rate Limits If you are making many requests quickly, you might hit rate limits. Wait a few minutes and try again. Geokeo Dashboard & Geokeo Documentation

Common HTTP status codes to look for include:

  • 400 Bad Request: Indicates issues with your request parameters (e.g., missing q parameter, malformed URL).
  • 401 Unauthorized: Often means an invalid or missing API key.
  • 403 Forbidden: Could indicate an issue with API key permissions or an invalid domain/IP if restrictions are configured.
  • 429 Too Many Requests: You have exceeded the API rate limit for your account.
  • 500 Internal Server Error: A problem on the Geokeo server side. If this persists, contact Geokeo support.

Consult the Geokeo documentation for a comprehensive list of error codes and their meanings.