Autocomplete API

The Autocomplete API provides intelligent suggestions for places, addresses, or landmarks as users type. It’s optimized for speed, accuracy, and localization, helping you create a seamless search experience in maps, navigation apps, delivery platforms, and more.

🔑 Authentication

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

🌐 Endpoint

  • GET /v4/autocomplete
  • Base URL: https://apihub.latlong.ai/v4/autocomplete

📥 Request Parameters

ParameterTypeRequiredDescription
QueryStringYesPartial input from the user (e.g. “Banga”)
LatFloatNoLatitude for location biasing
LongFloatNoLongitude for location biasing
LimitIntNoMax number of suggestions to return (default: 5, max: 20)
LanguageStringNoLanguage code (e.g., en, hi, fr) for localized results

📤 Sample Request

curl --location 'https://apihub.latlong.ai/v4/autocomplete.json?query=delhi'

📦 Sample Response

{
  "code": 1001,
  "status": "success",
  "data": [
    {
      "name": "Delhi - Kalka Line, North Delhi, Delhi",
      "geoid": 187911
    },
    {
      "name": "Delhi Ring Railway, West Delhi, Delhi",
      "geoid": 188378
    },
    {
      "name": "Delhi, South West Delhi, Delhi",
      "geoid": 188443
    },
    {
      "name": "Delhi Zaika, Motihari, East Champaran, Bihar",
      "geoid": 188584
    },
    {
      "name": "Delhi Zaika Biryani, Siwan:Siwan District:Bihar, Siwan, Bihar",
      "geoid": 188576
    },
    {
      "name": "Delhi-Kolkata Highway, Amas Taluk, Gaya, Bihar",
      "geoid": 187970
    },
    {
      "name": "Delhi Juice Corner, Motihari, East Champaran, Bihar",
      "geoid": 187858
    },
    {
      "name": "Delhi–Howrah railway, Veerchand Patel Road Area, Patna, Patna, Bihar",
      "geoid": 187842
    },
    {
      "name": "Delhi–Howrah railway, Rajendra Nagar:Patna, Patna, Bihar",
      "geoid": 187840
    },
    {
      "name": "Delhi Cantonment, New Delhi, Delhi",
      "geoid": 187390
    }
  ]
}

🧠 Features

  • 🔍

    Real-time, fast suggestions

    Get accurate, fast suggestions as users type.

  • 📍

    Location-aware results

    Bias by latitude and longitude for relevance.

  • 🌏

    Multi-language support

    Localized results in users' preferred language.

  • Smart filtering

    Prioritize populated and frequently searched places.

⚠️ Errors

Status CodeMessageDescription
400Missing required parametersWhen query is not provided
401UnauthorizedAPI key missing or invalid
429Rate limit exceededToo many requests in a short time
500Internal Server ErrorSomething went wrong on our side

Best Practices

  • Use lat and lon for biasing results based on user's location
  • Debounce user input to reduce request load (e.g., 300ms delay)
  • Limit API calls to one per input change event
  • Set limit to avoid overloading the UI with suggestions