Tova Cities API

A fast, reliable API for querying city and country data worldwide. <200ms average response time with 56,000+ cities. Search cities by name, find nearby locations, or look up detailed information using universal codes.

Zero breaking changes. Existing API versions are permanent.

Popular Requests

Jump to the most common use cases:

Base URL

All API requests should be made to one of the following:

https://cities-v1.tovaapis.com
pinned version, your integration never breaks
https://cities-latest.tovaapis.com
always points to the newest version

Authentication

Include your API key in the request header:

X-API-Key: your_api_key

Endpoints

Search Cities versions: v1 latest

Search for cities by name within a specific country. Results are ordered by population (largest first).

GET /search?q={query}&iso3={country}&n={limit}&contains={0|1}

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch term (minimum 3 characters)
iso3stringYesISO-3 country code (e.g., USA, GBR)
nintegerNoMax results to return (1-100, default: 10)
containsintegerNoSet to 1 to match anywhere in name. Default (0) matches from beginning only.
Code Examples
curl "https://cities-v1.tovaapis.com/search?q=Boulder&iso3=usa&n=3" \ -H "X-API-Key: your_api_key"
const params = new URLSearchParams({ q: 'Boulder', iso3: 'usa', n: '3' }); const response = await fetch(`https://cities-v1.tovaapis.com/search?${params}`, { headers: { 'X-API-Key': 'your_api_key' } }); const result = await response.json(); console.log(result.data); // Array of matching cities
const params = new URLSearchParams({ q: 'Boulder', iso3: 'usa', n: '3' }); fetch(`https://cities-v1.tovaapis.com/search?${params}`, { headers: { 'X-API-Key': 'your_api_key' } }) .then(res => res.json()) .then(result => { console.log(result.data); // Array of matching cities });

Example Response

{ "data": [ { "ucc": "boul", "name": "Boulder", "country": "USA", "countryName": "United States", "region": "colorado", "regionName": "Colorado", "population": 108250, "latitude": 40.015, "longitude": -105.2705, "aliases": [] }, { "ucc": "boulde", "name": "Boulder City", "country": "USA", "countryName": "United States", "region": "nevada", "regionName": "Nevada", "population": 15551, "latitude": 35.9786, "longitude": -114.8325, "aliases": [] }, { "ucc": "bould", "name": "Boulder Hill", "country": "USA", "countryName": "United States", "region": "illinois", "regionName": "Illinois", "population": 8108, "latitude": 41.7125, "longitude": -88.3362, "aliases": [] } ], "meta": { "query": "Boulder", "country": "usa", "total": 3, "limit": 3 } }

Find Nearest Cities versions: v1 latest

Find cities closest to a given coordinate. Results are ordered by distance (nearest first).

GET /nearest?lat={lat}&lon={lon}&n={limit}&imp={0|1}

Query Parameters

ParameterTypeRequiredDescription
latnumberYesLatitude in decimal degrees (-90 to 90)
lonnumberYesLongitude in decimal degrees (-180 to 180)
nintegerNoMax results to return (1-100, default: 10)
impintegerNoImperial. Set to 1 for miles, 0 (default) for kilometers
Code Examples
curl "https://cities-v1.tovaapis.com/nearest?lat=40.7128&lon=-74.006&n=3" \ -H "X-API-Key: your_api_key"
const params = new URLSearchParams({ lat: '40.7128', lon: '-74.006', n: '3' }); const response = await fetch(`https://cities-v1.tovaapis.com/nearest?${params}`, { headers: { 'X-API-Key': 'your_api_key' } }); const result = await response.json(); result.data.forEach(city => { console.log(`${city.name}: ${city.distance} ${city.distanceUnit}`); });
const params = new URLSearchParams({ lat: '40.7128', lon: '-74.006', n: '3' }); fetch(`https://cities-v1.tovaapis.com/nearest?${params}`, { headers: { 'X-API-Key': 'your_api_key' } }) .then(res => res.json()) .then(result => { result.data.forEach(city => { console.log(`${city.name}: ${city.distance} ${city.distanceUnit}`); }); });

Example Response

{ "data": [ { "distance": 0.0, "distanceUnit": "km", "ucc": "nyc", "name": "New York", "country": "USA", "countryName": "United States", "region": "newyork", "regionName": "New York", "population": 8336817, "latitude": 40.7128, "longitude": -74.006, "aliases": ["NYC", "New York City", "Nueva York", "The Big Apple", "Gotham"] }, { "distance": 0.4, "distanceUnit": "km", "ucc": "trib", "name": "Tribeca", "country": "USA", "countryName": "United States", "region": "newyork", "regionName": "New York", "population": 7811, "latitude": 40.7154, "longitude": -74.0093, "aliases": [] }, { "distance": 0.6, "distanceUnit": "km", "ucc": "fina", "name": "Financial District", "country": "USA", "countryName": "United States", "region": "newyork", "regionName": "New York", "population": 60976, "latitude": 40.7079, "longitude": -74.0086, "aliases": [] } ], "meta": { "latitude": 40.7128, "longitude": -74.006, "limit": 3 } }

Get Country versions: v1 latest

Retrieve detailed information about a country using its ISO 3166-1 alpha-3 code.

GET /countries/{iso3}

Path Parameters

ParameterTypeDescription
iso3stringISO-3 country code (e.g., USA, GBR, JPN)
Code Examples
curl "https://cities-v1.tovaapis.com/countries/USA" \ -H "X-API-Key: your_api_key"
const response = await fetch('https://cities-v1.tovaapis.com/countries/USA', { headers: { 'X-API-Key': 'your_api_key' } }); const country = await response.json(); console.log(`${country.name} has ${country.cityCount} cities`);
fetch('https://cities-v1.tovaapis.com/countries/USA', { headers: { 'X-API-Key': 'your_api_key' } }) .then(res => res.json()) .then(country => { console.log(`${country.name} has ${country.cityCount} cities`); });

Example Response

{ "iso3": "USA", "iso2": "US", "name": "United States", "population": 331900000, "capital": "wash", "capitalName": "Washington", "regionCount": 51, "cityCount": 7502, "currency": "USD" }

Get City by UCC versions: v1 latest

Retrieve detailed information about a city using its Universal City Code (UCC).

GET /cities/{ucc}

Path Parameters

ParameterTypeDescription
uccstringUniversal City Code (e.g., nyc)
Code Examples
curl "https://cities-v1.tovaapis.com/cities/nyc" \ -H "X-API-Key: your_api_key"
const response = await fetch('https://cities-v1.tovaapis.com/cities/nyc', { headers: { 'X-API-Key': 'your_api_key' } }); const city = await response.json(); console.log(city.name); // "New York"
fetch('https://cities-v1.tovaapis.com/cities/nyc', { headers: { 'X-API-Key': 'your_api_key' } }) .then(res => res.json()) .then(city => { console.log(city.name); // "New York" });

Example Response

{ "ucc": "nyc", "name": "New York", "country": "USA", "countryName": "United States", "region": "newyork", "regionName": "New York", "population": 8336817, "latitude": 40.7128, "longitude": -74.006, "aliases": ["NYC", "New York City", "Nueva York", "The Big Apple", "Gotham"] }

Response Fields

City Object

FieldTypeDescription
uccstringUniversal City Code - unique identifier for the city
namestringCity name
countrystringISO-3 country code
countryNamestringFull country name
regionstringUniversal Region Code (state/province)
regionNamestringRegion name
populationintegerCity population
latitudenumberLatitude in decimal degrees
longitudenumberLongitude in decimal degrees
aliasesarrayAlternative names for the city

Country Object

FieldTypeDescription
iso3stringISO-3 country code
iso2stringISO 3166-1 alpha-2 country code
namestringCountry name
populationintegerCountry population
capitalstringUCC of the capital city
capitalNamestringName of the capital city
regionCountintegerNumber of regions/states
cityCountintegerNumber of cities in database
currencystringCurrency code

Error Responses

The API returns standard HTTP status codes along with a JSON error body:

{ "error": { "code": "CITY_NOT_FOUND", "message": "UCC doesn't exist", "statusCode": 404, "requestID": "9c00d1e5-5cbb-4622-a313-12cf84262d6a", "field": null } }
Status CodeError CodeDescription
400MISSING_PARAMETERA required parameter is missing
400INVALID_PARAMETERA parameter value is invalid
400INVALID_COORDINATESLatitude or longitude is out of range
404CITY_NOT_FOUNDThe requested city does not exist
404COUNTRY_NOT_FOUNDThe requested country does not exist
429RATE_LIMIT_EXCEEDEDToo many requests

Getting Started

1. Get Your Test Key (Free)
Sign up and get a test key with 1,000 free requests. This is enough to explore endpoints and build your integration.

Rate Limits

Test Key: 1,000 lifetime requests, 10 requests per second
Live Key: Per your plan quota