Skip to content

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.

Finds states, LGAs and wards with typos, old spellings and accents. Guide

Try:
    Same query on the API →
    Use this in your code
    import { search } from "naija-data";
    import { searchWards } from "naija-data/wards";
    search("lagso", { limit: 8 }); // states and LGAs
    searchWards("anifowoshe"); // wards

    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", ... }

    Senate, 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 records
      lgaConstituencies("Ikeja", "Lagos"); // district + constituencies of an LGA
      constituencyLgas("FC236"); // LGAs in a constituency

      Check an account number (NUBAN)

      The CBN check digit catches a mistyped account number before you pay. Guide

      Try:

      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"); // true
      banksForNuban("0000014579"); // every bank it could belong to

      Validate a phone number

      Checked against the NCC's numbering plan, with the reason when a number cannot exist. Guide

      Try:
      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"

      Validate a plate number

      Standard and dealer formats from the National Road Traffic Regulations 2012. Guide

      Try:
      Use this in your code
      import { parsePlate, plateError } from "naija-data";
      parsePlate("kja 123 ab")?.display; // "KJA-123AB"
      plateError("AB-123-CD"); // "unknown_format"