Free & Fast API

API Documentation

Complete guide to India Location Hub API. Access 500,000+ locations with lightning-fast responses.

Quick Start
No authentication required.

GET /api/stats

curl "https://india-location-hub.in/api/stats"
Base URL: https://india-location-hub.in/api

API Endpoints

All endpoints return JSON. CORS is enabled for browser requests.

GET
/api/locations/states

Retrieve all Indian states and union territories

Parameters:None
Response:Array of state objects with id, name, and code
Example Response
{
  "success": true,
  "data": {
    "states": [
      { "id": 1, "name": "Maharashtra", "code": "MH" },
      { "id": 2, "name": "Gujarat", "code": "GJ" }
    ]
  }
}
states
GET
/api/locations/districts

Get districts for a specific state

Parameters:state_id (required) - State ID
Response:Array of district objects
Example Response
{
  "success": true,
  "data": {
    "districts": [
      { "id": 1, "name": "Mumbai", "state_id": 1 },
      { "id": 2, "name": "Pune", "state_id": 1 }
    ]
  }
}
districts
GET
/api/locations/talukas

Get talukas for a specific district

Parameters:district_id (required) - District ID
Response:Array of taluka objects
Example Response
{
  "success": true,
  "data": {
    "talukas": [
      { "id": 1, "name": "Mumbai City", "district_id": 1 },
      { "id": 2, "name": "Mumbai Suburban", "district_id": 1 }
    ]
  }
}
talukas
GET
/api/locations/villages

Get villages using multiple supported formats

Parameters:Multiple formats supported: state+district+taluka, taluka_id (legacy), taluka name, or search
Response:Array of village objects with complete location hierarchy
Example Response
{
  "success": true,
  "data": {
    "villages": [
      {
        "id": 313079,
        "name": "Babiya",
        "code": "507289",
        "state_name": "GUJARAT",
        "state_code": "24",
        "district_name": "Kachchh",
        "district_code": "468",
        "taluka_name": "Mundra",
        "taluka_code": "03730"
      }
    ],
    "total": 64
  }
}
villages
GET
/api/search

Search locations by name across all levels

Parameters:q (required) - Search query, limit (optional) - Results limit (default: 50)
Response:Array of matching locations with full hierarchy
Example Response
{
  "success": true,
  "results": [
    {
      "name": "Mumbai",
      "state_name": "Maharashtra",
      "district_name": "Mumbai",
      "taluka_name": "Mumbai City",
      "full_path": "Maharashtra > Mumbai > Mumbai City > Mumbai"
    }
  ],
  "total": 1,
  "query": "mumbai"
}
search
GET
/api/stats

Get comprehensive database statistics

Parameters:None
Response:Statistics object with counts and metadata
Example Response
{
  "success": true,
  "data": {
    "totalStates": 36,
    "totalDistricts": 766,
    "totalTalukas": 6912,
    "totalVillages": 527635,
    "lastUpdated": "2025-08-27T10:30:00.000Z",
    "apiEndpoints": [
      "GET /api/locations/states",
      "GET /api/locations/districts?state_id={state-id}",
      "GET /api/locations/talukas?district_id={district-id}",
      "GET /api/locations/villages?state={state}&district={district}&taluka={taluka}",
      "GET /api/locations/villages?taluka_id={taluka-code} (legacy)",
      "GET /api/locations/villages?taluka={taluka-name}",
      "GET /api/search?q={query}",
      "GET /api/stats"
    ]
  }
}
stats

Villages API - Multiple Usage Formats

The Villages API supports multiple query formats for maximum flexibility and backward compatibility.

✅ Recommended Format

GET /api/locations/villages?state=GUJARAT&district=Kachchh&taluka=Mundra

Most precise - filters by complete location hierarchy

🔄 Legacy Format

GET /api/locations/villages?taluka_id=03730

Backward compatible - uses taluka code for legacy systems

🎯 Simple Format

GET /api/locations/villages?taluka=Mundra

Quick lookup - finds all villages in any taluka with this name

🔍 Search Format

GET /api/locations/villages?search=patel&taluka=Mundra

Search within results - combines filters with text search

💡 Performance Tips

  • • Use state+district+taluka for fastest, most precise results
  • • taluka_id format is fastest for legacy integrations
  • • taluka name alone may return villages from multiple states
  • • Search requires minimum 3 characters for performance

Code Examples

Ready-to-use code snippets for web and mobile development.

JavaScript

// Using Fetch API to get all states
async function getStates() {
  const response = await fetch('https://india-location-hub.in/api/locations/states');
  const data = await response.json();
  console.log(data.data.states);
}
getStates();