Examples
This page shows practical v2 workflows. Each example uses a small response shape so you can adapt the same pattern in frontend forms, backend services, scripts, or data pipelines.
Districts of İstanbul
İstanbul's province ID is 34. To list its districts:
curl "https://api.turkiyeapi.dev/v2/districts?provinceId=34&fields=id,name,population&sort=name"const response = await fetch(
'https://api.turkiyeapi.dev/v2/districts?provinceId=34&fields=id,name,population&sort=name'
);
const { data } = await response.json();
console.log(data);You can also use the nested endpoint:
curl "https://api.turkiyeapi.dev/v2/provinces/34/districts?fields=id,name,population"Use the collection query when you want to combine parent filtering with search, sort, or population filters.
Neighborhoods by Municipality
When a user selects a municipality, load neighborhoods with municipalityId.
curl "https://api.turkiyeapi.dev/v2/neighborhoods?municipalityId=937&fields=id,name,postalCode&sort=name&limit=100"This is useful for address forms:
Province -> District -> Municipality -> NeighborhoodIf you are already on a municipality detail page, the nested endpoint is also available:
curl "https://api.turkiyeapi.dev/v2/municipalities/937/neighborhoods?fields=id,name,postalCode"Province Picker
For a compact province selector, request only id and name:
curl "https://api.turkiyeapi.dev/v2/provinces?fields=id,name&sort=name&limit=100"The response still includes meta, so you can verify the dataset version used to populate the picker.
Districts in a Population Range
To find districts in İstanbul with population between 100000 and 500000:
curl "https://api.turkiyeapi.dev/v2/districts?provinceId=34&minPopulation=100000&maxPopulation=500000&fields=id,name,population&sort=-population"This pattern is useful for dashboards and reporting tools.
Municipalities by Type
To list town municipalities:
curl "https://api.turkiyeapi.dev/v2/municipalities?type=town&fields=id,name,provinceId,districtId,population&limit=50"Allowed municipality types are province_center, district_center, and town.
Resource Detail with Related Data
Use include for detail screens that need parent resources:
curl "https://api.turkiyeapi.dev/v2/neighborhoods/3?include=province,district,municipality"This returns the neighborhood plus its province, district, and municipality in one response.
Download a Static Dataset
If you need all province records locally:
curl "https://api.turkiyeapi.dev/v2/datasets/provinces.json"For a stable snapshot:
curl "https://api.turkiyeapi.dev/v2/datasets/2025/provinces.json"Use static files for full imports. Use API endpoints for filtered, paginated application workflows.
