nigeria-api nigeria-states nigeria-lga naija-locations geolocation-api address-autocomplete nigeria-regions restful-api postman-ready developer-tool africa-api json-api open-data nigeria-geodata
# Nigeria States & LGA API 🌍
A lightweight REST API providing all Nigerian states, Local Government Areas (LGAs), and country/state relationships in JSON format. Perfect for address forms, location-based apps, and data validation.
## 🔑 Features
* Get all **countries** (with Nigeria as default focus).
* Fetch all **36 Nigerian states** + FCT.
* Retrieve **LGAs by state** (e.g., Lagos, Kano, Rivers).
* Fast, scalable, and developer-friendly JSON responses.
## 📚 API Endpoints
### **Location Data**
| Endpoint | Method | Description |
| ----- | ----- | ----- |
| `/api/v1/location/countries` | `GET` | Get all supported countries |
| `/api/v1/location/states` | `GET` | Get all states in Nigeria |
| `/api/v1/location/states/{country_id}` | `GET` | Get states by country ID |
| `/api/v1/location/lgas` | `GET` | Get all LGAs in Nigeria |
| `/api/v1/location/lgas/{state_id}` | `GET` | Get LGAs by state ID |
## 🚀 Usage Examples
### 1. Get all countries
```bash
GET /api/v1/location/countries
```
**Response:**
```bash
{
"data": [
{ "id": 1, "name": "Nigeria", "code": "NG" },
{ "id": 2, "name": "Ghana", "code": "GH" }
]
}
```
### 2. Get all Nigerian states
```bash
GET /api/v1/location/states
```
**Response:**
```bash
{
"data": [
{ "id": 1, "name": "Lagos", "country_id": 1 },
{ "id": 2, "name": "Kano", "country_id": 1 }
]
}
```
### 3. Get LGAs by state ID (e.g., Lagos)
```bash
GET /api/v1/location/lgas/1
```
**Response:**
```bash
{
"data": [
{ "id": 1, "name": "Agege", "state_id": 1 },
{ "id": 2, "name": "Alimosho", "state_id": 1 }
]
}
```
## 🛠 Setup (Local Development)
1. **Clone the repo:**
```bash
git clone
github.com
cd nigeria-states-lga-api
```
2. **Create and activate a virtual environment:**
```bash
python -m venv venv
# On Windows:
.\venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
```
3. **Install dependencies:**
```bash
pip install -r requirements.txt
```
6. **Run the serve …