License Keys

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

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 will prevent the player from downloading the game.

As you can clearly see, having license keys enabled for your game will only prevent 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 your game’s name.
  3. Click on the Keys option that can be found on the upper navigation bar.
  4. Click on Enable License Keys button.

Setup Overview


You will be prompted on whether you are absolutely sure to enable license keys. Enabling license keys means that no one without a license key will be able to 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 certain purpose. It’s a lot easier to work with collections rather than with individual keys.

There are several properties of collections:

  1. Distributed - This flag tells you if a 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 - Indicates that particular collection has been blocked from further use. Blocked keys can no longer be used by players, however, you can unblock any previously blocked collection.
  4. Status - Keys generation status. After ordering a large number of keys, you will have to wait some time before the collection will be ready to use.

Distributing a collection

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

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


PatchKit will not 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 collection as distributed, click the Action button and then select Mark as distributed from the dropdown menu.

Collection actions dropdown menu

Distributing individual keys

When you want to distribute a small amount of license keys, go into a collection and then:

  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. Choose Mark as distributed option from the dropdown menu. 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 will have a real effect on the players, as it will forbid them from downloading the game and updates.


Currently license keys are designed only to forbid the game from downloading or updating (depending on whether the player has already downloaded the game or not). It does not disallow the player to play the game in any way. To contain the player from playing the game, you have to implement license key checking within your game’s code. Currently there’s no simple way of doing it, so if you’re interested in making this kind of implementation, please contact us directly.

Securing the game from being played

License keys are preventing from 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 will 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 will pass to your game an argument that will look similarly to this:

+patcher-data-location app_data.json

The app_data.json file contents looks 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 do 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 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 that 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 will allow the player to play the game. It may be a good approach to allow to play the game offline at all times or for a limited amount of time.

Copyright © 2015 - 2018 Upsoft
All Rights Reserved.