> For the complete documentation index, see [llms.txt](https://docs.lumiid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lumiid.com/api-integration/sdks/lumiid-javascript-sdk-or-nin-verification-for-node.js.md).

# LumiID JavaScript SDK | NIN Verification for Node.js

Use the LumiID JavaScript SDK for Nigerian NIN verification in Node.js applications.

Create a client with your API key. Then submit an identity type and number.

The package supports JavaScript, TypeScript, ESM, and CommonJS.

### What you need

Before you start, make sure you have:

* A LumiID API key.
* A server-side Node.js application.
* A valid test or production NIN.

Keep identity checks on your server. Never send your API key to a browser.

### Install the SDK

Install the package with your preferred package manager.

{% tabs %}
{% tab title="npm" %}

```bash
npm install lumiid
```

{% endtab %}

{% tab title="Yarn" %}

```bash
yarn add lumiid
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add lumiid
```

{% endtab %}
{% endtabs %}

Store your LumiID API key in an environment variable.

```bash
export LUMIID_API_KEY="your_api_key"
```

Never expose API keys in browser code or public repositories.

### Quick start

This example verifies a Nigerian National Identification Number (NIN).

### Verify a NIN

Import `LumiID`, create a client, then call `verify`.

```javascript
import { LumiID, LumiIDError } from "lumiid";

const client = new LumiID({
  apiKey: process.env.LUMIID_API_KEY,
});

const result = await client.verify({
  idType: "NIN",
  idNumber: "89184072280",
});

if (result instanceof LumiIDError) {
  console.error(result.response);
} else {
  console.log(result.response);
}
```

Replace the sample number with a valid NIN from your testing workflow.

For REST endpoints and response details, see the [NIN Verification API](/api-integration/government-verification/nin-verification-api-or-nigerian-national-id-lookup.md).

### Use TypeScript

The package includes TypeScript declarations. The same integration works without extra types.

```typescript
import { LumiID, LumiIDError } from "lumiid";

const client = new LumiID({
  apiKey: process.env.LUMIID_API_KEY,
});

const result = await client.verify({
  idType: "NIN",
  idNumber: "89184072280",
});

if (result instanceof LumiIDError) {
  console.error(result.response);
} else {
  console.log(result.response);
}
```

### Use CommonJS

Use `require` in CommonJS projects.

```javascript
const { LumiID, LumiIDError } = require("lumiid");

const client = new LumiID({
  apiKey: process.env.LUMIID_API_KEY,
});

const result = await client.verify({
  idType: "NIN",
  idNumber: "89184072280",
});

if (result instanceof LumiIDError) {
  console.error(result.response);
} else {
  console.log(result.response);
}
```

### Handle verification errors

`verify` returns a `LumiIDError` when LumiID cannot complete the request.

Check the result before accessing a successful verification response.

```javascript
const result = await client.verify({
  idType: "NIN",
  idNumber: "89184072280",
});

if (result instanceof LumiIDError) {
  console.error("Verification failed:", result.response);
  process.exitCode = 1;
} else {
  console.log("Verification succeeded:", result.response);
}
```

### Production checklist

* Store `LUMIID_API_KEY` in your deployment secret manager.
* Validate user input before submitting a verification request.
* Restrict logs containing NINs or verification responses.

### Keep credentials secure

* Load API keys from environment variables or a secret manager.
* Call the SDK only from trusted server-side code.
* Do not log identity numbers or full verification responses in production.

### Frequently asked questions

#### Does the SDK support TypeScript?

Yes. The package ships TypeScript declarations through `dist/index.d.ts`.

#### Can I use the SDK in frontend code?

Do not use it directly in frontend code. It requires a secret API key.

#### Which module systems work?

Use `import` for ESM projects. Use `require` for CommonJS projects.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lumiid.com/api-integration/sdks/lumiid-javascript-sdk-or-nin-verification-for-node.js.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
