Skip to main content
JavaScript & TypeScript Node.js Integrate Nigerian National Identification Number (NIN) verification into your Node.js applications using the official LumiID JavaScript SDK. The LumiID SDK provides a simple way to verify Nigerian identity information securely without manually handling HTTP requests. Create a client using your LumiID API key, submit an identity type and identification number, and retrieve the verification response. The SDK supports:
  • JavaScript
  • TypeScript
  • ESM (ECMAScript Modules)
  • CommonJS

What you need

Before getting started, ensure you have:
  • A valid LumiID API key.
  • A server-side Node.js application.
  • A valid test or production NIN.
  • Node.js and npm installed.
Security requirement NIN verification must be performed on your backend. Never expose your LumiID API key in browser code, frontend applications, or public repositories.

1. Install the SDK

Install the LumiID package using your preferred package manager. npm
yarn
pnpm

2. Configure your API key

Store your LumiID API key in an environment variable. Create a .env file:
Install dotenv if your application does not already load environment variables:
Load the environment variables in your application:
Never commit your .env file to version control.

3. Quick start

Verify a Nigerian NIN using the LumiID JavaScript SDK.

Verify a NIN

How it works:
  1. Import LumiID and LumiIDError.
  2. Initialize the SDK with your API key.
  3. Call client.verify() with the identity type and number.
  4. Check whether the response is an instance of LumiIDError.
  5. Process the successful verification response.
The NIN above is an illustrative example. Use an authorized test or production identity number in your integration.

4. Use TypeScript

The LumiID SDK includes TypeScript declarations, so you can integrate it into TypeScript applications without installing additional type packages.
The SDK ships with TypeScript declarations through:

5. Use CommonJS

For applications using CommonJS, import the SDK with require().

6. Handle verification errors

The SDK returns a LumiIDError instance when LumiID cannot complete a verification request. Always check the returned result before accessing the successful verification response.
This allows your application to distinguish between successful verification responses and verification request failures.

7. Production checklist

Before deploying your integration, ensure that:
  • Your API key is stored in a secure environment variable or secret manager.
  • User input is validated before submitting verification requests.
  • Verification requests are made exclusively from trusted server-side code.
  • NINs and sensitive identity information are excluded from application logs.
  • Verification errors are handled appropriately.
  • Your production environment uses the correct LumiID API credentials.

8. Frequently asked questions

Does the LumiID SDK support TypeScript? Yes. The package ships with TypeScript declarations in dist/index.d.ts. Can I use the SDK in frontend applications? No. The SDK requires a secret API key. Use it exclusively in trusted server-side environments such as Node.js backends. Which module systems are supported? The SDK supports both ESM and CommonJS.
  • ESM: import
  • CommonJS: require()
Do I need to make HTTP requests manually? No. The SDK provides the client.verify() method to submit NIN verification requests. Can I use the SDK with Express.js? Yes. You can initialize the LumiID client in your Express.js backend and expose your own authenticated API route to your frontend. Integrate identity verification into your applications with LumiID’s developer tools and APIs.