Web
Analytics
Hurry Up! Refer new customers to Codentheme and receive  10%  of their each purchase. Become an affiliate now

Codentheme’s REST API


Codentheme’s API (Application Programming Interfaces) powers Codentheme’s sellers to verify the purchase code of their customers.

How to use Codentheme’s API?

1. Get an API key
An API key is a unique code that is used as an access token for Codentheme API.

Follow these steps to generate your API key:

  1. Go to the Settings page.
  2. Select API Key tab (on the left side).
  3. Then click Generate API Key button.

how to get an api key

 

2. Make an API request
Make an API request using a REST method call.

Use curl to make a request to the https://api.codentheme.com/v1/ endpoint. The curl command includes  an action with verify-purchase value, your API key and the purchase code of the product.

curl -X POST https://api.codentheme.com/v1/ \
--data action=verify-purchase \
--data api-key=XXXXXXXXXXXXXXXXXXXXX \
--data purchase-code=XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX

The server response will be the following:
On success:

{ 
   "success": true,
   "product_id": 32456,
   "product": "The product title",
   "buyer": "buyer_username",
   "purchased_at": "2018-11-10 09:54:02",
   "license": "Regular License",
   "support_until": "2019-05-10 09:54:02"
}

On error:

{
   "success": false,
   "error": "An appropriate error message."
}

We can’t wait to see what you build!