API Almanac
API reference › Cities

Nearest cities to a coordinate, with distance and time zone (a coarse reverse geocode)

GET/v1/cities/nearest

GET/v1/cities/nearest

Nearest cities to a coordinate, with distance and time zone (a coarse reverse geocode)

Cities of 15,000+ people only, so remote coordinates return the nearest town some distance away; distance_km says how far.

PARAMETERS
latquery · numberREQUIRED
Latitude
e.g. 40.6413
lonquery · numberREQUIRED
Longitude
e.g. -73.7781
limitquery · integer
How many
e.g. 5
In the full reference
REQUEST
curl "https://api.apialmanac.com/v1/cities/nearest?lat=40.6413&lon=-73.7781" \
  -H "X-API-Key: YOUR_KEY"
RESPONSE
200OK
{
  "query": {
    "lat": 40.6413,
    "lon": -73.7781
  },
  "count": 1,
  "cities": [
    {
      "id": 5125771,
      "name": "Jamaica",
      "ascii_name": "Jamaica",
      "country": "US",
      "admin1": "New York",
      "admin1_code": "NY",
      "lat": 40.6915,
      "lon": -73.8057,
      "population": 216866,
      "elevation_m": 11,
      "timezone": "America/New_York",
      "offset": "-04:00",
      "abbreviation": "EDT",
      "local_time": "2026-10-09T12:30:00-04:00",
      "distance_km": 6.1,
      "bearing": 338
    }
  ],
  "attribution": "City data © GeoNames (geonames.org), CC BY 4.0"
}
Try it — sign in first
Runs on a sandbox key: 200 requests a month. Your real key is for production.