Overview
This guide will walk you through setting up KeyBox and integrating it into your application. You’ll create your first client, project, and license, then validate it using the SDK of your choice.Time required: 10-15 minutesWhat you’ll need:
- Access to a KeyBox dashboard instance
- Node.js 18+, Python 3.10+, or .NET 8.0+
- Basic knowledge of your chosen language/framework
Step 1: Dashboard Setup
First, you’ll need to set up your client, project, and license in the KeyBox dashboard.Create an Account
Navigate to your KeyBox dashboard and create an account. After signing up, you’ll be redirected to the main dashboard.
If you’re self-hosting KeyBox, make sure you’ve deployed both the backend API and frontend dashboard. See Deployment Guide for details.
Create a Client
Clients represent your customers or end users who will receive licenses.
- Click Clients in the sidebar
- Click Add Client
- Enter the following details:
- Name: Your customer’s name (e.g., “Acme Corp”)
- Email: Customer’s email address
- Click Create
Each client can have multiple projects and licenses associated with them.
Create a Project
Projects represent the products or services you’re licensing (e.g., “Enterprise API”, “Desktop App Pro”).
- Click Projects in the sidebar
- Click Add Project
- Enter the following details:
- Project Name: Name of your product (e.g., “MyApp Enterprise”)
- Client: Select the client you just created
- Click Create
Generate a License
Now create a license key for your client’s project.
- Click Licenses in the sidebar
- Click Create License
- Configure the license:
- Client: Select your client
- Project: Select the project you created
- Duration: Choose duration (1-12 months)
- Services: Add any service identifiers (optional)
- Click Generate License
PENDING state and will activate when first used.Step 2: Choose Your SDK
Select the SDK that matches your application’s language and framework:- Node.js
- Python
- .NET
Perfect for Express APIs, Next.js applications, and Node.js CLIs.Requirements:
- Node.js 18 or higher
- Express.js (for web apps)
Step 3: Install the SDK
Install the KeyBox SDK for your chosen language:Step 4: Integrate the SDK
Add license protection to your application with just a few lines of code:Step 5: Set Environment Variables
Create a.env file in your project root to store the license key securely:
Step 6: Test Your Integration
Now let’s verify that everything is working correctly.Start your application
Run your application using your normal start command:You should see logs indicating successful license activation:
Verify license activation
Check your KeyBox dashboard:
- Navigate to Licenses
- Find your license in the list
- Verify the status changed from
PENDINGtoACTIVE - Check that a Machine ID is now displayed
The machine ID binds this license to the specific device where it was activated. This prevents unauthorized license sharing.
What Happens Next?
Your application is now protected by KeyBox! Here’s what’s happening behind the scenes:Automatic validation
The SDK automatically validates the license every 15 minutes in the background.
License monitoring
The validation daemon checks if the license is:
- Still in
ACTIVEstate - Not expired
- Not revoked
Testing License Revocation
To see license revocation in action:Revoke the license
In your KeyBox dashboard:
- Go to Licenses
- Find your test license
- Click the Revoke button
- Confirm the action
Advanced Integration Examples
Example 1: Custom Error Handling
Handle license errors gracefully with custom error messages:Example 2: Self-Hosted KeyBox
If you’re self-hosting KeyBox, specify your custom API URL:Troubleshooting
”License activation failed”
Check your license key
Check your license key
Verify that:
- The license key is correctly copied (no extra spaces)
- The environment variable is loaded correctly
- The key starts with
kb_
Check product name
Check product name
The
productName parameter must exactly match the project name in your dashboard (case-sensitive).Example: If your project is named “MyApp Enterprise”, use:Check network connectivity
Check network connectivity
Ensure your application can reach the KeyBox API:If you’re behind a firewall or proxy, make sure outbound HTTPS connections are allowed.
Check license status
Check license status
In your dashboard, verify the license is:
- Not expired
- Not revoked
- In
PENDINGorACTIVEstate
”License server did not return JSON”
This error indicates a network or connectivity issue:- Check the API URL - Make sure you’re using the correct endpoint
- Verify network access - Ensure your app can make HTTPS requests
- Check for proxy issues - Corporate proxies may intercept requests
- Self-hosted users - Verify your backend is running and accessible
App doesn’t shut down when license is revoked
- Wait for validation cycle - Changes take effect within 15 minutes
- Check logs - Look for validation errors in your console
- Verify revocation - Ensure the license shows as
REVOKEDin dashboard - Restart if needed - Force restart to trigger immediate validation
Next Steps
Congratulations! You’ve successfully integrated KeyBox into your application. Here’s what to explore next:Core Concepts
Learn how KeyBox works under the hood
Dashboard Guide
Master the KeyBox dashboard features
SDK Documentation
Dive deeper into SDK capabilities
API Reference
Explore the complete API documentation
Need Help?
GitHub Issues
Report bugs or request features
GitHub Discussions
Ask questions and share ideas