Skip to content

Quickstart

Get from zero to a validated license key in under 5 minutes. You’ll need a Lizen account — sign up free, no card required.


What you’ll build

By the end of this guide, your app will:

  1. Call POST /v1/validate with a license key and device fingerprint
  2. Receive { "valid": true } back in under 10ms
  3. Quit (or continue, your choice) based on the result

  1. Create a product

    In the dashboard, go to Products → Create product. Give it a name (e.g. “My Desktop App”) and a slug. This groups your license keys.

  2. Generate a license key

    Go to Keys → Create key, pick your product, and set an activation limit (how many devices can run the app simultaneously). Copy the full key — it’s shown once.

    Your key looks like: MYAPP-ABCD-EFGH-IJKL

  3. Install the SDK

    Terminal window
    npm install @lizen/sdk
  4. Add validation to your app

    Call validate at startup. Pass the stored license key and a stable device fingerprint (SHA-256 of machine ID, MAC address, or similar).

    import { Lizen } from '@lizen/sdk';
    const lizen = new Lizen({ apiKey: process.env.LIZEN_API_KEY! });
    const result = await lizen.validate({
    key: storedLicenseKey,
    deviceFingerprint: getMachineId(), // SHA-256 of stable device identifier
    });
    if (!result.valid) {
    console.error('License invalid:', result.reason);
    app.quit();
    }
  5. Store your API key securely

    Get your API key from Settings → API Keys. Store it as an environment variable — never ship it inside your app binary.

    Terminal window
    LIZEN_API_KEY=lz_your_key_here

What happens on validation

When validate is called:

  1. Lizen checks a KV edge cache — if the key was validated recently, the response is served in under 1ms.
  2. On cache miss, D1 is queried: key status, expiry, and activation limit are checked.
  3. If the device fingerprint hasn’t been seen before, it’s recorded as a new activation.
  4. The result is returned and the cache is populated.

Result shape

// Valid key
{
valid: true,
plan: 'pro',
activationsUsed: 1,
activationLimit: 3,
expiresAt: '2027-08-16T12:00:00Z', // null if perpetual
}
// Invalid key
{
valid: false,
reason: 'revoked', // 'not_found' | 'expired' | 'revoked' | 'activation_limit'
}

Next steps