Verify License Key API

This article describes and shows how you can validate your applications license keys programmatically using our Verify License Key API.

Bjorn Forsberg avatar
Written by Bjorn Forsberg
Updated over a week ago

You can use license keys to protect and manage access to your software. These keys correspond to purchases that were made by customers, which you can verify through our API, to then authorise or revoke access in your software.

With Digital Downloads Pro, you have complete control over how you enforce your license keys. You can decide how many times each key can be used, based on the number of verify license API calls you make. Digital Downloads Pro does not provide any additional license key verification.

Keep in mind that if you check for a valid license each time your software is launched, the "uses" count for each key will be incremented. You can prevent this from happening by setting the "increment_uses_count" flag to false.

The license key journey

  • Create a license key list in Digital Downloads Pro

  • The customer will be assigned and receive their license key from the list, when they purchase

  • The customer launches your application and inputs the license key somewhere in the application

  • The application sends a request to Digital Downloads Pro verify license key API to check if the license is valid or not

  • The application receives a response from Digital Downloads Pro and gets the license information (including status, uses, order, line_item, and disabled_at, assigned_at, created_at information)

  • The application uses its own algorithm to check the license is valid or not

Verifying a license key uses these parameters

  • license_key_list_token (the unique token of the license key list)

  • license_key (the license key provided by your customer)

  • increment_uses_count ("true"/"false", optional, default: "true")

curl \
-d "license_key_list_token=93cf9a0fcbd6fd94448c16ed71eb81ff" \

If the license key is found and valid, it provides the 200 response with "valid" flag set to true:

"valid": true,
"disabled_at": null,
"uses": 29,
"license_key": "85DB262A-C19D4B06-A5335A6B-8C079166",
"license_key_list_token": "93cf9a0fcbd6fd94448c16ed71eb81ff",
"assigned_at": "2021-02-05T20:09:27Z",
"created_at": "2021-01-05T20:09:27Z",
"order": {
"status": "delivered",
"shopify_id": 1234567890,
"id": 1234567890,
"email": "[email protected]",
"created_at": "2021-02-05T20:09:27Z",
"line_item": {
id: 1234567890,
shopify_id: 1234567890

If the license key is not found you will receive a 404 response.

If the license key is found but not valid, you will receive the 200 response with the "valid" flag set to false:

"valid": false,
... same as valid response fields

In other words, you should ensure your application checks both for the 200 response, and the valid true flag before authorising access in your application.

Common reasons for invalid license keys:

  • The license key is disabled (disabled_at: is not NULL)

  • The order does not have "delivered" status (it is on-hold, cancelled, revoked etc.)

  • The line item which the license key was issued for has been refunded or removed from the order

  • The license key has not been assigned (assigned_at is NULL)

Incrementing uses count

By default, each time a license key is verified via the API, it will increment the "uses" integer on the LicenseKey, unless you include the parameter "increment_uses_count": false in the API call.

Disabling a license key uses these parameters:

  • license_key_list_token (the unique token of the license key list)

  • license_key (the license key provided by your customer)

curl \
-d "license_key_list_token=93cf9a0fcbd6fd94448c16ed71eb81ff" \

And provides the 200 response with:

"valid": false,
"disabled_at": "2021-03-05T20:09:27Z",
... same as valid response

It is not possible to re-enable a License Key using the API. You can re-enable license within the Digital Downloads Pro app.

If you have any questions regarding License Keys or the Verify License Keys API, please do get in contact with our friendly support team.

Did this answer your question?