Cities All docs

Cities API Reference

2 routes under /v1/cities. Base URL https://api.apifor.dev, authenticated with x-api-key, one credit per request. Coverage and licence are on the Cities page.

GET/v1/cities

List cities with filters and paging.

ParameterInTypeRules
pagequeryintegermin 1 · default 1
limitqueryinteger1 to 200 · default 50
countryquerystringISO 3166-1 alpha-2
qquerystring2 to 100 chars
GET/v1/cities
curl 'https://api.apifor.dev/v1/cities' \
  -G -d country=IR -d limit=1 \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": [
    {
      "geonameid": 285,
      "name": "Boneh-ye ‘Alvān",
      "asciiname": "Boneh-ye 'Alvan",
      "lat": 32.11171,
      "lng": 48.45877,
      "feature_code": "PPL",
      "country_code": "IR",
      "admin1_code": "15",
      "admin1_name": "Khuzestan",
      "admin2_code": null,
      "population": 6860,
      "elevation": 0,
      "dem": 54,
      "timezone": "Asia/Tehran",
      "modified_at": "2026-05-19"
    }
  ]
}
  • 200Successful response. Pagination is explicit; no silent truncation.
  • 400Invalid query parameters
  • 404Record not found
  • 500Dataset unavailable
GET/v1/cities/{id}

Find cities by identifier.

ParameterInTypeRules
id *pathstringNone
GET/v1/cities/{id}
curl 'https://api.apifor.dev/v1/cities/{id}' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": {
    "geonameid": 285,
    "name": "Boneh-ye ‘Alvān",
    "asciiname": "Boneh-ye 'Alvan",
    "lat": 32.11171,
    "lng": 48.45877,
    "feature_code": "PPL",
    "country_code": "IR",
    "admin1_code": "15",
    "admin1_name": "Khuzestan",
    "admin2_code": null,
    "population": 6860,
    "elevation": 0,
    "dem": 54,
    "timezone": "Asia/Tehran",
    "modified_at": "2026-05-19"
  }
}
  • 200Successful response. Pagination is explicit; no silent truncation.
  • 400Invalid query parameters
  • 404Record not found
  • 500Dataset unavailable

Error handling · Rate limits · Source licences