How to Use the Keymint Node.js SDK for Fast License Management
If you’re building a Node.js app , whether it’s a desktop tool, CLI app, or SaaS backend, you need an easy, reliable way to manage license keys.
While you can use direct HTTP calls to the Keymint API, the official Keymint Node.js SDK makes it faster and safer by handling the heavy lifting for you. With prebuilt methods, type support, and standardized error handling, you can integrate licensing in minutes.
Why Use the SDK? Here’s why most developers prefer the SDK over raw API calls:
✅ Prebuilt methods for key creation, activation, and management
🔒 Type safety and autocomplete when using TypeScript
🚫 Fewer manual errors when handling requests and responses
⚡ Faster to implement and easier to maintain over time
Install the SDK Add the package to your project:
npm install keymint-nodejs
Make sure you have your Keymint access token, which you can generate from the Keymint dashboard.
Example: Create and Activate a License Key Initialize the SDK
import { KeyMintSDK } from "keymint-nodejs";
const sdk = new KeyMintSDK(process.env.KEYMINT_ACCESS_TOKEN);
Store your access token securely in an environment variable.
Create a License Key
async function createLicense() {
const response = await sdk.createKey({
productId: "your_product_id",
maxActivations: "5",
expiryDate: "2025-12-31T23:59:59Z",
newCustomer: { name: "Alice Example", email: "alice@example.com" },
metadata: { plan: "Pro" },
});
console.log("New license key:", response.key);
}
This creates a new license tied to a product and customer.
Activate a License
async function activateLicense(licenseKey: string) {
const response = await sdk.activateKey({
productId: "your_product_id",
licenseKey,
hostId: "device-1234",
deviceTag: "Alice’s MacBook",
});
console.log("Activation successful:", response.message);
}
This registers the license to a device or machine.
Deactivate or Manage Licenses You can also deactivate a device:
await sdk.deactivateKey({
productId: "your_product_id",
licenseKey,
hostId: "device-1234",
});
Block a key entirely:
await sdk.blockKey({
productId: "your_product_id",
licenseKey,
});
Or fetch license details:
const details = await sdk.getKey({
productId: "your_product_id",
licenseKey,
});
console.log("License details:", details.data.license);
Handle Errors Gracefully The SDK provides clear error objects:
try {
await sdk.activateKey(...);
} catch (error) {
console.error("Error:", error.message);
console.error("Code:", error.code);
console.error("Status:", error.status);
}
This makes it easier to troubleshoot and provide meaningful feedback to users.
Build Smarter with Keymint The keymint-nodejs SDK helps you:
Launch license management faster
Reduce maintenance overhead
Scale with confidence as your app grows
Whether you’re building indie software or scaling a SaaS platform, Keymint gives you the tools to protect your work and manage access smoothly.
Start integrating today and take full control over your licenses.