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.
- 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:
curl https://geo.kamero.ai/api/geoBase URL
All API requests should be made to:
https://geo.kamero.aiIf you're self-hosting, replace with your deployment URL.
API Endpoint
/api/geoReturns geolocation data for the requesting client's IP address. The location is determined by Vercel's Edge Network based on the incoming request headers.
| Parameter | Required | Description |
|---|---|---|
| No parameters required | ||
Response Format
The API returns JSON with the following structure:
{
"city": "San Francisco",
"country": "US",
"countryRegion": "CA",
"latitude": "37.7749",
"longitude": "-122.4194",
"region": "sfo1"
}Field Reference
| Field | Type | Description |
|---|---|---|
city | string | undefined | City name of the visitor |
country | string | undefined | ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "IN") |
countryRegion | string | undefined | ISO 3166-2 region/state code (e.g., "CA" for California) |
latitude | string | undefined | Latitude coordinate as string |
longitude | string | undefined | Longitude coordinate as string |
region | string | undefined | Vercel Edge Network region that served the request |
undefined if geolocation cannot be determined (e.g., VPN users, private networks, or local development).JavaScript / TypeScript
Fetch API
// 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
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
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
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
# 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/geoPHP
<?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
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
Manual Deploy
# 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 --prodLocal Development
# 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 devundefined.Custom Domain Setup
After deploying to Vercel, you can add a custom domain:
- Go to your Vercel project dashboard
- Navigate to Settings → Domains
- Add your custom domain (e.g.,
geo.yourdomain.com) - Update DNS records as instructed by Vercel
Your API will then be available at https://geo.yourdomain.com/api/geo