Skip to content

Datasets

Dataset endpoints return static JSON dataset files. Use them when you need the full dataset locally instead of paginated API responses.

Base path:

http
/v2/datasets

Endpoints

MethodPathDescription
GET/v2/datasets/{datasetFile}Download the latest dataset file
GET/v2/datasets/{datasetVersion}/{datasetFile}Download a versioned dataset file

Dataset Files

FileContains
provinces.jsonProvince records
districts.jsonDistrict records
municipalities.jsonMunicipality records
neighborhoods.jsonNeighborhood records
villages.jsonVillage records

Download Latest Dataset

http
GET /v2/datasets/{datasetFile}

Returns the latest available version of a dataset file.

Path Parameters

ParameterTypeDescription
datasetFilestringDataset filename. Allowed values: provinces.json, districts.json, municipalities.json, neighborhoods.json, villages.json

Request

bash
curl "https://api.turkiyeapi.dev/v2/datasets/provinces.json"

Response

The response body is a JSON array using the matching resource schema.

json
[
  {
    "id": 1,
    "name": "Adana"
  }
]

The example above shortens the object for readability.

Cache Headers

Latest dataset responses include:

HeaderDescription
Cache-Controlpublic, max-age=3600, stale-while-revalidate=86400
Content-Typeapplication/json; charset=utf-8
ETagDataset content validator
Last-ModifiedDataset modification date

If the request sends a matching If-None-Match header, the API returns 304 Not Modified.

Download Versioned Dataset

http
GET /v2/datasets/{datasetVersion}/{datasetFile}

Returns a specific dataset version. The current version is 2025.

Path Parameters

ParameterTypeDescription
datasetVersionstringDataset version. Current allowed value: 2025
datasetFilestringDataset filename. Allowed values: provinces.json, districts.json, municipalities.json, neighborhoods.json, villages.json

Request

bash
curl "https://api.turkiyeapi.dev/v2/datasets/2025/provinces.json"

Cache Headers

Versioned dataset responses include:

HeaderDescription
Cache-Controlpublic, max-age=31536000, immutable
Content-Typeapplication/json; charset=utf-8
ETagDataset content validator
Last-ModifiedDataset modification date

Common Errors

StatusCodeWhen it happens
400BAD_REQUESTPath parameter validation fails
404DATASET_NOT_FOUNDDataset file or version does not exist
429-Rate limit exceeded
500INTERNAL_SERVER_ERRORUnexpected server error

Error response:

json
{
  "error": {
    "code": "DATASET_NOT_FOUND",
    "message": "Dataset not found.",
    "status": 404
  }
}