SDKs
node.js SDK
License API
31 min
provides a direct interface to the licensespring api https //docs licensespring com/license api/ the licenseapi class encapsulates api calls, input checks, authentication and signature verification typescript definitions are provided for the arguments and return types of the class methods to import the licenseapi class use const { licenseapi } = require('@licensespring/node sdk'); creating an instance const licenseapi = new licenseapi({ apikey '12345678 4bfe 4e3a 8737 757004d6294c', sharedkey 'eyuhrlajvivtisfixpxpkhw78f4ewy 00 12345678', appname 'js sdk test 1', appversion '0 0 1', / note the following properties are set to their default values by the sdk and can be overriden manually / // apipath 'http //api dev licensespring com/api/v4', // publickey ' ', }); the constructor takes the a single argument of the following type { / your licensespring api key / apikey string, / your licensespring api shared key / sharedkey string, / custom name for your application / appname string, / custom version string for your application / appversion string, / your air gap activation key (optional) / airgapkey? string, / override for license api url (default is https //api licensespring com/api/v4/) / apipath? string, / override for license api public key (default is pub key for api licensespring com) / publickey? string, / override for license file filename (default is "license") / filename? string, / override for license file path (default is current directory) / filepath? string, / override for license file encryption key / filekey? string, / override for license grace period duration in hours (default is 24) / graceperiod? number, / override for license file guard file (default is false) / isguardfileenabled? boolean, / override for hardware id calculation method (default is 0, for more info see "hardware id" section) / hardwareidmethod? number, / a custom provided hardware id (overrides hwid calculation) / hardwareid? string, } api methods for type declarations see type declarations https //www npmjs com/package/@licensespring/node sdk#types hardware id generates a hardware id https //www npmjs com/package/@licensespring/node sdk#hardware id this value is required for various api method calls if the optional argument is not provided, it defaults to the value set in the configuration object provided when instantiating the licensespringapi object if no value was provided in the config object, it defaults to 0 (the default hardware id method) gethardwareid(algorithm? hardwareidalgorithm) string check license see check license docid\ zh4kfih s59tzibzkeb9o checklicense( payload checklicensepayload, includeexpiredfeatures boolean = false ) promise\<checklicenseresponse> type checklicensepayload = ({ username string; } | { license key string; }) & { product string; hardware id string; env string | undefined; license id number | undefined; sdk ver string | undefined; app ver string | undefined; hostname string | undefined; os hostname string | undefined; ip local string | undefined; mac address string | undefined; ip string | undefined; os ver string | undefined; channel string | undefined; }; type checklicenseresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, borrowed until string | null, floating in use devices? number, is borrowed boolean, is expired boolean, license active boolean, license enabled boolean, license signature string, }; check license offline checks an offline license file checklicenseoffline(payloadbase64 string) promise\<licensefilepayload> type licensefilepayload = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, request string, active boolean, device id number, validity period string | null, is expired boolean, hardware id string, username? string, max license users? number, is floating cloud boolean, floating in use? boolean, license signature string, variables? ({ value string; device id number; variable string; created at string | null; })\[]; date string, offline signature string, date string, offline signature string, license signature v2 string, offline signature string, }; check bundle see check bundle docid\ odudsbu1bnxycgt4zx8fw checkbundle( payload checkbundlepayload, includeexpiredfeatures boolean = false ) promise\<checkbundleresponse> type checkbundlepayload = ({ username string; } | { license key string; }) & { product string; hardware id string; env string | undefined; license id number | undefined; sdk ver string | undefined; app ver string | undefined; hostname string | undefined; os hostname string | undefined; ip local string | undefined; mac address string | undefined; ip string | undefined; os ver string | undefined; channel string | undefined; }; type checkbundleresponse = checklicenseresponse\[]; // see checklicenseresponse declaration in "check license" section above check bundle offline checks an offline bundle license file checkbundleoffline(payloadbase64 string) promise\<record\<string, licensefilepayload>> // see licensefilepayload declaration in "check license offline" section above activate license online see activate license (online method) docid\ mt2ygm6cjzh2bumu gfww activatelicense(payload activatelicensepayload) promise\<activatelicenseresponse> type activatelicensepayload = ({ license key string; } | { username string; password string; } | { code string; customer account code string; } | { id token string; customer account code string; }) & { hardware id string; product string; variables { \[key string] string | number | boolean } | undefined; }; type activatelicenseresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, request string, active boolean, device id number, validity period string | null, is expired boolean, hardware id string, username? string, max license users? number, is floating cloud boolean, floating in use? boolean, license signature string, variables? ({ value string; device id number; variable string; created at string | null; })\[]; }; deactivate license online see deactivate license (online method) docid\ iecdueumoslwn4biictdc deactivatelicense(payload ({ username string; } | { license key string; }) & { product string; hardware id string; }) promise\<boolean> activate license offline see activate license (offline method) docid\ h vewme7ryj7qfbikvgup activateoffline(payload string) promise\<activateofflineresponse> type activateofflineresponse = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, request string, active boolean, device id number, validity period string | null, is expired boolean, hardware id string, username? string, max license users? number, is floating cloud boolean, floating in use? boolean, license signature string, variables? ({ value string; device id number; variable string; created at string | null; })\[]; date string, offline signature string, license signature v2 string, }; deactivate license offline see deactivate license (offline method) docid\ iyg1dxiyqp9vw mlj xuk deactivateoffline(payload string) promise\<boolean> activate bundle online see activate bundle (online method) docid\ sj4ujbbdqwmf3qjdvnhdh activatbundle(payload activatebundlepayload) promise\<activatebundleresponse> type activatebundlepayload = ({ license key string; } | { username string; password string; } | { code string; customer account code string; } | { id token string; customer account code string; }) & { hardware id string; product string; variables { \[key string] string | number | boolean } | undefined; }; type activatebundleresponse = activatelicenseresponse\[]; // see activatelicenseresponse in "activate license online" section above deactivate bundle online see deactivate bundle (online method) docid\ nzu6srynqlled2 hhvhr deactivatebundle(payload ({ username string; } | { license key string; }) & { product string; hardware id string; }) promise\<boolean> get trial key see trial key docid\ mtanosfyjyxu 2m0ovz a gettrialkey(payload gettrialkeypayload) promise\<trialresponse> type gettrialkeypayload = { sdk ver string | undefined; email string | undefined; license policy string | undefined; first name string | undefined; last name string | undefined; phone string | undefined; address string | undefined; postcode string | undefined; state string | undefined; country string | undefined; city string | undefined; reference string | undefined; company name string | undefined; hardware id string; product string; }; type trialresponse = trialexistingresponse | trialnewresponse; type trialexistingresponse = { license type licensetypes, is trial boolean, license string, } | { license type licensetypes, is trial boolean, license user string, }; type trialnewresponse = { id number; order id number; product id number; created at number; updated at number; active boolean; enable maintenance period boolean; enabled boolean; is floating boolean; is hardware key auth boolean; is trial boolean; license type licensetypes; maintenance duration string | null; max activations number; max transfers number; metadata string string | undefined; metadata jsonobjectrequired, prevent vm boolean; times activated number; trial days number; validity period? string; company { id number; }; licenseproductfeatures ({ id number; product feature id number; max consumption number; allow overages boolean; max overages number; reset consumption boolean; consumption period? consumptionperiod; is floating boolean; is floating cloud boolean; metadata jsonobjectrequired, metadata string? string; floating timeout? number; floating users? number; })\[]; licensecustomfields ({ product custom field id number; value string | undefined; })\[]; is floating cloud boolean; floating users number; floating timeout number; allow overages boolean; max overages number; max consumptions number; valid duration null; consumption period consumptionperiod | null; reset consumption? boolean; grace period number; allow grace period boolean; } & ({ license string; license key string; } | { license user string; initial password string; license user id number | null; max license users number; }); list licenses for user see licenses for user docid\ rp314ys1tvcymb99k7uuv getuserlicenses(payload getuserlicensespayload) promise\<getuserlicensesresponse> type getuserlicensespayload = ({ license key string; } | { username string; password string; } | { code string; customer account code string; } | { id token string; customer account code string; }) & { product? string; }; type getuserlicensesresponse = ({ license { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, license active boolean, license enabled boolean, }, user { id number, email string, first name string, is initial password boolean, last name string, phone number string, allow unlimited activations? boolean, max activations? number, total activations? number, }, })\[]; list license users for customer see list license users for customer docid\ m4gokma1pfwxadk0cglkl getcustomerlicenseusers(payload { product string; customer string; }) promise\<customerlicenseusersresponse> type customerlicenseusersresponse = { company { id number; }; customer customerresponse; users ({ email string | undefined; allow unlimited activations boolean; first name string; initial password string; is active boolean; is initial password boolean; last name string; license id number; max activations number; order id number; order store id string; phone number string; total activations number; })\[]; }; check license feature see license feature check docid\ nol8jafp0apia6di6w5vt checklicensefeature(payload checklicensefeaturepayload) promise\<checklicensefeatureresponse> type checklicensefeaturepayload = ({ license key string; } | { username string; }) & { license id number | undefined; sdk ver string | undefined; include metadata string boolean | undefined; hardware id string; product string; feature string; }; type checklicensefeatureresponse = { id number; license id number; code string; name string; metadata jsonobjectrequired, metadata string? string; is floating boolean; is floating cloud boolean; floating in use devices? number; expiry date string | null; feature type 'activation'; } | { id number; license id number; code string; name string; metadata jsonobjectrequired, metadata string? string; is floating boolean; is floating cloud boolean; floating in use devices? number; expiry date string | null; feature type 'consumption'; consumption period consumptionperiod; allow negative consumptions boolean; allow overages boolean; allow unlimited consumptions boolean; max consumption number; max overages number; reset consumption boolean; total consumptions number; }; add license consumption see add consumption docid\ srwb9sggwhqxqncym3tbi addconsumption(payload addconsumptionpayload) promise\<addconsumptionresponse> type addconsumptionpayload = ({ license key string; } | { username string; }) & { product string; hardware id string; consumptions number; sdk ver string | undefined; license id number | undefined; ignore events boolean | undefined; allow overages boolean | undefined; max overages number | undefined; event ("consumption add" | "offline floating consumptions sync")\[] | undefined; }; type addconsumptionresponse = { id number; max consumptions number; allow unlimited consumptions boolean; allow negative consumptions boolean; allow overages boolean; max overages number; reset consumption boolean; consumption period consumptionperiod | undefined; total consumptions number; company { id number; }; }; add license feature consumption see add feature consumption docid\ vp8t3phttdpq46i9yktff addfeatureconsumption(payload addfeatureconsumptionpayload) promise\<addfeatureconsumptionresponse> type addfeatureconsumptionpayload = ({ license key string; } | { username string; }) & { product string; hardware id string; consumptions number; feature string; sdk ver string | undefined; license id number | undefined; ignore events boolean | undefined; allow overages boolean | undefined; max overages number | undefined; event ("consumption add" | "offline floating consumptions sync")\[] | undefined; }; type addfeatureconsumptionresponse = { id number; license id number; company { id number; }; total consumptions number; max consumptions number; allow negative consumptions boolean; allow unlimited consumptions boolean; allow overages boolean; max overages number; reset consumption boolean; consumption period consumptionperiod; is floating boolean; is floating cloud boolean; floating timeout? number; floating users? number; }; get product details see get product details docid\ ar0igr0c1 dvx1yn044rr getproductdetails(payload productdetailspayload) promise\<getproductdetailsresponse> type productdetailspayload = { product string; include latest version boolean | undefined; include custom fields boolean | undefined; env string | undefined; }; type getproductdetailsresponse = { product id number, product name string, short code string, allow trial boolean, trial days number, authorization method authorizationmethod, floating timeout number, allow overages boolean, max overages number, prevent vm boolean, metadata jsonobjectrequired, metadata string? string, company { id number }, latest version? { id number; version string | undefined; full link string | undefined; filename string | undefined; release date string | null; hash md5 string | undefined; environment string; eula link string | undefined; release notes link string | undefined; size string | undefined; requires version string | undefined; channel string | undefined; created at string | null; updated at string | null; enabled boolean; product id number; } | null, custom fields? { id number, name string, default value string }\[] }; get device variables see get device variables docid\ zjvswpdxa3gr 9kiq0gng getdevicevariables(payload getdevicevariablespayload) promise\<getdevicevariablesresponse> type getdevicevariablespayload = ({ license key string; } | { username string; }) & { product string; hardware id string; sdk ver string | undefined; license id number | undefined; }; type getdevicevariablesresponse = { id number; created at string; variable? string; value? string; device id number; }\[]; track device variables see track device variables docid 9lcvdjjd nsjuu7uibeaa trackdevicevariables(payload trackdevicevariablespayload) promise\<trackdevicevariablesresponse> type trackdevicevariablespayload = ({ license key string; } | { username string; }) & { product string; hardware id string; variables { \[key string] string | number | boolean }, sdk ver string | undefined; license id number | undefined; }; type trackdevicevariablesresponse = { variable string; value string; device id number; created at number; }\[]; borrow floating license see borrow floating license docid\ sooypvnwqodzw1rtwyust floatingborrow(payload floatingborrowpayload) promise\<floatingborrowresponse> type floatingborrowpayload = ({ license key string; } | { username string; password string; }) & { product string; hardware id string; borrowed until string | null; sdk ver string | undefined; license id number | undefined; }; type floatingborrowresponse = { borrowed until string | null; max borrow time number; device id number; license id number; company { id number; }; }; release floating license see release floating license docid\ ac4qjdmmgxwjrzjv9mrru floatingrelease(payload floatingreleasepayload) promise\<boolean> type floatingreleasepayload = ({ license key string; } | { username string; }) & { product string; hardware id string; sdk ver string | undefined; license id number | undefined; }; release floating feature see release floating feature docid\ vysqav5zovsk4lj93xvdi featurerelease(payload floatingfeaturereleasepayload) promise\<boolean> type floatingfeaturereleasepayload = ({ license key string; } | { username string; }) & { product string; hardware id string; feature string; sdk ver string | undefined; license id number | undefined; }; change password see change password docid\ b4ixyzvah4talttuuajyi changepassword(payload { username string; password string; new password string; }) promise\<boolean> get product versions see get product versions docid\ mbq0ek4xlt jx8sldyhy9 getversions(payload getversionspayload) promise\<versionsresponse> type getversionspayload = ({ license key string; } | { username string; }) & { product string; hardware id string; sdk ver string | undefined; env string | undefined; channel string | undefined; }; type versionsresponse = ({ version string | undefined; release date string | null; })\[]; get product installation file see get installation file docid\ lxpe6kv olj7hll grl1q getinstallationfile(payload getinstallationfilepayload) promise\<installationfileresponse> type getinstallationfilepayload = ({ license key string; } | { username string; }) & { product string; hardware id string; sdk ver string | undefined; env string | undefined; channel string | undefined; version string | undefined; }; type installationfileresponse = { id number; version string | undefined; installation file string | undefined; release date string | null; hash md5 string | undefined; environment string; eula link string | undefined; release notes link string | undefined; size string | undefined; requires version string | undefined; channel string | undefined; company { id number; }; }; get single sign on url see single sign on url docid\ qbjwnphsdcs0l25uw6ptq getssourl(payload { response type 'token' | 'code' | undefined; product string; customer account code string; }) promise\<ssourlresponse> type ssourlresponse = { url string; openid configuration { \[key string] string | number | boolean; }; }; air gapped license code https //docs licensespring com/license entitlements/activation types/air gapped https //docs licensespring com/license entitlements/activation types/air gapped getairgapactivationcode( initializationcode string, licensekey string ) string verifyconfirmationcode( confirmationcode string, licensekey string, policyid? string ) boolean activateairgappedlicense( activationpayload offlineactivation, licensekey string, policyid string ) licensesaved type licensesaved = { id number, allow grace period boolean, allow overages boolean, allow unlimited activations boolean, allow offline activation boolean, can borrow boolean, custom fields customfield\[], customer customerresponse, enable maintenance period boolean, floating timeout number, floating users? number, grace period number | null, is air gapped boolean, is floating boolean, is floating cloud boolean, is hardware key auth boolean, license key string | undefined, license template id? number, maintenance period string | null, max activations number, max borrow time number, max license users? number, max overages number, max transfers? number, metadata jsonobjectrequired, metadata string? string, order store id? string, prevent vm boolean, company { id number, }, product details? productdetailsresponse, product features featureresponse\[], start date string | null, times activated number, transfer count number, validity period string | null, is trial boolean, trial days? number, user? licenseuserresponse, license type licensetypes, allow negative consumptions? boolean, allow unlimited consumptions? boolean, consumption period? 'daily' | 'weekly' | 'monthly' | 'annually' | null, max consumptions? number, reset consumption? boolean, total consumptions? number, borrowed until string | null, floating in use devices? number, is borrowed boolean, is expired boolean, policy id string; };