GeoNames API

Free to Use Varies (check documentation)

Overview

GeoNames is one of the largest free geographical databases in the world, containing over 11 million place names, postal codes, country info, and elevation data. You can search for cities, mountains, rivers, and administrative regions by name or coordinates. A free GeoNames account is required to access the web services.

💡

Beginner Tip

Register at geonames.org to get your free username, then replace "demo" in the API URL with your username — the demo account is heavily rate-limited and not suitable for production use.

Available Data

IP address details
latitude and longitude
city and country
timezone
ISP information

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from GeoNames",
    "description": "Place names and other geographical data",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

geonames Array of matching geographic place objects.
geonames[].name Name of the place.
geonames[].countryName Full country name where the place is located.
geonames[].lat Latitude of the place.
geonames[].lng Longitude of the place.
geonames[].population Population of the place if applicable (0 for non-populated features).

Implementation Example

const url = "http://www.geonames.org/export/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

{"status":{"message":"the daily limit of credits has been exceeded"}} Too many requests were made with the free account.
Register your own account at geonames.org; the demo account has very low limits. Free accounts get 20,000 credits/day.
{"status":{"message":"user account not enabled to use the free web services"}} The GeoNames web services are not enabled for your account.
Log into your geonames.org account and enable the free web services option in your profile settings.
Empty geonames array No places matched your search query.
Try a different spelling, use a shorter search term, or specify a country code with the country parameter.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 0/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 302ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS NO
CORS UNKNOWN
Category Geocoding
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →