Kamero

Kamero Geo Location API Documentation

Free, open-source API to get user geolocation by IP address. No API key required. Returns city, country, coordinates, and region data instantly.

Introduction

Kamero Geo Location API provides accurate geolocation data for any IP address using Vercel's Edge Network. The API is completely free, requires no authentication, and has no rate limits.

Key Features:
  • No API key required
  • No rate limits
  • Sub-50ms response times globally
  • 100% free and open source
  • CORS enabled for all origins

Quick Start

Get user location with a single HTTP request:

bash
curl https://geo.kamero.ai/api/geo

Base URL

All API requests should be made to:

text
https://geo.kamero.ai

If you're self-hosting, replace with your deployment URL.

API Endpoint

GET/api/geo

Returns geolocation data for the requesting client's IP address. The location is determined by Vercel's Edge Network based on the incoming request headers.

ParameterRequiredDescription
No parameters required

Response Format

The API returns JSON with the following structure:

json
{
  "city": "San Francisco",
  "country": "US",
  "countryRegion": "CA",
  "latitude": "37.7749",
  "longitude": "-122.4194",
  "region": "sfo1"
}

Field Reference

FieldTypeDescription
citystring | undefinedCity name of the visitor
countrystring | undefinedISO 3166-1 alpha-2 country code (e.g., "US", "GB", "IN")
countryRegionstring | undefinedISO 3166-2 region/state code (e.g., "CA" for California)
latitudestring | undefinedLatitude coordinate as string
longitudestring | undefinedLongitude coordinate as string
regionstring | undefinedVercel Edge Network region that served the request
Note: All fields may return undefined if geolocation cannot be determined (e.g., VPN users, private networks, or local development).

JavaScript / TypeScript

Fetch API

javascript
// Get user location
const response = await fetch("https://geo.kamero.ai/api/geo");
const location = await response.json();

console.log(location.city);    // "San Francisco"
console.log(location.country); // "US"

With Error Handling

javascript
async function getUserLocation() {
  try {
    const res = await fetch("https://geo.kamero.ai/api/geo");
    if (!res.ok) throw new Error("Failed to fetch location");
    return await res.json();
  } catch (error) {
    console.error("Geolocation error:", error);
    return null;
  }
}

const location = await getUserLocation();
if (location?.city) {
  console.log(`Welcome from ${location.city}, ${location.country}!`);
}

React Hook

javascript
import { useState, useEffect } from "react";

function useGeolocation() {
  const [location, setLocation] = useState(null);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    fetch("https://geo.kamero.ai/api/geo")
      .then(res => res.json())
      .then(setLocation)
      .finally(() => setLoading(false));
  }, []);

  return { location, loading };
}

// Usage
function MyComponent() {
  const { location, loading } = useGeolocation();
  
  if (loading) return <p>Loading...</p>;
  return <p>Hello from {location?.city}!</p>;
}

Python

python
import requests

response = requests.get("https://geo.kamero.ai/api/geo")
location = response.json()

print(f"City: {location.get('city')}")
print(f"Country: {location.get('country')}")
print(f"Coordinates: {location.get('latitude')}, {location.get('longitude')}")

cURL

bash
# Basic request
curl https://geo.kamero.ai/api/geo

# Pretty print JSON
curl -s https://geo.kamero.ai/api/geo | jq

# With headers
curl -H "Accept: application/json" https://geo.kamero.ai/api/geo

PHP

php
<?php
$response = file_get_contents("https://geo.kamero.ai/api/geo");
$location = json_decode($response, true);

echo "City: " . $location["city"] . "\n";
echo "Country: " . $location["country"] . "\n";
?>

Go

go
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type GeoLocation struct {
    City          string `json:"city"`
    Country       string `json:"country"`
    CountryRegion string `json:"countryRegion"`
    Latitude      string `json:"latitude"`
    Longitude     string `json:"longitude"`
    Region        string `json:"region"`
}

func main() {
    resp, _ := http.Get("https://geo.kamero.ai/api/geo")
    defer resp.Body.Close()

    var location GeoLocation
    json.NewDecoder(resp.Body).Decode(&location)

    fmt.Printf("City: %s, Country: %s\n", location.City, location.Country)
}

Deploy to Vercel (Recommended)

The fastest way to self-host is deploying to Vercel:

One-Click Deploy

Deploy with Vercel →

Manual Deploy

bash
# Clone the repository
git clone https://github.com/kamero-ai/geo-location-api.git
cd geo-location-api

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel deploy --prod

Local Development

bash
# Clone repository
git clone https://github.com/kamero-ai/geo-location-api.git
cd geo-location-api

# Install dependencies (using Bun)
bun install

# Or using npm
npm install

# Start development server
bun run dev
# or
npm run dev
Important: Geolocation headers are only available when deployed to Vercel. During local development, all location fields will return undefined.

Custom Domain Setup

After deploying to Vercel, you can add a custom domain:

  1. Go to your Vercel project dashboard
  2. Navigate to Settings → Domains
  3. Add your custom domain (e.g., geo.yourdomain.com)
  4. Update DNS records as instructed by Vercel

Your API will then be available at https://geo.yourdomain.com/api/geo