curl -X GET 'https://api.countrystatecity.in/v1/countries/IN/states/MH/cities' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
[
{ "id": 133024, "name": "Mumbai" },
{ "id": 132332, "name": "Pune" },
{ "id": 133351, "name": "Nashik" }
]
Cities Endpoints
Get Cities by State
Retrieve all cities within a specific state/province of a country
GET
/
v1
/
countries
/
{country_iso2}
/
states
/
{state_iso2}
/
cities
curl -X GET 'https://api.countrystatecity.in/v1/countries/IN/states/MH/cities' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
[
{ "id": 133024, "name": "Mumbai" },
{ "id": 132332, "name": "Pune" },
{ "id": 133351, "name": "Nashik" }
]
Retrieve all cities within a specific state or province using both the country’s ISO2 code and the state’s ISO2 code. This provides the most targeted city data.
See Pricing for plan details.
Availability: All plans (Community and above). The fields returned vary by tier — see Tier-Based Field Availability below.
Path Parameters
ISO2 code of the country (e.g., “IN”, “US”)
ISO2 code of the state/province (e.g., “MH” for Maharashtra, “CA” for California)
Trim and order results: Add
?fields= to limit columns returned, or ?sort= to order the list. Both are available on Supporter+ plans. See the Field Filtering & Sorting guide for syntax and per-entity sortable fields.Authentication
Your API key for authentication
Query Parameters
Search filter on name. Case-insensitive match on
name and native fields. Minimum 2 characters. Requires Supporter+ plan. Without this parameter, all results are returned (no plan restriction for search).Response
Unique identifier for the city
Official name of the city
City responses on the Basic tier only return
id and name. Upgrading to Supporter+ unlocks state_id, state_code, country_id, country_code, latitude, longitude, timezone, population, type, level, parent_id, and native. Professional+ adds translations and wikiDataId. See Tier-Based Field Availability below.curl -X GET 'https://api.countrystatecity.in/v1/countries/IN/states/MH/cities' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
[
{ "id": 133024, "name": "Mumbai" },
{ "id": 132332, "name": "Pune" },
{ "id": 133351, "name": "Nashik" }
]
Common Use Cases
Cascading Location Selector
Cascading Location Selector
Build three-level dropdowns for Country → State → City selection.
class LocationSelector {
constructor() {
this.setupEventListeners();
}
setupEventListeners() {
const countrySelect = document.getElementById('country');
const stateSelect = document.getElementById('state');
const citySelect = document.getElementById('city');
countrySelect.addEventListener('change', async (e) => {
const countryCode = e.target.value;
if (countryCode) {
await this.populateStates(countryCode);
this.clearCities();
}
});
stateSelect.addEventListener('change', async (e) => {
const stateCode = e.target.value;
const countryCode = countrySelect.value;
if (stateCode && countryCode) {
await this.populateCities(countryCode, stateCode);
}
});
}
async populateCities(countryCode, stateCode) {
const cities = await getCitiesByState(countryCode, stateCode);
const citySelect = document.getElementById('city');
citySelect.innerHTML = '<option value="">Select City...</option>';
cities.forEach(city => {
const option = document.createElement('option');
option.value = city.id;
option.textContent = city.name;
citySelect.appendChild(option);
});
}
}
Regional Service Areas
Regional Service Areas
Define service coverage areas by state and city combinations.
const createServiceArea = async (serviceAreas) => {
const coverage = {};
for (const area of serviceAreas) {
const { countryCode, stateCode, serviceName, deliveryTime } = area;
const cities = await getCitiesByState(countryCode, stateCode);
coverage[`${countryCode}-${stateCode}`] = {
serviceName,
deliveryTime,
cities: cities.length,
cityIds: cities.map(city => city.id)
};
}
return coverage;
};
// Usage
const areas = [
{ countryCode: 'IN', stateCode: 'MH', serviceName: 'Express', deliveryTime: '1-2 days' },
{ countryCode: 'US', stateCode: 'CA', serviceName: 'Standard', deliveryTime: '2-3 days' }
];
const serviceMap = await createServiceArea(areas);
This is the most efficient endpoint for building cascading location selectors as it provides the smallest, most relevant dataset.
This endpoint provides the optimal balance between data size and specificity, making it ideal for form controls and location-based filtering.
Tier-Based Field Availability
| Tier | Plans | Fields |
|---|---|---|
| Basic | Community, Starter, Legacy | id, name |
| Coordinates | Supporter | All Basic + state_id, state_code, country_id, country_code, latitude, longitude, timezone, population, type, level, parent_id, native |
| Full | Professional, Business | All Coordinates + translations, wikiDataId |
Was this page helpful?
⌘I