Explore city names, administrative divisions, populations and coordinates, with data provenance.
The free API exposes the 5,000 cities with the highest population values in this database release. This global selection is fixed: country filters never expand it.
Widgets displayed on AffectionPlus.com pages use the entire database, including for visitors without a subscription. On another site, the widget is limited to the free selection unless the site uses a token issued under an active eligible subscription.
Developer access
The existing AffectionPlus Premium subscription, used with the same account on CAPIT.NET, starts at €3 including tax per month. It includes CSV and SQL files, the full API and Pack Developer, with no second subscription.
curl "https://api.capit.net/v1/cities?country=MG&sort=-population&pageSize=10"
<script src="https://api.capit.net/assets/cities/affection-cities.js"></script>
<div id="cities-widget"></div>
// JavaScript:
AffectionCities.create({container:"#cities-widget",country:"MG",pageSize:10,sort:"-population",map:true});
This example works without a key, using free access. For MG, it therefore returns only Malagasy cities in the global selection. Demonstrations hosted on AffectionPlus use the exception described above.
Keep the secret key on the webmaster’s server. That server issues a 300-second token for an exact permitted HTTPS origin. Revocation and effective expiry of entitlements stop full access. A restricted token must retain the eight basic widget fields.
id, name, country, region, department, population, latitude, longitude
Authorization: Bearer <SERVER_API_KEY>
POST /v1/widget-token · {"origin":"https://example.com","country":"MG"}
Free: 60 requests/minute, 1,000/day/IP. Subscriber: 120/minute, 10,000/day/account. Export: 5/minute, 50/day/account and 1,000 rows/batch. Tokens share account quotas.
These quotas apply to API requests. CSV and SQL file downloads purchased individually or included in Premium are not subject to this row limit.
Examples on country pages
Sources and licenses
- INSEE — Licence Ouverte 2.0 / Etalab
- GeoNames — CC BY
- OpenStreetMap — ODbL
- Wikidata — CC0
- Natural Earth — public domain
Population figures do not all refer to the same year or geographic area. Ranking uses population, not estimated urban population.
population_urban_source = gn_agglomeration means a heuristic estimate, not an official census. population_source = original_unverified means an uncorroborated historical value. Open licenses also apply to purchased data: attribution and, for a derivative database covered by ODbL, share-alike obligations. Payment covers the service and does not remove redistribution rights granted by those licenses.
