API — Sri Lanka (LK)
9 provinces, 25 districts, 339 divisional secretariats, 14,043 gn divisions.
Endpoints
GET
/api/v1/lk/dsd.json
All 339 divisional secretariats (ප්රාදේශීය ලේකම් කොට්ඨාශය)
GET
/api/v1/lk/province/{slug}.json
Single province with children
Example:
/api/v1/lk/province/central-lk2.json
Quick Start
JavaScript
fetch('https://openadmindata.org/api/v1/countries/lk.json')
.then(r => r.json())
.then(data => {
const levels = data.meta.levels.map(l => l.name_en);
console.log('Sri Lanka:', levels.join(' → '));
console.log(data.data.province.length, 'provinces');
});
Python
import requests
data = requests.get('https://openadmindata.org/api/v1/countries/lk.json').json()
provinces = data['data']['province']
print(f"Sri Lanka: {len(provinces)} provinces")
cURL
curl -s https://openadmindata.org/api/v1/lk/province.json | jq '.count'
Schema
Each entity record contains:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
name_local | string | Name in local script |
name_en | string | English / romanized name |
slug | string | URL-safe slug |
lat | number | Latitude (WGS84) |
lon | number | Longitude (WGS84) |
parent_id | string? | Parent entity ID (null for top level) |
parent_name_local | string? | Parent name in local script |
parent_name_en | string? | Parent English name |
postal_code | string? | Postal code (deepest level only, where available) |