Create Key

Please log in to get a personalized configuration!

This method allows you to create a new license key. The license can either be standalone or associated to a specific customer. It is also possible to add a new customer and associate it with the newly created license using NewCustomer parameter. If you would like to avoid duplicates based on the email, you can use the AddOrUseExistingCustomer parameter.

This method is accessed by https://app.cryptolens.io/api/key/CreateKey

Parameters

Parameter Description Remarks
ProductId the product id required
Period The number of days, from today, the license key should be valid. Note, you will still be able to activate keys that have "expired". You can enforce the expiration date in the client program. Please see Keys that don't expire tutorial. optional, 0 by default.
F1 The feature 1 (either true or false) optional. by default, it's "false"
F2 The feature 2 (either true or false) optional. by default, it's "false"
F3 The feature 3 (either true or false) optional. by default, it's "false"
F4 The feature 4 (either true or false) optional. by default, it's "false"
F5 The feature 5 (either true or false) optional. by default, it's "false"
F6 The feature 6 (either true or false) optional. by default, it's "false"
F7 The feature 7 (either true or false) optional. by default, it's "false"
F8 The feature 8 (either true or false) optional. by default, it's "false"
Notes Additional notes about the license key. Max. 500 chars. optional. by default, it's empty.
Block Blocks the key from being accessed by the Activation method. optional. by default, it's "false"
CustomerId The id of the customer that should be associated with this license key. optional. by default, it's null.
NewCustomer If set to true, you will be able to add the paramters that apply to Add Customer method to this method so that a customer is automatically created together with the license key. When setting this parameter to true, please ensure that CustomerId is not set to anything.Note: In addition to CreateKey permission, you also need to add 'AddCustomer' permission. optional. false by default.
AddOrUseExistingCustomer If set to true, this method will either associate the license with a new customer (if no customer with the specified email exists) or with an existing one (the customer whose email is the same as the 'Email' parameter of this method). Note: In addition to CreateKey permission, you also need to add 'AddCustomer' permission. The same idea applies as for the option 'NewCustomer', i.e. this method can be called with the same parameters as Add Customer method. If a customer already exists, the license will be associated with an existing customer whose email address equals to 'Email' parameter. Properties of an existing customer will not be updated. optional. false by default.
TrialActivation Enables or disables Trial activation optional. by default, it's "false"
MaxNoOfMachines In order to restrict the number of computers that can use the same key, you can set enable this feature by enter a number greater than zero. This number represents the maximum number of computers that can activate the key. optional. by default, it's "0"
AllowedMachines A list (separated by new lines) of machine codes that will be prioritized during key activation. optional. by default, it's null.
NoOfKeys The number of keys to generate. optional. 1 by default.
v Method version. optional. by default, it's 1.

Results

Case 1: If NoOfKeys is not specified or set to 1, the followig model will be returned. Note, if format=plaintext, only the key string is returned (read more about different media types here).

Parameter Description Remarks
Key The newly generated key returned if no error occurred.
CustomerId The customer id of the customer that was associated with the license key. returned if NewCustomer or AddOrUseExistingCustomer are set to true.
Result This is either 0(=success) or 1(=error). always returned
Message The message that provides additional information about the result. If it's a successful result, either null or the new key (if using SKGL) will be returned. Otherwise, in case of an error, a short message will be returned describing the error. always returned.

Case 2: If NoOfKeys is greater than 1, the followig model will be returned. Note, if format=plaintext, each license key string will be returned separated by new line (read more about different media types here).

Parameter Description Remarks
Keys A list of license keys that uses the same format as in Case 1. returned if no error occurred.
CustomerId The customer id of the customer that was associated with the license key. returned if NewCustomer or AddOrUseExistingCustomer are set to true.
Result This is either 0(=success) or 1(=error). always returned
Message The message that provides additional information about the result. If it's a successful result, either null or the new key (if using SKGL) will be returned. Otherwise, in case of an error, a short message will be returned describing the error. always returned.

Example results

{"key":"ABCDE-ABCDE-ABCDE-ABCDE","result":0,"message":""}
{"keys":[{"key":"ABCDE-ABCDE-ABCDE-ABCDE","result":0,"message":null},{"key":"ABCDE-ABCDE-ABCDE-ABCDE","result":0,"message":null}],"result":0,"message":null}

Remarks

  • This method will only generate at most 1K keys at a time, even if NoOfKeys is set to a higher value.

Errors

Error
Access denied.
The input parameters were incorrect.
The notes field cannot be more than 500 characters.
Could not find the product.
Could not find the customer.
Creation of a license with x day(s) is not possible in SKGL. The limit is 999 days.
Generating more than 99,999 keys is not possible in SKGL.
Access denied. Please add 'AddCustomer' permission.
;