Skip to main content
GET
Get counties of a country
County endpoints use the usual API key and count toward your request quota. Basic lookups are available on every standard REST plan. Supporter+ adds coordinates, source classification, population, translations and Wikidata fields. Use an ISO2 country code (for example NZ) or numeric country ID. State paths use the state’s code. County IDs must be positive safe integers. Unknown country, state or county details return 404; a valid country/state with no counties returns an empty array. REST lists return complete arrays, ordered by name then ID unless you request another supported sort.

Counties spanning several states

A county may have no single primary state. Preserve state_id: null and state_code: null and use its states array, which contains every known source membership as {id, name, code}. An empty array means no state link is recorded. Filtering by one state still returns the complete membership array. For example, the source release installed on 24 November 2026 links Taupō District (14024, New Zealand) to four states. It appears in all four state lists; it is not duplicated within any one list. Do not assign it a primary state based on the first array item. Source state/region terminology varies by country.

Fields and access

IDs and population counts are serialized as strings; coordinates are nullable strings. Translations use the existing JSON-encoded string format. Use ?locale= and ?include_translations=true for localized output. ?fields= and ?sort= require Starter+. County sortable fields are id, name, country_code, state_code, type, population, latitude and longitude, subject to your field access. Substring search ?q= also requires Starter+ (2–100 characters) and matches county names. Search, field selection and sort do not change the source membership array.

City relationships

City responses at coordinates/full access include nullable county_id, including city lists, nearby/fuzzy results and GraphQL. Basic city responses keep id, name and kind. A missing county link stays null; the API does not infer it from a city name, postcode or location. County city lists return the existing city shape with its tier rules and support ?kind=, eligible ?type=, ?q=, ?fields=, ?sort= and localization. A county with no linked cities returns []. County coverage is country-dependent and not an exhaustive worldwide administrative boundary service. Responses include ETag, X-Cache and Cache-Control; conditional requests with If-None-Match can return 304. Data-only source updates refresh these caches through the same geographic import process.

GraphQL

On Professional+ (or a custom plan with GraphQL enabled), use counties, county and countyCities. Root lists default to 1,000 rows and support limit/offset; County.states defaults to 20 items and accepts the same paging arguments. The existing GraphQL resource budget applies.
The change feed still tracks countries, states and cities. City county_id participates in city snapshots on subsequent publication; county entity changes are not included in that feed.

Authorizations

X-CSCAPI-KEY
string
header
required

API key for authentication. Get your free key at app.countrystatecity.in.

Path Parameters

ciso
string
required

ISO2 country code or numeric country ID.

Example:

"NZ"

Query Parameters

q
string

Case-insensitive substring match on the English name. Requires Starter+, 2–100 characters.

Required string length: 2 - 100
fields
string

Comma-separated list of fields to include in the response. id is always included. Requires Starter+ plan.

sort
string

County sort: id, name, country_code, state_code, type, population, latitude, longitude. Starter+; fields must be available on your data access level.

locale
string

BCP 47 locale code (e.g. pt-BR) to request a localized name. Adds localized_name (resolved via exact locale → base language → native name → English name fallback) and matched_locale (which tier matched) to each result; name is unaffected. Supporter+ plans only — silently omitted (not an error) on lower tiers. A malformed value is rejected with a 400 on every tier.

Required string length: 2 - 7
Pattern: ^[a-zA-Z]{2}(-[a-zA-Z]{2,4})?$
include_translations
boolean
default:false

When true, includes the full translations field (JSON string keyed by language code). Supporter+ plans only — silently omitted (not an error) on lower tiers. Note that an explicit fields=translations also returns the field and takes precedence over this flag.

Response

Get counties of a country

id
string
required
Pattern: ^[0-9]+$
Example:

"14024"

name
string
required
Example:

"Taupō District"

country_id
string
required
Pattern: ^[0-9]+$
country_code
string
required
Example:

"NZ"

states
object[]
required

Complete source state memberships, including on state-filtered results. Empty when no state link is known.

state_id
string | null

Primary source state ID; can be null, including for counties spanning multiple states.

Pattern: ^[0-9]+$
state_code
string | null

Primary state code; preserve null instead of choosing the first state.

type
string | null

Coordinates/full access.

type_local
string | null

Coordinates/full access.

native
string | null

Coordinates/full access.

timezone
string | null

Coordinates/full access.

level
integer | null

Coordinates/full access.

parent_id
string | null

Coordinates/full access.

Pattern: ^[0-9]+$
population
string | null

Coordinates/full access.

Pattern: ^[0-9]+$
latitude
string | null

Numeric coordinate serialized as a string. Coordinates/full access.

longitude
string | null

Numeric coordinate serialized as a string. Coordinates/full access.

translations
string | null

Full access; localization/translation output follows the geographic endpoint query flags.

wikiDataId
string | null

Full access; localization/translation output follows the geographic endpoint query flags.

localized_name
string | null

Full access; localization/translation output follows the geographic endpoint query flags.

matched_locale
string | null

Full access; localization/translation output follows the geographic endpoint query flags.