Search for States by Country
Country Data API provides detailed information about +200 different countries
HTTP GET
https://api.countrydataapi.com/v1/countries/country
Returns the states that belong to the specified country.
Some examples of the structure
Country: USA, State: Colorado, City: Denver
Country: Spain, State: Valencian Community, City: Valencia
There are 3 types of operations:
-
BASIC: Returns the fields id, state_name, lang.
-
NORMAL: Returns the field state_cities [All ids and names of the cities in the state]. Each city will consume 1 token.
-
ADVANCED: Returns the field state_zip_codes [All zip codes of the cities]. Each zip code will consume 1 token.
Query Params
Parameter | Type | Description |
---|---|---|
apikey | required, token | Authentication key for the account |
country | required, string | Name of the country from which you want the states |
limitToken | optional, number | 1000 (default). Maximum number of tokens you want to spend on this request |
type | optional, string | basic (default), normal, advanced |
lang | optional, lang | en (default). Expected language of the response |
Example Response
[
{
"id": "8dd25479-067a-43b0-ac4a-8e7faf2bcafb",
"state_name":"Takhar",
"lang":"en",
"state_cities":[
{
id: "8dd25476-067a-43b0-ac4b-8e7faf2bcbfb",
"city_name":"City",
...
}
],
"state_zip_codes": [
00000,
000001,
...
]
}
]