> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Activate

> This method will perform a key activation, similar to Activate [Web API 2]. In contrast to key validation, key activation is not read only since it can change license key data depending on...

Assumed ModelVersion: 3 (highest documented version at generation time)

This method will perform a key activation, similar to [Activate \[Web API 2\]](https://app.cryptolens.io/docs/api/v2/Activate).
In contrast to key validation, key activation is not *read only* since it can change license key data depending on configurations such as
[trial activation](https://help.cryptolens.io/web-interface/trial-activation), etc.

If [trial activation](https://help.cryptolens.io/web-interface/trial-activation) is enabled, a key can be altered.
Information that is retrieved can be signed by the server to be able to keep validate keys without Internet connection. Please keep in mind that
the Feature lock can be used to restrict the fields that can be shown in the result (*fieldsToReturn*). More about this in [Remarks](/api-reference/generated/Activate#remarks).

This method is accessed by [https://api.cryptolens.io/api/key/Activate](https://api.cryptolens.io/api/key/Activate)

### Parameters

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| ProductId | the product id (=\*\*\[ProductId] \*\*) | required |
| Key | the serial key string | required |
| Sign | If true, the information inside the LiceseKey object will be signed. | optional. false by default. |
| MachineCode | The machine code (a string that identifies a device) for activation. | optional. empty string by default. |
| FriendlyName | Allows you to specify a friendy name for the activated device, for example the employee's email. Friendly name does not impact the number of active machine codes / seats, but it offers an easy way of linking a machine/seat with a user. For added security, you can HMAC hash this value. See [how friendly names behave on repeated activation](/api-reference/generated/Activate#why-does-changing-friendly-name-not-update-the-dashboard). | optional. empty string by default. |
| FieldsToReturn | An integer that allows you to restrict the information returned in the license key data object. | optional. 0 by default = all fields returned. |
| SignMethod | Specifies the format of the result and the way it should be signed. | optional. 0 by default. |
| Metadata | Includes [additional information](/api-reference/generated/Activate#metadata-fieldstoreturn=0) about the license key, such as number of activated devices, etc. | optional. false by default. |
| FloatingTimeInterval | When set to something greater than zero, floating licensing will be enabled. The time interval is then used to check that no more than the allowed number of machine codes (specified in *maximumNumberOfMachines*) have been activated in that time period (in seconds). Note, the machine code will have "floating:" appended in the beginning. | optional. 0 by default. |
| MaxOverdraft | When set to something greater than zero (and assuming *FloatingTimeInterval* is set too) floating licensing will permit a license overdraft (eg. activation will succeed even if *maximumNumberOfMachines* is reached). MaxOverdraft value specifies how much we can exceed the *maximumNumberOfMachines* value. Note, the machine code will have the following structure: if concurrent devices *maximumNumberOfMachines*: "floating:" appended in the beginning of each machine code. if concurrent devices *maximumNumberOfMachines* + MaxOverdraft: "floating-overdraft:" appended in the beginning of each machine code. | optional. 0 by default. |
| OSInfo | Additional OS related information (as a string) that will be registered as metadata in [Register Event](/api-reference/generated/RegisterEvent). | optional. null by default. |
| ModelVersion | The model that will be returned. In comparison to method version, this only affects what fields and information will be returned and does not impact the way the method works. A changelog can be found in the [end of this page](/api-reference/generated/Activate#model-versions). | optional. by default, it's 1. |
| v | Method version. | optional. by default, it's 1. |

### Results

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| LicenseKey | A LicenseKey object. The structure is described in [License Key](/api-reference/generated/Activate#license-key-fieldstoreturn=0) section. If **SignMethod** is set to 1, the [License Key](/api-reference/generated/Activate#license-key-fieldstoreturn=0) will be a string representation of the object converted into base64 (all DateTime fields are expressed as 64 bit integers in Unix time). | always returned |
| Signature | The signature of the base64 representation of the LicenseKey field (above). | returned if **SignMethod=1** |
| Metadata | Includes [additional information](/api-reference/generated/Activate#metadata-fieldstoreturn=0) about the license key, such as number of activated devices, etc. | returned if **Metadata=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. |

#### License Key (FieldsToReturn=0)

| **Parameter** | **Description** | **Remarks** | **Hide?** |
| - | - | - | - |
| ProductId | The ID of the product that this key belongs to. | always returned | |
| ID | The ID (within the product) of the license key. | depends on configuration | |
| Key | The license key string, eg. ABCDE-EFGHI-JKLMO-PQRST. | depends on configuration | |
| Created | The creation date of the license key. | always returned | |
| Expires | The expiration date of the license key. Note, it's optional and it's up to your program to interpret this. Please see [Key's that don't expire](https://help.cryptolens.io/web-interface/keys-that-dont-expire). | always returned | |
| Period | The duration of current license cycle eg. 30 days. Note, this is a static number and does not change automatically. | always returned | |
| F1 | The feature 1 of the license key. | always returned | |
| F2 | The feature 2 of the license key. | always returned | |
| F3 | The feature 3 of the license key. | always returned | |
| F4 | The feature 4 of the license key. | always returned | |
| F5 | The feature 5 of the license key. | always returned | |
| F6 | The feature 6 of the license key. | always returned | |
| F7 | The feature 7 of the license key. | always returned | |
| F8 | The feature 8 of the license key. | always returned | |
| Notes | The notes field of the license key. | depends on configuration | |
| Block | This will always be false. | always returned | |
| GlobalId | A unique identifier of the license key. It can, for instance, be used as a "ReferencerId" when creating a [data object(aka additional variables)](/api-reference/generated/DataObjectsIntro). | depends on configuration | |
| Customer | The entire [customer](/api-reference/generated/model/Customer) object assigned to this license key. | depends on configuration | |
| ActivatedMachines | A list of [Activation data](/api-reference/generated/model/ActivationData). It will include both node-locked and floating licenses. In the case of floating licenses, it will list all of the floating machines that have not expired, even if the *FloatingTimeInterval* is smaller. If you only want to see floating devices that would be permitted within a certain *FloatingTimeInterval*, then you can filter them as follows: **FloatingExpires** ≤ **UTCNow\.AddSeconds(FloatingTimeInterval)**. For more information on the difference between floating and node-locked licenses, please see [this article](https://help.cryptolens.io/faq#whats-the-difference-between-node-locked-vs-floating-licenses). | depends on configuration | |
| TrialActivation | Tells if [trial activation](https://help.cryptolens.io/web-interface/trial-activation) is enabled. | always returned | |
| MaxNoOfMachines | The maximum number of machines/devices that may activate this license. By setting this to 0, machine locking will be disabled and an unlimited number of devices will be able to activate the license. | depends on configuration | |
| AllowedMachines | Machine codes of those devices that will be prioritized during activation. Even if the limit is achieved, these will still be activated. **Note:** This is a legacy field and is no longer used. | depends on configuration | |
| DataObjects | A list of [Data objects](/api-reference/generated/model/DataObject), additional variables associated with the license key. | depends on configuration | |
| Reseller | The entire [reseller](/api-reference/generated/model/Reseller) object assigned to this license key. | depends on configuration | |
| SignDate | The DateTime when this activation file was signed. | always returned | |
| Signature | The signature of the all the fields above | Returned if **Sign=true**. | |

#### Metadata (FieldsToReturn=0)

You can hide metadata by checking.

| **Parameter** | **Description** | **Remarks** | **Hide?** |
| - | - | - | - |
| ActivatedMachines | The number of activated machines for this license key. | depends on configuration | |
| LicenseStatus | Additional information about the license key. It contains the following: **IsValid** - Either true or false, depending on if the license satisfies all conditions for being valid. **ReasonForInvalidity** - if a license is invalid, this will contain the reason (an integer). This can be decoded as follows: None = 0 Expired = 1 Blocked = 2 **Trial** - tells if the license is a trial, based on the feature definitions for the product **TimeLimited** - tells if the license is a time-limited / subscription, based on the feature definitions for the product **TimeLeft** - if the license key is time-limited, this field will contain the remaining number of days until it expires | depends on configuration | |
| UsedFloatingMachines | The number of active floating machine codes for a specific *FloatingTimeInterval*. **Tip:** If you want to find the number of unused machines, subtract this value from maxNumberOfMachines. If overdraft is used, you need to add the maxOverdraft value to maxNumberOfMachines. | depends on configuration | |
| Signature | The signature of the metadata object. | Returned if **sign=true**. | |

### Example results

If **SignMethod=0**

```text theme={null}
{"productId":1234,"licenseKey":{"id":1,"key":"AAAAA-AAAAA-AAAAA-AAAAA","created":"2015-08-27T00:00:00","expires":"2018-11-03T00:00:00","period":1023,"f1":true,"f2":false,"f3":false,"f4":false,"f5":false,"f6":false,"f7":false,"f8":false,"notes":"this key is used as an example in one of the test cases.","block":false,"globalId":24963,"customer":{"id":3,"name":"Bob","email":"bob@example.com","companyName":"SKM","created":"2015-09-04T16:11:14.453"},"activatedMachines":[{"mid":"5632812","ip":"10.1.1.1","time":"2016-03-25T18:56:34.647"},{"mid":"7632812","ip":"10.1.1.2","time":"2016-04-06T15:05:35.733"},{"mid":"85256631","ip":"10.1.1.5","time":"2016-04-07T22:18:26.673"}],"trialActivation":false,"maxNoOfMachines":10,"allowedMachines":"","dataObjects":[],"signDate":"2016-04-11T09:45:06","signature":null},"result":0,"message":""}
```

If **SignMethod=1**

```text theme={null}
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tPadobDO+eXDUZhBHQ==","result":0,"message":""}
```

### Remarks

* The feature lock value is used to store the *filedsToReturn* value. If you set a certain value in the feature lock, it will be prioritized higher than the *fieldsToReturn* parameter.
* To compute the value of the feature lock, please use the **Hide** column, for those fields that you want to omit in the result [above](/api-reference/generated/Activate#license-key-fieldstoreturn=0).
* If the *ActivatedMachines* is hidden, only the current machine code will be included (used during this particular activation). Otherwise, all machine codes will be included.
* This method will not work if **block** is set to true. Instead, you will first need to [Unblock](/api-reference/generated/UnblockKey) it.
* Hiding a column using the *filedsToReturn* does not remove the field from the result. It only removes the value of the field, for example by setting it to **null**.
* (For first time use) Before you proceed with signing, please visit [this page](https://app.cryptolens.io/User/Security) to generate your public/private key pair.
* The *SignMethod* currently supports two ways of returning the license key information and signing the content. **Linq Sign (0)** - The default option supported in the SKM Client API for.NET. Everything is returned as a JSON dictionary with a signature attached to the license key object.
* **String Sign (1)** - This option is tailored for cross platform applications and is the preferred way retrieving signed versions of the license key object. The license key is converted into a json string which is later stored in base64. This is then signed using RSA 2048 with SHA256.

Please note that in both cases, **Sign** has to be set to true if you want the license key to be signed.

### Errors

| **Error** |
| - |
| Access denied. |
| The input parameters were incorrect. |
| Could not find the product. |
| Could not find the key. |
| The key is blocked and cannot be accessed. |
| Cannot activate the new device as the limit has been reached. |

### Model Versions

This changelog lists changes to the returned fields for each model version.

3. This model has a few changes. First, we have added a **Reseller** object to the **LicenseKey**. Secondly, we have made sure that all node-locked and floating licenses are returned (unless field masking is used). We added **FloatingExpires** to **ActivatedMachines** so that you can check when the activation was set to expire (note, this value can be overridden when calling this method with a different *FloatingTimeInterval*).
4. Add **FriendlyName** to **ActivatedMachines** in the license key.
5. The original model.

### FAQ

#### Why does changing Friendly Name not update the dashboard?

Repeating a node-locked activation with the same `MachineCode` does not update the stored `FriendlyName`.
The name is stored when that device is first registered. A successful repeated activation therefore does not mean the dashboard name changed.

For example, register `YOUR_MACHINE_CODE` with `FriendlyName="Office laptop"`, then activate the same machine code
with `FriendlyName="Renamed laptop"`. Its stored node-locked name remains `Office laptop`.
A subsequent successful floating activation with the new name refreshes the stored floating-device name to `Renamed laptop`.

`FriendlyName` is a label. `MachineCode` identifies the device; changing the label does not change that identity or seat count.
Friendly names are included in activation responses using model versions 2 and 3. Selecting a newer response model does not make
repeated node-locked activation update the stored name.

#### Should I use Activate for daily checks and floating renewals?

Activate requires the Activate token permission. It registers a device when machine locking is enabled and acquires or renews a floating seat
when Maximum Number of Machines is greater than zero and FloatingTimeInterval is positive. Reuse the same MachineCode for renewals.
[GetKey](/api-reference/generated/GetKey) is a read-only lookup: it does not acquire or renew a seat.
Once-daily refresh is an application policy example, not a universal requirement. Floating processes must renew before their confirmed seat expires
and stop licensed work when that deadline arrives; a failed renewal does not extend it.
See the [floating lifecycle](https://help.cryptolens.io/licensing-models/floating#how-should-a-process-acquire-renew-and-release-a-seat).

#### Does a successful activation replace application validation?

No. Request a signed response with Sign=true and verify its signature, expected product and license identity, required features, blocking,
expiry under your application's policy, and machine binding where configured. Activate rejects blocked keys, but API success alone does not
enforce every application-specific condition. For cached responses, also check age from the signed timestamp; saving the file does not restart its allowance.
An explicit API rejection, invalid signature, or failed license check must not be overridden by an older cached response.
See the [validation checklist](https://help.cryptolens.io/examples/key-verification#does-a-successful-api-response-mean-the-license-is-valid)
and [offline verification flow](https://help.cryptolens.io/examples/offline-verification).
