Feature Licenses

What is a feature license?

A feature license is a license that is entitled to utilize a particular feature of a software application, or many features. For example, an vendor may want to have certain premium features of their software application offers behind a "Pro" license, or a software business may want to limit features for timed trial licenses.

How do I implement a feature license?

The easiest way to configure your licenses to have different feature entitlements is by storing feature toggles in the license's metadata attribute. You can utilize a license's metadata attribute to store any type of key-value data.

For example, a license's metadata may look like this:

{
  "metadata": {
    "basicFeatureX": true,
    "basicFeatureY": true,
    "proFeatureZ": false
  }
}

These feature toggles can be utilized in your application by accessing the license's metadata attribute. The license object will be included in all license validation responses.

A license's metadata attribute can be edited and those changes will immediately be applied to the running application on subsequent license validation requests.


Using the entitlements resource

For more advanced feature entitlements, you can utilize the entitlements resource. Using the entitlements resource, you can define the various features of your application, and attach those entitlements to policies and to licenses.

An entitlement scope can be specific in license validation requests to check if a given license possesses a set of entitlements.

curl -X POST https://api.keygen.sh/v1/accounts/<%= account %>/licenses/actions/validate-key \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Accept: application/vnd.api+json' \
  -d '{
        "meta": {
          "key": "C1B6DE-39A6E3-DE1529-8559A0-4AF593-V3",
          "scope": {
            "entitlements": [
              "FEATURE_ENTITLEMENT_A",
              "FEATURE_ENTITLEMENT_B",
              "FEATURE_ENTITLEMENT_C"
            ]
          }
        }
      }'

Entitlements can be utilized to implement robust feature entitlement systems for your software application. In the future we'll be adding additional features such as entitlement meters and usage limits, so please reach out if you have any specific requirements.

View the validation action in the API reference


Embedding entitlements into license keys

By utilizing cryptographically signed or encrypted license keys, you can embed tamper-proof feature entitlements within the key itself.

Once a cryptographic license key is created, it cannot be changed. Meaning, the entitlements that you choose to embed into a license key cannot be changed, and changes to the license object itself have no effect on the embedded dataset. If you need to change the embedded entitlements, a new license will need to be created.

Seperate licenses per-feature or module

Feature licensing may also be accomplished using multiple licenses per-user, each license implementing a feature policy. For example, you could create a handful of policies, one for each feature or module you offer, and assign licenses implementing those policies to each user, according to their entitlements.


Offline capability

An offline-capable feature licensing model can be implemented in a couple different ways, depending on the method used for storing feature entitlements.

When utilizing cryptographically signed or encrypted license keys, you can decode or decrypt the embedded dataset and verify its authenticity according to the chosen cryptographic scheme. The decoded entitlement values can then be utilized in your software. This method does not require an up-front internet connection, since the cryptographic key can be delivered via email, license file, certificate, or USB key.

When utilizing a license's metadata for feature toggles, license validation data can be cached locally, along with the request signature, for offline use. This method will require an internet connection up-front for the initial validation request.


Perpetual LicenseTimed LicenseFloating LicenseNode‑locked LicenseFeature License
Expiration DateNoYesOptionalOptionalOptional
Activation LimitsOptionalOptional> 01Optional
Feature LimitsOptionalOptionalOptionalOptionalYes
Offline SupportYesYesYesYesYes
Learn MoreLearn MoreLearn MoreLearn More