Loading
Loading
https://api.apifreaks.com/v1.0/geo/cities
1. Open the Authorizations dropdown and Verify your API key.
2. Click Run to see the live response here.
$ pip install requestsimport requests
url = "https://api.apifreaks.com/v1.0/geo/cities"
payload = {}
headers = {
'X-apiKey': ''
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
| Field | Type | Requirement | Description |
|---|---|---|---|
| cities | Array | Mandatory | An array of city objects for the specified country, optionally filtered by admin unit. |
| cities[].name | String | Mandatory | The name of the city (e.g., "Karachi", "Mirpur"). |
| cities[].latitude | Number | Mandatory | The geographic latitude of the city in decimal degrees. |
| cities[].longitude | Number | Mandatory | The geographic longitude of the city in decimal degrees. |
| cities[].iso_alpha_2 | String | Mandatory | The ISO 3166-1 alpha-2 country code the city belongs to (e.g., "PK"). |
| cities[].admin_unit | Object | Mandatory | An object describing the administrative unit the city belongs to. |
| cities[].admin_unit.name | String | Mandatory | The full name of the administrative unit (e.g., "Azad Kashmir"). |
| cities[].admin_unit.admin_code | String | Mandatory | The short code of the administrative unit (e.g., "JK"). |
| cities[].admin_unit.admin_level | String | Mandatory | The administrative level type of the unit (e.g., "province", "administered area"). |