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:
- Call
POST /v1/validatewith a license key and device fingerprint - Receive
{ "valid": true }back in under 10ms - Quit (or continue, your choice) based on the result
-
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.
-
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 -
Install the SDK
Terminal window npm install @lizen/sdkTerminal window pnpm add @lizen/sdkTerminal window yarn add @lizen/sdk -
Add validation to your app
Call
validateat 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();} -
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:
- Lizen checks a KV edge cache — if the key was validated recently, the response is served in under 1ms.
- On cache miss, D1 is queried: key status, expiry, and activation limit are checked.
- If the device fingerprint hasn’t been seen before, it’s recorded as a new activation.
- 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
- Offline activation — validate without internet
- Webhooks — get notified when keys are revoked
- API reference — full endpoint documentation
- TypeScript SDK — all available methods