CountryStateCity
APIFree global geocoding data for countries, states & cities in multiple formats
Overview
The CountryStateCity API offers RESTful endpoints to retrieve structured global geocoding data including countries, states/provinces, and cities/towns. It returns JSON responses for API requests, with additional bulk data available in SQL, XML, YAML, and CSV formats via its website. Key endpoints include GET /countries (list all countries with ISO codes), GET /states?country={isoCode} (fetch states by country), and GET /cities?state={stateCode} (get cities by state). Ideal for building location pickers, address forms, geospatial apps, or enriching datasets with location information for businesses and developers.
Example Integration (JavaScript)
fetch('https://countrystatecity.in/')
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err)); Key Features
- RESTful endpoints
- JSON response support
- Bulk data in SQL/XML/YAML/CSV
- Global location coverage
- No API key required
Frequently Asked Questions
? Is CountryStateCity free to use?
Yes, the CountryStateCity API and bulk data downloads are completely free for both personal and commercial use.
? Does it require an API Key?
No, the RESTful API endpoints do not require an API key for access—you can start using them immediately.
? What is the response format?
API requests return JSON responses. Bulk location data is also available in SQL, XML, YAML, and CSV formats via the official website for offline use.
Top Alternatives
People Also Ask about CountryStateCity
Tool Info
Pros
- ⊕ Free for personal/commercial use
- ⊕ Easy to integrate
- ⊕ Multiple data formats available
- ⊕ Comprehensive location dataset
Cons
- ⊖ Rate limits may apply
- ⊖ No real-time data updates
- ⊖ No official SLA
- ⊖ Limited advanced geocoding features