Set Usage ‘Quota’ for a Feature

This article is deprecated and is kept as a reference only. Please see the updated code here.


Image you distribute trial keys and you want to restrict the number of times a certain feature can be used. Let’s assume that you’ve developed the application below, and you want your trial users to be able to record 10 videos at most. dtc


In order to achieve this, you will need to do two main things: create a specific access token and implement the logic in your software.

Access Token

The scope of the access token (aka permission) plays a vital role to make this process work the right way. That is because we assume that the application will be running on a client machine, which is classified as ‘low trust’ environment in Web API 3. The purpose of the token that we will generate is to allow us to generate a new access token that retains the same set of permissions except for the Key Lock, which is set to the specific license key that the customer enters. In this way, customers will have restricted access to their license key only.


In order to generate this specific access, please follow the steps below:

  1. Go to
  2. Check IncrementIntValue, AddDataObject, ListDataObjects
  3. Select the desired product in the Product Lock list,
  4. Enter -1 in the Key Lock box. (or, enter any value less than -1. this value affects the expiration date of the access token. please read more here)


There are, at least, two implementations of a usage counter. The examples below both use the the increment method. However, you can always use the decrement method to achieve the same result. The only  difference between the two approaches is that the first one does not store any access token on the client device, whereas the latter one does.

Without Storing the Access Token Example

Reusing the Same Access Token Example


About The Author

Most Helpful User

Rate This Article

(54 out of 89 people found this article helpful)

Leave A Comment?