Retrieve all states, provinces, regions, and territories for a specific country using the country’s ISO2 code.
Path Parameters
ISO2 code of the country (e.g., “IN” for India, “US” for United States)
Authentication
Your API key for authentication
Response
Unique identifier for the state/province
Official name of the state/province
ISO2 code for the state/province
curl -X GET 'https://api.countrystatecity.in/v1/countries/IN/states' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
[
{
"id": 4008,
"name": "Maharashtra",
"iso2": "MH"
},
{
"id": 4017,
"name": "Karnataka",
"iso2": "KA"
},
{
"id": 4030,
"name": "Tamil Nadu",
"iso2": "TN"
}
]
Common Use Cases
Validate state codes against specific countries.const validateStateForCountry = async (countryCode, stateCode) => {
const states = await getStatesByCountry(countryCode);
return states.some(state => state.iso2 === stateCode);
};
Cache states by country as they rarely change. Use this endpoint instead of filtering all states for better performance.