Country State City API
Documentation Website
Countries
Get a list of countries with ISO2, ISO3, Phonecode, Capital, Currency, Flag etc.
States
Get a list of states with ISO2 code and attached to its belonging country code.
Cities
Get a list of cities attached with state and country code, longitude and latitude information.
Examples
Quick snippets to get started with Country State City API
- Countries
- States of Country
- Cities of State
var headers = new Headers();headers.append("X-CSCAPI-KEY", "API_KEY");var requestOptions = {method: 'GET',headers: headers,redirect: 'follow'};fetch("https://api.countrystatecity.in/v1/countries", requestOptions).then(response => response.text()).then(result => console.log(result)).catch(error => console.log('error', error));
var headers = new Headers();headers.append("X-CSCAPI-KEY", "API_KEY");var requestOptions = {method: 'GET',headers: headers,redirect: 'follow'};// Pass Country Code -- Eg: Country Code : INfetch("https://api.countrystatecity.in/v1/countries/IN/states", requestOptions).then(response => response.text()).then(result => console.log(result)).catch(error => console.log('error', error));
var headers = new Headers();headers.append("X-CSCAPI-KEY", "API_KEY");var requestOptions = {method: 'GET',headers: headers,redirect: 'follow'};// Pass Country & State Code -- Eg: Country Code : IN & State Code : MHfetch("https://api.countrystatecity.in/v1/countries/IN/states/MH/cities", requestOptions).then(response => response.text()).then(result => console.log(result)).catch(error => console.log('error', error));