Software Licensing API

The API included with the Software Licensing add-on allows you to remotely activate license keys, check if keys are valid (and not expired), and also retrieve information about the latest versions of software.

There are four API request types available:

  • activate_license - Used to remotely activate a license key
  • deactivate_license - Used to remotely deactivate a license key
  • check_license - Used to remotely check if a license key is activated, valid, and not expired
  • get_version - Used to remotely retrieve the latest version information for a product

Each of the methods below works in the same way. The website URL that you have Easy Digital Download + Software Licensing installed on will act as the API end point. All requests to the API are done as GET requests and follow this form:

http://YOURSITE.com/?edd_action={request type}&item_id={download ID here}&license=cc22c1ec86304b36883440e2e84cddff&url={url of the site being licensed}

The request requires three parameters and has one optional parameter:

  • edd_action - This is the type of request (see below)
  • item_id, use the Download ID of your download product. 
    item_name - If using the item_name instead of the item_id, enter the name of the product you are performing an API request. You can pass either item_name or item_id
  • license - This is the license key you are performing an action for
  • url - (optional) This is the site URL that the API request is coming from

Activate a License Key

To activate a license remotely, the URL you will use is:

http://YOURSITE.com/?edd_action=activate_license&item_id=8&license=cc22c1ec86304b36883440e2e84cddff&url=http://licensedsite.com

The item_id parameter (item_id=8) will be replaced with the actual ID of your product. You can find this in your dashboard beside the product: 


Note: If using item_name instead of item_id, enter the title of the product in Easy Digital Downloads exactly.

The license parameter is set to the license key you wish to activate.

The response for this request will be a JSON object. If the license has been successfully activated, the response will be:

{
	"license": "valid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "john@sample.com"
}

If the license is invalid and failed to activate, the response will be:

{
	"license": "invalid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "john@sample.com"
}

Check if a License is Valid / Active

Checking if a license is valid and not expired is very similar to activating. This request is usually done if you need to confirm that a license is still valid after it has been activated. Licenses expire after one year (by default), so this is what you will use to check if the license has expired.

To check a license remotely, the URL you will use is:

http://YOURSITE.com/?edd_action=check_license&item_id=8&license=cc22c1ec86304b36883440e2e84cddff&url=http://licensedsite.com 

The item_id parameter (item_id=8) will be replaced with the actual ID of your product. You can find this in your dashboard beside the product: 


Note: If using item_name instead of item_id, enter the title of the product in Easy Digital Downloads exactly.

The license parameter is set to the license key you wish to check.

The response for this request will be a json object. If the license is active and still valid, the response will be:

{
	"license": "valid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "john@sample.com"
}

If the license is invalid and failed to activate, the response will be:

{
	"license": "invalid",
	"item_name": "EDD Product name",
	"expires": "2014-10-23 00:00:00",
	"payment_id": 54224,
	"customer_name": "John Doe",
	"customer_email": "john@sample.com"
}

Getting version information

Retrieving the version information allows you to remotely retrieve data about the latest version number, including changelogs and download links for update files.

To get version information for a license key:

http://YOURSITE.com/?edd_action=get_version&item_name=8&license=cc22c1ec86304b36883440e2e84cddff&url=http://licensedsite.com 

The item_id parameter (item_id=8) will be replaced with the actual ID of your product. You can find this in your dashboard beside the product: 


Note: If using item_name instead of item_id, enter the title of the product in Easy Digital Downloads exactly.

Note: the  license and url parameters are optional. If they are omitted, the latest version information will be retrieved but no download link will be included.

The response will be a json object that looks something like this:

{
  "new_version": "2.0",
  "name": "Restrict Content Pro",
  "slug": "restrict-content-pro",
  "url": "https://edd.com/downloads/restrict-content-pro/?changelog=1",
  "last_updated": "2017-01-03 11:59:46",
  "homepage": "https://edd.com/downloads/restrict-content-pro/",
  "package": "",
  "download_link": "",
  "sections": "a:2:{s:11:\"description\";s:793:\"<p>Placerat porta in enim, urna cras, adipiscing augue dis lorem, pulvinar, natoque phasellus eu tincidunt, dictumst nunc ut dignissim turpis ac, pulvinar! Massa! Sed, enim, eu ac augue placerat scelerisque! Eu cursus, ridiculus cum nec lorem, natoque lorem dictumst amet! Nunc placerat dapibus enim dignissim, nunc mattis vel? Dolor nascetur placerat ridiculus augue massa porttitor turpis auctor, etiam et nisi pid ridiculus nisi duis ac. Turpis et non, dapibus diam! Placerat vel? Et, velit turpis mus sociis arcu, vel magna. Habitasse elementum elit cum nec est, eu, montes egestas est mattis lacus, turpis urna parturient, egestas, integer augue, penatibus natoque elit, rhoncus mid elementum, integer vut turpis. Et? Nisi pid. Nec, placerat ut tristique lorem a nunc velit nunc est.</p>\n\";s:9:\"changelog\";s:0:\"\";}",
  "banners": "a:2:{s:4:\"high\";s:0:\"\";s:3:\"low\";s:0:\"\";}"
}

The sections property is a serialized array that includes the full product description and changelog. If using ReadMe.txt parsing for WordPress plugins, it will also include additional information provided through the readme file.

If you wish to retrieve information about a  beta version, append &beta=1 to your API request URL, like so:

http://YOURSITE.com/?edd_action=get_version&item_id=8&license=cc22c1ec86304b36883440e2e84cddff&url=http://licensedsite.com&beta=1<br>

Accessing the API in other languages

Because the API uses simple HTTP POST requests, it can be accessed in just about any language. Here are some examples.

Creating Custom Formatted Keys

The default key format is a simple md5 sum. You may change that format to just about anything you want.