New: Offline-first licensing with cryptographic validation. Learn more

Create Your First License

This guide walks you through creating your first license using both the dashboard and CLI, then validating it in your application.

Prerequisites

Option 1: Using the Dashboard

The dashboard provides a visual interface for creating and managing licenses.

Step 1: Navigate to Licenses

Log into the Licenz dashboard and select your product from the sidebar. Click on Licenses in the navigation menu.

Step 2: Create New License

Click the Create License button in the top right corner. You'll see a form with the following fields:

  • Customer Email - The email address of your customer
  • License Type - Choose from perpetual, subscription, or trial
  • Expiration Date - When the license expires (optional for perpetual)
  • Features - Select which features to enable
  • Max Activations - Limit how many machines can use this license

Step 3: Copy the License Key

After creating the license, you'll see the generated license key. Copy this key and send it to your customer. The key format is: LIC-XXXX-XXXX-XXXX-XXXX

Tip: Customer Portal

Enable the customer portal to let customers manage their own licenses, view activation status, and download license files directly.

Option 2: Using the CLI

For automation and scripting, use the Licenz CLI to create licenses programmatically.

Authenticate the CLI

First, authenticate with your API key:

# Set your API key
export LICENZ_API_KEY=sk_live_your_api_key

# Or authenticate interactively
licenz auth login

Create a License

# Create your first license
licenz license create \
  --product prod_abc123 \
  --email john@example.com \
  --type perpetual \
  --features "pro,api-access"

# Output:
# License created successfully!
# Key: LIC-XXXX-XXXX-XXXX-XXXX
# Type: perpetual
# Features: pro, api-access

Common CLI Options

Option Description Example
--type License type perpetual, subscription, trial
--expires Expiration date 2025-12-31
--features Comma-separated features "pro,api,export"
--max-activations Maximum activations 3
--metadata Custom JSON metadata '{company":"Acme}'

Validating the License

Once you've created a license, integrate validation into your application:

use licenz::{License, Verifier, PublicKey};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Load your public key (embedded at compile time)
    let public_key = PublicKey::from_pem(include_str!("public_key.pem"))?;
    let verifier = Verifier::new(public_key);

    // Get license key from your customer
    let license_key = "LIC-XXXX-XXXX-XXXX-XXXX";
    let license = License::from_key(license_key)?;

    // Validate the license
    let result = verifier.verify(&license)?;

    if result.is_active() {
        println!("Welcome! License valid until: {:?}", result.expires_at());
        println!("Enabled features: {:?}", result.features());
    } else {
        println!("License is not active");
    }

    Ok(())
}

Testing Your Integration

Use test licenses to verify your integration before going live:

# Create a test license (doesn't count against your quota)
licenz license create --product prod_abc123 --test

# List all test licenses
licenz license list --test-only

# Revoke a test license
licenz license revoke LIC-TEST-XXXX-XXXX --test

You're all set!

You've created your first license and learned how to validate it. Next, explore advanced features like hardware binding and offline activation.

Next Steps