Playground
Everything below runs the real naija-data JavaScript package in your browser: nothing you type is sent
anywhere. Click an example to try it, then open Use this in your code to copy the same call in JavaScript,
Python or the REST API.
Search places
Finds states, LGAs and wards with typos, old spellings and accents. Guide
Use this in your code
import { search } from "naija-data";import { searchWards } from "naija-data/wards";
search("lagso", { limit: 8 }); // states and LGAssearchWards("anifowoshe"); // wardsimport naija_data as ng
ng.search("lagso", limit=8)ng.search_wards("anifowoshe")curl "https://naija-data-api.asgatcreation.workers.dev/v1/search?q=lagso"curl "https://naija-data-api.asgatcreation.workers.dev/v1/search?q=anifowoshe&kinds=state,lga,ward"State → LGA → ward
The dependent dropdowns for registration and address forms. Build this form
Use this in your code
import { states, lgas } from "naija-data";import { wards } from "naija-data/wards";
states(); // 37 records: { code: "LA", name: "Lagos", ... }lgas("LA"); // Lagos LGAs: { code: "NG025011", name: "Ikeja", ... }wards("NG025011"); // Ikeja wards: { code: "24-11-01", name: "Anifowoshe/Ikeja", ... }import naija_data as ng
ng.states()ng.lgas("LA")ng.wards("NG025011")curl https://naija-data-api.asgatcreation.workers.dev/v1/statescurl https://naija-data-api.asgatcreation.workers.dev/v1/states/LA/lgascurl https://naija-data-api.asgatcreation.workers.dev/v1/lgas/NG025011/wardsSenate, House of Reps and House of Assembly
INEC's 109 senatorial districts, 360 federal constituencies and 990 state constituencies, with the LGAs in each. Guide
Use this in your code
import { federalConstituencies, lgaConstituencies, constituencyLgas } from "naija-data/constituencies";
federalConstituencies("Lagos"); // 24 recordslgaConstituencies("Ikeja", "Lagos"); // district + constituencies of an LGAconstituencyLgas("FC236"); // LGAs in a constituencyimport naija_data as ng
ng.federal_constituencies("Lagos")ng.lga_constituencies("Ikeja", "Lagos")ng.constituency_lgas("FC236")curl "https://naija-data-api.asgatcreation.workers.dev/v1/federal-constituencies?state=lagos"curl "https://naija-data-api.asgatcreation.workers.dev/v1/lgas/Ikeja/constituencies?state=Lagos"curl https://naija-data-api.asgatcreation.workers.dev/v1/constituencies/FC236/lgasCheck an account number (NUBAN)
The CBN check digit catches a mistyped account number before you pay. Guide
OPay, PalmPay and similar wallets are not in the list: they have no CBN bank code, and their account number is usually the phone number without its first 0, so the check digit does not apply to them. When an account number is also a valid mobile number, it is shown above.
Use this in your code
import { isValidNuban, banksForNuban } from "naija-data";
isValidNuban("0000014579", "first-bank"); // truebanksForNuban("0000014579"); // every bank it could belong toimport naija_data as ng
ng.is_valid_nuban("0000014579", "first-bank") # Trueng.banks_for_nuban("0000014579")curl "https://naija-data-api.asgatcreation.workers.dev/v1/validate/nuban?account=0000014579&bank=first-bank"curl "https://naija-data-api.asgatcreation.workers.dev/v1/validate/nuban?account=0000014579"Validate a phone number
Checked against the NCC's numbering plan, with the reason when a number cannot exist. Guide
Use this in your code
import { parsePhone, phoneError } from "naija-data";
parsePhone("0803 123 4567"); // { e164: "+2348031234567", type: "mobile", network: "MTN", ... }phoneError("0900 123 4567"); // "reserved"import naija_data as ng
ng.parse_phone("0803 123 4567")ng.phone_error("0900 123 4567") # 'reserved'curl https://naija-data-api.asgatcreation.workers.dev/v1/phone/08031234567Validate a plate number
Standard and dealer formats from the National Road Traffic Regulations 2012. Guide
Use this in your code
import { parsePlate, plateError } from "naija-data";
parsePlate("kja 123 ab")?.display; // "KJA-123AB"plateError("AB-123-CD"); // "unknown_format"import naija_data as ng
ng.parse_plate("kja 123 ab").display # 'KJA-123AB'ng.plate_error("AB-123-CD") # 'unknown_format'curl https://naija-data-api.asgatcreation.workers.dev/v1/plates/kja-123ab