Activate a node-locked license on a device. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. A `client` key may include `licensee` to claim an unassigned license.
Anonymous activation: If you omit hostId (or pass "N/A"), Keymint uses the reusable hostless slot "N/A" and returns that value in metadata.hostId. Subsequent anonymous activations for the same license reuse that slot; they do not create a new random host ID on every restart. This slot is not device binding and is shared by all hostless activations for the license.
For real device binding and node-locked licensing, provide a stable SDK-generated machine or installation identifier as hostId and persist it across app restarts. Pass the returned metadata.hostId back unchanged when re-activating or deactivating an anonymous activation.
Client-scoped keys may attach an anonymous buyer to the license during activation by passing licensee.
{
"productId": "YOUR_PRODUCT_ID",
"licenseKey": "A8E2K-9F1BC-3D4GH-7J2KM",
"hostId": "mac-studio-m2",
"licensee": {
"name": "Jane Doe",
"email": "jane@example.com"
}
}This is constrained to the license being activated:
customerId is never accepted from client-side activation requests.403 with errorCode: "licensee_not_allowed". If the existing customer with that email is disabled, activation returns the generic 401.402 subscription_required.licensee.name takes 3–255 characters and licensee.email a valid address of up to 320 characters.
A successful activation returns expirationDate: when the license expires, as an ISO 8601 date, or null if it never expires. Your app can use it to show the expiry date and the days remaining, with the same client key it uses to activate. No extra permission is needed.
const res = await activate(); // { code: 0, message: "License valid", expirationDate: "2027-03-01T00:00:00.000Z", ... }
const daysLeft = res.expirationDate
? Math.max(0, Math.ceil((new Date(res.expirationDate) - Date.now()) / 86_400_000))
: null; // null: never expiresStore the last expirationDate your app received. An expired license fails activation with the same generic error as an invalid key, which stops anyone from probing for valid keys. The stored date lets your app tell the user the license expired on that date, rather than calling the key invalid.
Authorization header.Use a unique value to safely retry this request without repeating its effects.
9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6dThe product ID. 22–256 characters.
The license key. 20–256 characters.
Stable device or installation identifier. Omit it (or send "N/A") to use the license's single shared hostless slot. 1–64 characters.
Optional human-readable device label. 1–64 characters.
Optional first-time licensee claim. Applies only while the license has no customer: Keymint reuses the workspace customer with this email or creates one (the workspace's plan must allow another customer). Ignored when the license already has a customer.
When the license expires (ISO 8601), or null if it never expires. Use it to show the days remaining; client keys need no extra permission.
Masked name of the assigned customer. Omitted when the license has no customer.
Masked email of the assigned customer. Omitted when the license has no customer.
The license metadata plus `hostId`: the host ID this activation was recorded under ("N/A" for hostless activations).
The ID of the product version associated with this license key
Present only when the license is tied to a product version.