Skip to main content

Get the state details from ISO2 Code

GET https://api.countrystatecity.in/v1/countries/[ciso]/states/[siso]

Security

This api use API KEY as an authentication method.

  • Name: X-CSCAPI-KEY
  • In: header

Request Parameters

NameLocated inDescriptionRequiredType
[ciso]URLISO2 Code of CountryRequiredstring
[siso]URLISO2 Code of StateRequiredstring

Response

CodeDescription
200Return a details of state
401Unauthorized.
404Not Found.

Example Usage

countries-states-cities.js
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/IN/states/MH", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Example Success Response

{
"id": 4008,
"name": "Maharashtra",
"country_id": 101,
"country_code": "IN",
"iso2": "MH",
"type": "state",
"latitude": "19.75147980",
"longitude": "75.71388840"
}

Example Error Response

{
"error'": "Unauthorized. You shouldn't be here."
}

Example Not Found Response

{
"error'": "No State/Region found."
}