Nearest Cities API
Find cities closest to a given coordinate. Useful for location-based recommendations and regional content delivery.
Try in Playground →Endpoint
GET
/v4/nearest-cities.jsonAuthentication
Include your token in the request header:
X-Authorization-Token: your_token
Parameters
| Name | Type | Description |
|---|---|---|
| latitude | number | Latitude of the reference point |
| longitude | number | Longitude of the reference point |
| limit | number | Number of cities to return (default: 10) |
Code Examples
curl "https://apihub.latlong.ai/v4/nearest-cities.json?latitude=VALUE&longitude=VALUE" \ -H "X-Authorization-Token: YOUR_TOKEN"
Example Response
JSON
{
"status": "success",
"code": 1001,
"data": [
{ "name": "Bangalore", "distance": "0.5 km", "state": "Karnataka" },
{ "name": "Whitefield", "distance": "18.2 km", "state": "Karnataka" },
{ "name": "Electronic City", "distance": "20.1 km", "state": "Karnataka" }
]
}
