Nearest Cties API

The Nearest Cities API returns a list of up to 10 cities that are geographically closest to a specified city. This can be useful in applications related to travel, logistics, planning, or location-based services.

🔑 Authentication

  • All requests must include your API key.
  • Header Example:
  • Authorization: X-Authorization-Token (Get your token HERE)

🌐 Endpoint

  • GET /v4/nearest-cities
  • Base URL: https://apihub.latlong.ai/v4/nearest-cities

📥 Request Parameters

ParameterTypeRequiredDescription
cityStringYesThe name of the city to search from

📤 Sample Request


    curl --location ‘https://apihub.latlong.ai/v4/nearest-cities.json?address=main%20bazzar%2Cooty%2Ctamilnadu&limit=10'  

📦 Sample Response

{ 

  "code": 1001, 

  "status": "success", 

  "data": { 

    "address": "main bazzar,ooty,tamilnadu", 

    "nearestcity": [ 

      { 

        "name": "Udhagamandalam", 

        "adminstrative_type": "Municipality" 

      }, 

      { 

        "name": "Kethi", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Adikaratti", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Wellington", 

        "adminstrative_type": "Municipal Corporation" 

      }, 

      { 

        "name": "Sholur", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Coonoor", 

        "adminstrative_type": "Municipality" 

      }, 

      { 

        "name": "Bikketti", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Huligal", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Kilkunda", 

        "adminstrative_type": "Town Panchayat" 

      }, 

      { 

        "name": "Naduvattam", 

        "adminstrative_type": "Town Panchayat" 

      } 

    ] 

  } 

}  

🧠 Features

  • Returns up to 10 nearest cities for a given input city

  • 📍

    Based on geographical distance

  • 🗺

    ️ Fast and reliable response for dynamic UI or mobile apps

⚠️ Errors

Status CodeMessageDescription
400Missing required parametersWhen query is not provided
401UnauthorizedAPI key missing or invalid
404City not found The input city was not found in the database
500Internal Server ErrorSomething went wrong on our side

Best Practices

  • Use correct city names to avoid 404 errors
  • Display fallback message when fewer than 10 results are returned
  • Integrate with autocomplete or autosuggest APIs for better UX