CarStat.dev
Connect key
Guide

Display a listing's location

Every listing has location_details with the same four parts on every endpoint: country as {id, name, iso}, and region, district and place as {id, name}. Missing parts are null. Read names straight from here; no extra requests are needed.

  • An ID that couldn't be resolved keeps its id with name: null. A text label from the source has id: null.
  • A region can be its own place (same ID twice, as in the example). Deduplicate labels by ID.
  • place is a geographic entry, not always a city. We never infer a city from coordinates.
  • The older location field is kept for compatibility. Its values are IDs on /search and localized strings on /cars; avoid it in new code.

Building region and city pickers

Use the dictionaries for filter UIs. Load /countries, then regions with /locations?country_id=C&feature_class=A&feature_code=ADM1, districts with admin1=R&feature_code=ADM2, and towns with feature_class=P. Page with after_id. Results are ordered by ID, not by relevance, so sort by name in your UI.

listings[0].location_detailsLive
{
  "country": {
    "id": 208,
    "name": "South Korea",
    "iso": "KR"
  },
  "region": {
    "id": 1841610,
    "name": "Gyeonggi-do"
  },
  "district": null,
  "place": {
    "id": 1841610,
    "name": "Gyeonggi-do"
  }
}
Regions of South Korea
curl -g "https://api.lotarius.com/locations?country_id=208&feature_class=A&feature_code=ADM1&lang=en&api_key=$CARS_API_KEY" \
  -H "Accept: application/json"