Public APIs
CountryStateCity favicon

CountryStateCity

Geocoding

World countries, states, regions, provinces, cities & towns in JSON, SQL, XML, YAML, & CSV format.

CountryStateCity's website screenshot

About CountryStateCity

CountryStateCity provides a REST and GraphQL API delivering geographic data covering 250+ countries, 5,300+ states and regions, and 153,800+ cities. Data is served in structured JSON, with example endpoints such as retrieving the states within a given country. The company reports over 5.1 billion total API requests, more than 50,000 developers using the service, and a 99.9% uptime figure, with sub-200ms response times.

Beyond the core API, the product suite includes an Export Tool for downloading datasets in CSV, JSON, or SQL formats, a CLI tool for searching and generating code from the geographic data, an open-source database repository available via NPM and PyPI with 12 export formats, and an Update Tool for submitting data corrections or contributions. The core database is licensed under ODbL-1.0, while the packages are MIT licensed.

The service is aimed at developers and businesses building location-aware applications, such as address forms, location pickers, or geographic analysis features, who need country, state, and city reference data without maintaining it themselves.

Key features

  • REST and GraphQL API access to 250+ countries, 5.3K+ states, and 153.8K+ cities
  • Sub-200ms response times with 99.9% uptime backed by a global CDN
  • Export tool for downloading datasets in CSV, JSON, or SQL
  • CLI tool to search, explore, and generate code from geographic data
  • Open-source database repository available via NPM, PyPI, and CLI with 12 export formats
  • Weekly data updates with community-driven contributions and validation

Frequently asked questions

Is there a free tier?

Yes, you can get started for free, and the Export Tool offers free and paid formats.

What data does the API cover?

It covers 250+ countries, 5.3K+ states and regions, and 153.8K+ cities.

How is the API accessed?

Data is accessed via authenticated REST and GraphQL endpoints, for example using an X-CSCAPI-KEY header.

Is the underlying data open source?

Yes, the core database is ODbL-1.0 licensed and open source, while the packages are MIT licensed and available via NPM, PyPI, and CLI.

Who is this for?

It's aimed at developers building location-aware apps, analysts, and businesses needing accurate country, state, and city data.

Ad
Webz.io News API favicon

Webz.io News API

Webz.io News APIs provide global news data for search, monitoring, analytics, and AI applications, with powerful filters and natural-language search.

Learn more
Ad
SerpApi - Search API favicon

SerpApi - Search API

SerpApi's Search API makes it easy and fast to scrape Google and other search engines.

Learn more

Featured products

  • SerpApi - Search API favicon
  • Webz.io News API favicon

Show your product to thousands of developers

· 100k monthly pageviews
· 7k newsletter subscribers

Advertise your product