# LicReg

## Register License

## Registers a license with TrialKey

<mark style="color:blue;">`GET`</mark> `https://signup.trialkey.ca/api/v2/LicReg`

This endpoint allows a trial or licensed user to verify their credentials for your application(s). Once logged in the [LicCheck](https://trialkey.gitbook.io/docs/trialkey-licensing/reference/api-reference/liccheck) API can be used to check information on their license.

Example URL:

/LicReg?AuthToken=a75774e6-7a4a-44d0-8fc7-9f51c293ea7d\&Domain=mydomain.com\&ProductCode=\<MY\_PRODUCT\_CODE>\&InstalledVersion=\<MY\_PRODUCT\_VERSION>

#### Query Parameters

| Name                                               | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Domain<mark style="color:red;">\*</mark>           | String | Your account domain (i.e. the mywebsite.com part of [www.mywebsite.com](http://www.mywebsite.com))                                                                                                                                                                                                                                                                                                 |
| HardwareFingerprintReq                             | String | *(Optional)* A hardware fingerprint that represents the user's machine which will be used to match against in future LicCheck() calls.  If this parameter is passed on registration then it must be passed on all subsequent LicCheck() calls.  Note that the **Require Hardware License** option in the product should be set in order to use this option.fy them or their products and licenses. |
| LockedToMachineName                                | String | *(Optional)* If passed, the license will be locked to the provided machine name.  If this parameter is passed on registration then it must be passed on all subsequent LicCheck() calls.                                                                                                                                                                                                           |
| AuthToken<mark style="color:red;">\*</mark>        | String | The AuthToken acquired from calling the DoLogin() API.                                                                                                                                                                                                                                                                                                                                             |
| ProductCode<mark style="color:red;">\*</mark>      | String | The ProductCode from your TrialKey dashboard that identifies the product a license is being registered for.                                                                                                                                                                                                                                                                                        |
| InstalledVersion<mark style="color:red;">\*</mark> | String | A string of your choosing that identifies the version of your software that is being registered.                                                                                                                                                                                                                                                                                                   |

{% tabs %}
{% tab title="200 Call succeeded, user is authenticated and AuthToken returned" %}

```javascript
{
    "name"="Wilson",
    "owner": {
        "id": "sha7891bikojbkreuy",
        "name": "Samuel Passet",
    "species": "Dog",}
    "breed": "Golden Retriever",
}
```

{% endtab %}

{% tab title="401 User not authenticated or error" %}

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Return Value:** If the license is successfully registered *without* the `HardwareFingerprintReq` parameter, then the call returns a string that represents a unique installation identifier in the format `a75774e6-7a4a-44d0-8fc7-9f51c293ea7d` called an InstallKey, which can then be stored by the application and used to check the license at any time via the LicCheck() API.

&#x20;

If the license is successfully registered *with* the `HardwareFingerprintReq` parameter, then the call returns a string that represents a unique hardware key identifier, which can then be stored by the application and passed to the LicCheck() API to check the license at any time via the LicCheck() API.

&#x20;

Although the response data returned is different depending on the above optional parameters were included, the `RetCode` of **2000** returned is the same for both calls.

&#x20;

If the any of the required parameters are not included in the call, then the call will return the text response `Insufficient data provided to perform the requested action` as well as a `RetCode` of **4000**.

&#x20;

If the can not be registered because there are no available licenses, then the call will return a text response of `No available licenses` and `RetCode` of **4010**.
{% endhint %}
