Skip to content

omkarcloud/geodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

GeoDB

REST API for city and geographic data. Returns city name, state, country, coordinates, population, and capital status.

Features

  • Single endpoint for city lookups worldwide
  • Returns structured JSON with full location data
  • Filter by city name and/or country code
  • 5,000 requests/month on free tier
  • Example Response:
[
  {
    "city_name": "New York",
    "state": "New York",
    "country_code": "US",
    "is_capital": false,
    "coordinates": {
      "latitude": 40.6943,
      "longitude": -73.9249
    },
    "population": 18713220
  }
]

Authentication

  1. Create account at omkar.cloud

Sign Up

  1. Get API key from omkar.cloud/api-key

Copy API Key

  1. Include API-Key header in requests

Quick Start

curl -X GET "https://city-api.omkar.cloud/city?name=New%20York" \
  -H "API-Key: YOUR_API_KEY"
[
  {
    "city_name": "New York",
    "state": "New York",
    "country_code": "US",
    "is_capital": false,
    "coordinates": {
      "latitude": 40.6943,
      "longitude": -73.9249
    },
    "population": 18713220
  }
]

Installation

Python

pip install requests
import requests

response = requests.get(
    "https://city-api.omkar.cloud/city",
    params={"name": "New York"},
    headers={"API-Key": "YOUR_API_KEY"}
)

cities = response.json()

Node.js

npm install axios
import axios from "axios";

const response = await axios.get("https://city-api.omkar.cloud/city", {
    params: { name: "New York" },
    headers: { "API-Key": "YOUR_API_KEY" }
});

const cities = response.data;

API Reference

Endpoint

GET https://city-api.omkar.cloud/city

Headers

Header Required Description
API-Key Yes API key from omkar.cloud/api-key

Parameters

Parameter Required Default Description
name No City name (e.g., "New York", "Tokyo")
country_code No Two-letter ISO country code (e.g., "US", "JP")

Response

[
  {
    "city_name": "string",
    "state": "string",
    "country_code": "string",
    "is_capital": "boolean",
    "coordinates": {
      "latitude": "number",
      "longitude": "number"
    },
    "population": "number"
  }
]
Field Type Description
city_name string City name
state string State or province
country_code string Two-letter ISO code
is_capital boolean Whether it's the country's capital
coordinates.latitude number Latitude coordinate
coordinates.longitude number Longitude coordinate
population number City population

Examples

Search by city name

response = requests.get(
    "https://city-api.omkar.cloud/city",
    params={"name": "Tokyo"},
    headers={"API-Key": "YOUR_API_KEY"}
)

for city in response.json():
    print(f"{city['city_name']}, {city['country_code']}: {city['population']}")

Filter by country

response = requests.get(
    "https://city-api.omkar.cloud/city",
    params={"name": "London", "country_code": "GB"},
    headers={"API-Key": "YOUR_API_KEY"}
)

london_uk = response.json()[0]

Get coordinates

const { data } = await axios.get("https://city-api.omkar.cloud/city", {
    params: { name: "Paris" },
    headers: { "API-Key": "YOUR_API_KEY" }
});

const { latitude, longitude } = data[0].coordinates;

Error Handling

response = requests.get(
    "https://city-api.omkar.cloud/city",
    params={"name": "InvalidCity123"},
    headers={"API-Key": "YOUR_API_KEY"}
)

if response.status_code == 200:
    data = response.json()
    if not data:
        # No cities found
        pass
elif response.status_code == 401:
    # Invalid API key
    pass
elif response.status_code == 429:
    # Rate limit exceeded
    pass

Rate Limits

Plan Price Requests/Month
Free $0 5,000
Starter $25 100,000
Grow $75 1,000,000
Scale $150 10,000,000

Support

Contact Us on WhatsApp about GeoDB

Contact Us on Email about GeoDB

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors