Loading
Loading
The Administrative Units API gives you direct, structured access to country-level administrative division data, covering admin levels, admin units, and detailed administrative unit information for countries across the world. It delivers administrative unit names, codes, levels, ISO alpha-2 country codes, and country names using standard ISO 3166-1 alpha-2 country codes.
Use this Country Administrative Data API to build location-aware products that go deeper than just countries and cities. It powers address validation systems, tax and compliance tools, regional analytics dashboards, government data systems, and any application that needs to work with country subdivisions, administrative boundaries, and division-level geographic data at scale.
Retrieve all administrative division levels available for a country using its ISO 3166-1 alpha-2 country code. Understand the full administrative hierarchy before querying specific units or subdivisions within it.
Find administrative units for a country and filter results by one or more administrative levels using the optional adminLevels parameter as a comma-separated list. Get exactly the subdivision data your application needs without pulling unnecessary records.
Fetch complete details for a specific administrative unit using the admin_unit code. The response includes the unit name, admin code, admin level, ISO alpha-2 country code, and country name — everything needed for a full administrative unit record.
All endpoints use ISO 3166-1 alpha-2 country codes as the primary lookup key, ensuring standardized and consistent administrative data retrieval across every country and territory worldwide.
Navigate country administrative hierarchies from top-level divisions down to specific units. Use admin level filtering to retrieve exactly the tier of administrative data your application requires.
Supports both json and xml response formats via the format parameter, giving your team the flexibility to integrate administrative unit data into any stack from modern web applications to enterprise and legacy systems.
Retrieve all administrative division levels defined for a country. Use this endpoint first to understand a country's hierarchy before querying its units.
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/geo/admin-levels?country=PK"
payload = {}
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Retrieve all administrative units for a country, with optional filtering by one or more admin levels via the adminLevels parameter.
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/geo/admin-units?country=PK"
payload = {}
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Fetch complete details for a specific administrative unit using its admin_unit code and country code.
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/geo/admin-unit/details?country=PK&admin_unit=PB"
payload = {}
headers = {
'X-apiKey': 'API-KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Retrieve all administrative levels defined for a country to understand its geographic hierarchy before exploring its subdivisions.
# Response { "admin_levels": [ "province", "federal capital territory", "administered area" ] }curl "https://api.apifreaks.com/v1.0/geo/admin-levels?apiKey=YOUR_API_KEY&country=PK"
Use a country code to retrieve all administrative units for that country. Use the optional adminLevels parameter to filter results by one or more specific levels.
# Response { "admin_units": [ { "name": "Azad Kashmir", "admin_code": "JK", "admin_level": "administered area" }, { "name": "Balochistan", "admin_code": "BA", "admin_level": "province" }, { "name": "Gilgit-Baltistan", "admin_code": "GB", "admin_level": "administered area" }, { "name": "Islamabad", "admin_code": "IS", "admin_level": "federal capital territory" }, { "name": "Khyber Pakhtunkhwa", "admin_code": "KP", "admin_level": "province" }, { "name": "Punjab", "admin_code": "PB", "admin_level": "province" }, { "name": "Sindh", "admin_code": "SD", "admin_level": "province" } ] }curl "https://api.apifreaks.com/v1.0/geo/admin-units?apiKey=YOUR_API_KEY&country=PK"
Use a country code and a specific admin unit code to retrieve a complete administrative unit record including its name, admin code, admin level, ISO alpha-2 country code, and country name.
# Response { "name": "Punjab", "admin_code": "PB", "admin_iso3166_2": "PK-PB", "admin_level": "province", "country_iso3166_2": "PK", "country_name": "Pakistan" }curl "https://api.apifreaks.com/v1.0/geo/admin-unit/details?apiKey=YOUR_API_KEY&country=PK&admin_unit=PB"
US for the United States, GB for the United Kingdom, and DE for Germany. Passing a full country name or an unsupported format will return a 400 Bad Request error indicating that only ISO 3166-1 alpha-2 codes are supported.adminLevels parameter that takes a comma-separated list of administrative levels to filter results. For example, passing adminLevels=state returns only state-level units for the specified country, while passing adminLevels=state,county returns units at both levels in a single response.To use the Administrative Units API, you will need API credits. We only charge for successful queries, defined by a 2xx status code. If your request results in a 4xx or 5xx status code, no credits will be charged, and any deducted credits will be returned.
For each successful request, 1 credit will be charged.
Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.