License Keys

PatchKit allows you to use license keys with your games. If you’re looking for a way of limiting who should be allowed to play your game, license keys may be the best available option.

Patcher asking for a license key

How license keys are working?

As soon as license keys are enabled for your game, your players will be prompted to enter a license key by the Patcher. Failing to do so prevents the player from downloading the game.

As you can see, having license keys enabled for your game only prevents the player from downloading your game and its updates. As soon as your game is on the hard drive, it can be played without the need of having a valid license key if the player is smart enough to go into the installation directory and launch the game from its executable instead of using the Launcher. We call this approach a non-intrusive DRM since it requires the player to be fair without any negative impact on the game’s mechanics.

If you find this method of validation insufficient, it’s recommended to implement additional keys check inside of your game’s code. Details of how to do that can be found inside Securing the game from being played section.

Enabling license keys

License keys are disabled for all new games by default. To enable license keys:

  1. Go to Applications listing.
  2. Click on the name of your game.
  3. Click on the Keys option - it can be found on the upper navigation bar.
  4. Click on the Enable License Keys button.

Setup Overview


You will be prompted on whether you are sure to enable license keys. Enabling license keys means that no one without a license key can download or upgrade your game.

License keys collections table

License keys can be split into collections. Collection is a named set of license keys, and you may think of it as a box with keys created for a particular purpose. It’s a lot easier to work with collections rather than with individual keys.

There are several properties that collections may have:

  1. Distributed - This flag tells you whether the collection has been distributed. This flag is set manually and exists only for organizational purposes.
  2. In Use - The number of keys that have been used at least once. When a key has been used more than once, this number won’t change.
  3. Blocked - Tells whether this collection has been blocked from further use. Players can no longer use blocked keys. You can always unblock any previously blocked collections.
  4. Status - Keys generation status. If you order a large number of keys, you will have to wait sometime before the collection is ready to be used.

Distributing collection

There are two ways to distribute keys from a collection. You can:

  1. Click on the collection name and copy individual keys from the listing.
  2. Get a CSV file containing all the keys.


PatchKit won't distribute your keys in any particular way. If you want your keys to be delivered to your players, you have to do it on your own. Most probably you may want to integrate it with your game store.

As soon as a collection or a license key is distributed, it’s recommended to set distributed flag to true, so you don’t distribute it twice by mistake. To mark the collection as distributed, click the Action button and then select Mark as distributed from the drop-down menu.

Collection actions dropdown menu

Distributing individual keys

If you’d like to distribute a small amount of license keys, go into a collection and:

  1. Select the keys you want to mark as distributed using the checkbox on the left. License key checkbox
  2. Click on the With selected… button that can be found at the bottom of the page.
  3. From the drop-down menu choose Mark as distributed option. License key checkbox

Blocking collections and keys

Collections and keys can be blocked from further use in the manner similar to marking collections and keys as distributed. Note that blocking keys and collections have a real effect on the players by forbidding them from downloading the game and updates.

Securing the game from being played

License keys are preventing the game from being downloaded by default, as soon as it resides on the hard drive it can be played without any additional checks. Here you can find the instructions on how to make sure that player won’t be able to play the game without a valid license key.

Reading the license key

You can read the entered license key from your game. Patcher is passing to your game an argument that looks similar to this:

+patcher-data-location app_data.json

The app_data.json file contents look like this:


Make sure to verify that product_key_encryption is set to none and then read the product_key.


License key encryption is a feature that is not available yet. By default, it will always be set to none and you will be able to set the encryption method in the game's configuration panel.

Verifying the license key

To verify a license key, you need one more thing - your application secret. Make sure to hard-code it within your game. Then make a GET request to:

Make sure to replace LICENSE_KEY with entered license key and APP_SECRET with your application secret string. Now expect to receive HTTP 200 OK response and ignore the body content. Any other response code would mean that something is wrong with the license key and player is most probably not authorized to play the game.


Depending on the condition of the network, it may take up to 15 seconds to get a response from the license keys server. With a good network connection, it should not take more than 3 seconds.

Tolerance to errors

Missing +patcher-data-location parameter

If you cannot find this parameter within your application arguments, the player could’ve launched the game directly from the executable. You can try to locate this file manually or display an error with a request to start the game using the Launcher.

Invalid app_data.json content

If the content of app_data.json file is different than you’ve expected, somebody might’ve tried to point your game to a different file. You should terminate the game immediately and inspect the cause.

Keys server not reachable

Usually, a lack of Internet connection may be the reason. Then it’s up to you to decide if you allow the player to play the game. It may be a right approach to allow to play the game offline at all times or for a limited amount of time.

Did this page help you? For questions about this part, please use the chatbox on the right or contact support here.

Copyright © 2015 - 2019 Upsoft
All Rights Reserved.