Retrieve a complete list of all states, provinces, regions, and territories from around the world with basic geographical information.
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 state/province
Official name of the state/province
Unique identifier of the parent country
ISO2 code of the parent country
ISO2 code for the state/province
Administrative division type (e.g., “state”, “province”, “region”)
Approximate latitude coordinate of the state/province center
Approximate longitude coordinate of the state/province center
cURL
cURL (with search)
Python
JavaScript
PHP
Go
Java
Ruby
curl -X GET 'https://api.countrystatecity.in/v1/states' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
200 - Success
401 - Unauthorized
[
{
"id" : 4008 ,
"name" : "Maharashtra" ,
"country_id" : 101 ,
"country_code" : "IN" ,
"iso2" : "MH" ,
"type" : "state" ,
"latitude" : "19.75147980" ,
"longitude" : "75.71388840"
},
{
"id" : 1456 ,
"name" : "California" ,
"country_id" : 233 ,
"country_code" : "US" ,
"iso2" : "CA" ,
"type" : "state" ,
"latitude" : "36.17497340" ,
"longitude" : "-119.76762120"
}
]
Common Use Cases
Analyze administrative divisions across different countries. const analyzeStateTypes = ( states ) => {
const typeCount = states . reduce (( acc , state ) => {
acc [ state . type ] = ( acc [ state . type ] || 0 ) + 1 ;
return acc ;
}, {});
console . log ( 'State types distribution:' , typeCount );
return typeCount ;
};
Use coordinate data for mapping applications. const getStatesBounds = ( states ) => {
const lats = states . map ( s => parseFloat ( s . latitude ));
const lngs = states . map ( s => parseFloat ( s . longitude ));
return {
north: Math . max ( ... lats ),
south: Math . min ( ... lats ),
east: Math . max ( ... lngs ),
west: Math . min ( ... lngs )
};
};
This endpoint returns a large dataset (5000+ states). Consider using the filtered endpoints for better performance in most applications.