City geographic and demographic information including location coordinates, population, timezone, elevation, and administrative details. Used for location services, mapping applications, and geographic data systems.
https://api.mockly.codes/cities?page=1&limit=10&count=10Configure your request and click Send Request to see the response here.
/citiesGet a collection of cities
/location/cities/cities/:idGet a single city by ID
/location/cities/:id/cities/metaGet resource metadata and schema
/location/cities/metaThe search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.
Search across all text fields:
GET https://api.mockly.codes/cities?q=laptopGET https://api.mockly.codes/cities?q=laptop&search_fields=name,descriptionsearch_fields, all text fields are searched// Get 10 cities
fetch('https://api.mockly.codes/cities?count=10')
.then(res => res.json())
.then(data => console.log(data));import requests
response = requests.get(
'https://api.mockly.codes/cities?count=10'
)
data = response.json()curl "https://api.mockly.codes/cities?count=10"fetch('https://api.mockly.codes/cities?nocache=true')idintegerrequiredUnique identifier for the city record
random_intnamestringrequiredOfficial name of the city
citycountrystringrequiredName of the country where the city is located
countrycountry_codestringISO 3166-1 alpha-2 country code (e.g., US, GB, FR)
country_codestatestringState, province, or administrative region where the city is located
statelatitudenumberGeographic latitude coordinate (decimal degrees, -90 to 90)
latitudelongitudenumberGeographic longitude coordinate (decimal degrees, -180 to 180)
longitudepopulationintegerTotal population of the city
city_populationtimezonestringIANA timezone identifier (e.g., America/New_York, Europe/London)
timezoneelevationintegerElevation above sea level in meters
elevationcountintegerNumber of items to return (default: 10, max: 100)
seedintegerSeed for reproducible data generation
nocachebooleanBypass cache and generate fresh data on every request