# Licensing

Connectware requires a valid license key to operate. Each license key is uniquely tied to your instance and enables specific features based on your subscription. This section covers everything you need to know about obtaining, managing, and implementing your Connectware license.

For more information about available Connectware licenses, visit the [Cybus website](https://www.cybus.io/en/product/licenses/).

## License View

The **License View** displays information of your active Connectware license. Each time you start Connectware, the license is automatically validated over the Internet. If your Connectware installation does not have Internet access, you can upload a valid license file manually.

* To open the **License View**, select **System** > **System Status**, and click the **License** tab.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-f3bcf97a7c776a915364e087601bed6ea179790b%2Flicense-view-2.png?alt=media" alt=""><figcaption></figcaption></figure>

The following information are available:

* **License Name**
* **License Account**
* **Expiration Date**
* **License Class**
* **License ID**
* **License Status**

You can manually [refresh your license](#manually-refreshing-licenses-in-connectware) via the **Refresh License** button. You can [upload a new license file](#uploading-license-files-to-connectware) via the **Upload License File** button.

## Acquiring License Keys

The [Cybus Portal](https://portal.cybus.io/) allows you to generate and manage license keys for your Connectware installations. This guide walks you through accessing the portal and generating new license keys. Once generated, you'll use this key during the Connectware installation process.

**Prerequisites**

* Access to the Cybus Portal. Contact our [Sales team](mailto:sales@cybus.io) to obtain portal credentials if needed.

**Procedure**

1. Go to the [Cybus Portal](https://portal.cybus.io/).
2. Enter your **Username** and **Password**, and click **Sign in**.
3. Click **Licenses** in the menu to view all your available Connectware licenses.

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/Connectware-Licenses.png" alt="Available Connectware Licenses"><figcaption></figcaption></figure>

4. To obtain a new license key, click a license. We recommend to look for licenses marked as **No license key created yet**. You can use the **No license key** filter option to show only licenses without keys.

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/SelectLicense.png" alt="Select Licenses Connectware"><figcaption></figcaption></figure>

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/NoLicenseKey.png" alt="No License Key Connectware"><figcaption></figcaption></figure>

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/AllLicenses.png" alt="Download License Key Button"><figcaption></figcaption></figure>

4. Click **Download License Key** in the upper right corner.

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/Download-License.png" alt="Download License Key Button"><figcaption></figcaption></figure>

5. Add a description for your license and click **Generate License Key**.

{% hint style="info" %}
Your new license key will appear on screen. Make sure to copy and save it somewhere secure, as you won't be able to view it again after closing this window. If you lose the key, you'll need to generate a new one, which will invalidate the previous key - even if it's already in use.
{% endhint %}

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/GenerateLicenseKey1.png" alt="Description of License Connectware"><figcaption></figcaption></figure>

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/GenerateLicenseKey2.png" alt="Generate License Key Connectware"><figcaption></figcaption></figure>

<figure><img src="https://www.cybus.io/wp-content/uploads/2024/05/GenerateLicenseKey3.png" alt="Output of License Key Connectware"><figcaption></figcaption></figure>

**Result**: Once you have your license key safely stored, you can proceed with Connectware installation.

## Online License Validation

Connectware automatically validates your license during startup if it can reach the [Cybus Portal](https://portal.cybus.io/)) backend (`graphql-server.cybus.io`). When this connection is available, license updates occur automatically in the background. If the server cannot be reached, you must [manually update](#manually-refreshing-licenses-in-connectware) your Connectware license by uploading a new license file.

## Offline License Activation

If Connectware is not connected to the Internet, you must activate your license manually through an offline process. This requires:

1. Downloading a license file from the [Cybus Portal](https://portal.cybus.io/) via one of the following options:
   * [Downloading License Files via Installer Script](#downloading-license-files-via-installer-script)
   * [Downloading License File via Cybus Portal Website](#downloading-license-file-via-cybus-portal-website)
2. Uploading the license file into your offline Connectware installation.

### Downloading License Files

You can download license files via the installer script or via the [Cybus Portal](https://portal.cybus.io/).

#### Downloading License Files via Installer Script

If you installed Connectware using the `connectware-online-installer.sh` script, you can use the same script to download your license file by adding the `--download-license-file` command.

To download the license file, you'll need either:

1. Your original license key, which can be passed directly as a command-line option.
2. The path to your existing Connectware installation directory.

Once executed, the script will download your license file and display its filename. You can then use this file to activate your offline Connectware installation.

**Procedure**

* To download the license via the script with the license key (e.g. `ABCABCABC`,), do the following:

{% code lineNumbers="true" %}

```
./connectware-online-installer.sh --download-license-file -k ABCABCABC
```

{% endcode %}

* To download the license via the script using the Connectware installation directory (e.g. `/opt/connectware`), do the following:

{% code lineNumbers="true" %}

```
./connectware-online-installer.sh --download-license-file -d /opt/connectware
```

{% endcode %}

**Next step**: Transfer the downloaded license file to your Connectware host machine for activation. See [Uploading License Files to Connectware](#uploading-license-files-to-connectware).

#### Downloading License Files via the Cybus Portal

**Prerequisites**

* Login credentials for the [Cybus Portal](https://portal.cybus.io/).
* A running instance of Connectware that you want to activate.
* A valid license key that matches the one used during installation.

**Procedure**

1. Log in to portal.cybus.io. If you don't have login credentials, contact [sales@cybus.io](mailto:sales%40cybus.io).
2. Click **Licenses** and select your license.
3. Click the **Download License File** icon.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-5fe5832e77b92b77e160950bd764a99873888ffa%2Fportal-license-detail.png?alt=media" alt=""><figcaption></figcaption></figure>

3. In the **Download License File** dialog, do the following:
   1. In the **Connectware License Key** field, enter the license key of your Connectware instance.
   2. Click **Download License File**.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-f844e711c5433c2b630716e386ef5ae42a2aeb3a%2Fportal-download-license-file.png?alt=media" alt=""><figcaption></figcaption></figure>

**Next step**: Transfer the downloaded license file to your Connectware host machine for activation. See [Uploading License Files to Connectware](#uploading-license-files-to-connectware).

### Uploading License Files to Connectware

You can activate your Connectware installation by uploading your license file through either:

1. The `Cybus Connectware License Check` dialog at Connectware startup
2. The `Upload License File` option in Connectware
3. A REST endpoint with a command line client
4. Adding the license file via the `CYBUS_LICENSE_FILE` environment variable

#### Uploading License Files at the First Connectware Startup

When you first access a not yet activated Connectware through your web browser, the `Cybus Connectware License Check` dialog opens.

1. In the **Cybus Connectware License Check** dialog, click **Upload License File**.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-decf63349323a6bdd52886c869cb961a00fd38d0%2Fstartup-nolicense.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Select the license file you [downloaded earlier](#downloading-license-files).

**Result**: After a refresh the license file has been uploaded and validated. Your Connectware is now ready for productive use.

#### Updating your Connectware License

If your Connectware instance has already a running license that you want to update, you can do this via the Connectware user interface.

1. On the navigation panel, click **System**.
2. On the **System Status View**, click the **License** tab.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-c326cdf553f50af25617b4ecc065f4e5c36e3ff3%2Flicense-view.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Click **Upload License File** and select the license file that you want to upload.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-92bb83e2c5e7c124f7aed74c25abb13baa1a3a63%2Flicense-upload-button.png?alt=media" alt=""><figcaption></figcaption></figure>

**Result**: After a refresh the license file has been uploaded and validated. Your Connectware is now ready for productive use.

#### Uploading Licenses via REST API

You can upload your license using a REST API call from the command line. This method requires a REST client - we recommend using `curl`.

Here's how to make the request:

{% code lineNumbers="true" %}

```yaml
curl -X PUT --insecure -u <USERNAME>:<PASSWORD> -d 'payload=<LICENSE-FILE-CONTENT>' https://<HOSTNAME>:443/api/system/licensefile
```

{% endcode %}

Key details for the request:

* Replace `<USERNAME>:<PASSWORD>` with your credentials
* Insert your license file content as the `payload` value
* Update `<HOSTNAME>` to your server's address
* The endpoint is available at `/api/system/licensefile`

You can use this method both for initial license activation and for subsequent license updates.

#### Setting Up Your License Using Environment Variables

You can configure your license by setting the `CYBUS_LICENSE_FILE` environment variable in the `system-control-server` service.

To do this, you need the license file that you have downloaded via [one of these options](#downloading-license-files).

**Example**

Here's how to configure your `docker-compose.yml` file:

{% code lineNumbers="true" %}

```yaml
# [...]
system-control-server:
environment:
  CYBUS_LICENSE_FILE: 'Zm9vYmFyZm9vYmFyZm9vYmFyZm9vYmFyZm9vYmFyZm9v...'
  CYBUS_REGISTRY_PASS: ${CYBUS_REGISTRY_PASS}
  NODE_ENV: production
hostname: system-control-server
image: registry.cybus.io/cybus/system-control-server:1.0.58
# [...]
```

{% endcode %}

## Manually Refreshing Licenses in Connectware

You may need to manually refresh if your license has been upgraded on the [Cybus Portal](https://portal.cybus.io/) but the changes are not reflected in Connectware.

**Prerequisites**

* Internet connectivity is required for both automatic and manual license management.

**Procedure**

1. On the navigation panel, click **System**.
2. On the **System Status View**, click the **License** tab.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-c326cdf553f50af25617b4ecc065f4e5c36e3ff3%2Flicense-view.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Click **Refresh License** to sync with the Cybus Portal.

<figure><img src="https://246103054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlyBb7z1mMm0S99iAcpu%2Fuploads%2Fgit-blob-c785cdc51015b981ebc005ffed8f780ead46d203%2Flicense-refresh.png?alt=media" alt=""><figcaption></figcaption></figure>

## License Information via REST API

The system status API allows you to retrieve information about your license. For more information, see [System Status (API)](https://docs.cybus.io/2-0-4/reference/api-reference/api-definition-3).
