←Home/Developer Platform/SDK Documentation
npmv1.1.0downloads434/weekminzipped1.34 kBlicenseMITZero DependenciesNepali (०-९) Digits

Official JavaScript & TypeScript SDK Documentation

The official zero-dependency client SDK for checking smart driving license print status via the mirrored Department of Transport Management (DOTM) database in Nepal. Works seamlessly across Node.js (18+), Bun, Deno, Next.js, Vite, React Native, and standard browsers.

1.Installation

Install from the official npm Registry or GitHub Packages.

$npm install nepal-license-checker

2.Quickstart & Usage

The core function checkLicense() validates, normalizes, and fetches print status.

import { checkLicense } from 'nepal-license-checker';

async function checkMyLicense() {
  // Supports English (01-01-12345678) or Nepali digits (०१-०१-१२३४५६७८)
  const result = await checkLicense('01-01-12345678', {
    apiKey: 'nlc_live_your_api_key_here', // Optional: unlocks 60 req/min
  });

  if (result.status === 'success') {
    if (result.isReady && result.data) {
      console.log('🎉 License is printed and ready for pickup!');
      console.log('Holder Name:', result.data.holder_name);
      console.log('Office:     ', result.data.office);
      console.log('Category:   ', result.data.category);
    } else {
      console.log('⏳ License is not yet printed by DOTM.');
    }
  } else {
    console.error('Error:', result.error);
    if (result.statusCode === 429) {
      console.log('Wait seconds before retrying:', result.retryAfter);
    }
  }
}

checkMyLicense();

3.API Key Authentication & Rate Limits

Unlock higher throughput for production apps and bots.

Public Anonymous Tier

15 req / min

Applied per client IP. If exceeded, a 5-minute spam lockout is applied. Ideal for individual manual lookups.

Developer API Key TierElevated

60 req / min

Key-based quota with zero lockout penalty. Returns RFC-compliant rate limit response headers.

Need an API Key?

Sign in with GitHub on our Developer Portal to generate up to 3 keys instantly.

Open Developer Portal →

4.Offline Utility Functions

These helpers run 100% locally with zero network calls and zero dependencies.

validateLicenseNumber(license: string): booleanOffline Regex

Validates whether a string matches the required Nepal driving license pattern XX-XX-XXXXXXXX. Seamlessly supports both English (0-9) and Nepali Devanagari numerals (०-९).

validateLicenseNumber('01-01-12345678');  // true
validateLicenseNumber('०१-०१-१२३४५६७८');  // true
validateLicenseNumber('12-34-5678');        // false
formatLicenseNumber(input: string): stringInput Masking

Formats raw numeric inputs into the standard hyphenated XX-XX-XXXXXXXX pattern. Perfect for form auto-formatting on user input.

formatLicenseNumber('010112345678');  // '01-01-12345678'
formatLicenseNumber('०१०११२३४५६७८');  // '01-01-12345678'
devanagariToAsciiDigits(str) / asciiToDevanagariDigits(str)Numeral Converter

Bidirectional numeral conversion between Nepali Devanagari (०-९) and Western ASCII (0-9).

devanagariToAsciiDigits('०१-०१-१२३४५६७८'); // '01-01-12345678'
asciiToDevanagariDigits('01-01-12345678'); // '०१-०१-१२३४५६७८'

5.Live Utilities Playground

Test how the offline SDK functions format and validate numbers in real-time.

Format Validity

Valid (XX-XX-XXXXXXXX)

ASCII Normalized

01-02-12345678

Devanagari Numerals

०१-०२-१२३४५६७८

Auto-Masked Output:

01-02-12345678

6.TypeScript Interfaces & Types

The package includes full .d.ts typings out of the box.

export interface LicenseData {
  holder_name: string;    // Full name of driver
  license_number: string; // Formatted license number
  office: string;         // Yatayat Karyalaya issued
  category: string;       // Categories (e.g. "A, B")
  createdAt: string;      // Indexed date timestamp
  updatedAt: string;      // Last sync date timestamp
}

export interface RateLimitInfo {
  limit?: number;         // Rate limit ceiling (e.g. 60)
  remaining?: number;     // Remaining requests in window
  reset?: number;         // Unix epoch reset timestamp
}

export type CheckLicenseResult =
  | {
      status: 'success';
      isReady: boolean;
      data: LicenseData | null;
      message?: string;
      statusCode: number;
      rateLimit?: RateLimitInfo;
    }
  | {
      status: 'error';
      isReady: false;
      data: null;
      error: string;
      retryAfter?: number;
      statusCode?: number;
      rateLimit?: RateLimitInfo;
    };

7.Direct HTTP REST API Reference

For applications written in Python, Go, PHP, Java, or Rust.

GEThttps://license-checker.acharyanischal.com.np/api/license
Parameter / HeaderTypeRequiredDescription
numberquery stringYesLicense number in XX-XX-XXXXXXXX format
x-api-keyheaderOptionalDeveloper key for 60 req/min rate limit quota
AuthorizationheaderOptionalBearer <apiKey> alternative
Export Schema & CollectionsImport into Postman, Insomnia, Swagger UI, or Bruno: