Getting Started with QuantumLock™
Get your first license working in 5 minutes.
Step 1: Get Your API Key
- Go to portal.softquantus.com
- Sign up or log in
- Navigate to Settings → API Keys
- Click Create New Key
- Copy your API key (starts with
ql_)
⚠️ Keep your API key secret! Never expose it in client-side code.
Step 2: Choose Your Integration Method
Option A: Python SDK (Recommended)
Best for Python applications.
# Install the SDK
pip install quantumlock-sdk
from quantumlock_sdk import QuantumLockClient
# Initialize
client = QuantumLockClient(api_key="ql_your_api_key")
# Create a license
artifact = client.create_license(
subject="customer:acme-corp",
product="MyApp",
tier="PRO",
features=["feature:api", "feature:export"],
valid_days=365
)
print(f"License ID: {artifact.license_id}")
print(f"Compact Token: {artifact.compact[:50]}...")
Option B: REST API
Best for any programming language.
# Create a license
curl -X POST "https://quantumlock.softquantus.com/api/v1/v2/artifacts" \
-H "Authorization: Bearer ql_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"subject": "customer:acme-corp",
"days_valid": 365,
"entitlements": [
{"id": "feature:api", "type": "feature", "value": true},
{"id": "seats:max", "type": "quantity", "value": 10}
]
}'
Option C: CLI Tool
Best for administrators and automation.
# Configure CLI
quantumlock configure --api-key ql_your_api_key
# Generate license
quantumlock generate \
--subject "customer:acme-corp" \
--product "MyApp" \
--tier "PRO" \
--days 365
# Validate license
quantumlock validate --file license.qlf
Step 3: Validate Licenses in Your App
Python SDK Validation
from quantumlock_sdk import QuantumLockClient
client = QuantumLockClient(api_key="ql_your_api_key")
# Validate a license token
result = client.validate(compact_token="eyJ0eXAiOi...")
if result.is_valid:
print("✅ License is valid!")
print(f" Entitlements: {result.entitlements}")
print(f" Expires: {result.expires_at}")
else:
print(f"❌ License invalid: {result.error}")
REST API Validation
curl -X POST "https://quantumlock.softquantus.com/api/v1/v2/validate" \
-H "Authorization: Bearer ql_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"artifact_compact": "eyJ0eXAiOi..."
}'
Step 4: Handle License States
Your application should handle these license states:
| State | Description | Action |
|---|---|---|
valid | License is active | Allow access |
expired | Past expiration date | Prompt renewal |
grace_period | In grace period after expiration | Show warning, allow access |
revoked | Administratively revoked | Block access |
not_yet_valid | Before activation date | Show countdown |
result = client.validate(compact_token=token)
match result.status:
case "valid":
allow_access()
case "grace_period":
show_renewal_warning()
allow_access()
case "expired":
show_renewal_required()
block_access()
case "revoked":
show_revoked_message()
block_access()
Step 5: Offline & Hybrid Validation (Recommended)
For applications that need to work without constant internet connection, use the HybridLicenseValidator:
Benefits of Hybrid Validation
- ⚡ Instant startup - Validates offline first (< 5ms)
- 🔄 Background sync - Checks revocation without blocking
- 📶 Works offline - Grace period of 7 days without internet
- 🔔 Callbacks - Get notified when license is revoked
Basic Usage
from quantumlock.sdk import HybridLicenseValidator
# Initialize (loads config from environment)
validator = HybridLicenseValidator()
# Validate (instant, offline-first)
result = validator.validate()
if result.is_valid:
print("✅ License valid!")
print(f" Customer: {result.customer_name}")
print(f" Features: {result.features}")
run_application()
else:
print(f"❌ {result.message}")
show_license_dialog()
Environment Configuration
# Required: Path to license file
export QUANTUMLOCK_LICENSE_PATH=/path/to/license.qlicense
# Optional: API for background sync
export QUANTUMLOCK_API_URL=https://quantumlock.softquantus.com
export QUANTUMLOCK_API_KEY=ql_your_api_key
# Optional: Validation mode
export QUANTUMLOCK_MODE=hybrid # offline, online, or hybrid
With Context Manager
from quantumlock.sdk import HybridLicenseValidator, LicenseError
try:
with HybridLicenseValidator() as validator:
# License validated, background sync started
run_my_application()
except LicenseError as e:
print(f"License error: {e}")
show_purchase_dialog()
Protect Functions with Decorator
from quantumlock.sdk import HybridLicenseValidator
validator = HybridLicenseValidator()
@validator.require_license(features=["premium"])
def premium_feature():
"""Only runs if license has 'premium' feature"""
return expensive_computation()
Handle License Events
from quantumlock.sdk import HybridLicenseValidator
validator = HybridLicenseValidator()
# Called when license is revoked remotely
@validator.on_revoked
def handle_revocation(result):
show_revoked_dialog()
disable_premium_features()
# Called when entering grace period
@validator.on_grace_period
def handle_grace(result):
show_reconnect_warning(result.grace_period_ends)
result = validator.validate()
Next Steps
- 📘 API Reference - Complete API documentation
- 🐍 SDK Reference - Python SDK deep dive
- 🔒 Security Guide - Security best practices
- 📋 License Models - Subscription vs perpetual
Need Help?
- 💬 Live Chat: Available in the portal (Business+ plans)
- 📧 Email: support@softquantus.com
- 📚 FAQ: Frequently Asked Questions