Must know about API

Endpoint and schema


In order to be able to use Cleeng JavaScript API, you need to include following JS file in your HTML document:


Cleeng API can be accessed from following URLs:

JSON-RPC protocol (see specification page) is used to transport requests. Function calls are sent using HTTP POST method. Data is transmitted to and received from the server in JSON format. Here's how a typical request may look like:


Server response will be similar to:

        "displayName":"John Doe",


Most of the API functions will take either "customerToken" or "publisherToken" as their first parameter. Both types of token look similar (they are 48-character keys). Their purpose (and so level of access they give) is different.

Customer tokens

After a purchase is made (or access is granted) on the Cleeng platform, Cleeng will automatically pass Customer Token back to your website or application. It can be used then to verify access, using getAccessStatus method.

The Customer Token is automatically stored in a cookie after the JavaScript call to purchase, so in a normal scenario you don't need to worry about handling it.

Two things worth mentioning:

  • You can keep the Customer Token stored in the cookie, as it cannot be used to modify any data on Cleeng Platform directly. In that case the user will have to log-in again.
  • If you're using PHP SDK, you don't need to worry at all about handling the tokens. The SDK will automatically pass customerToken to functions that need it. For more information, please refer to reference of getAccessStatus, or to tutorials.

By default the Customer Tokens (and the cookie in which they are kept) expire in two weeks after being created. The login function (or generateCustomerToken - Enterprise only) can be used to generate new token if old one has expired.

Publisher tokens

The Publisher Token is used to identify merchant (the seller). This token is used to create and update offers, as well as gives access to other ecommerce functions (like reporting).

It can be obtained from API Keys Page (you must be logged in to Cleeng as a publisher to see this page).

Important: never expose your Publisher Token to the public. It will allow price updates and other sensitive data access.

Testing API calls

In order to make developers life easier, we prepared API console that allows to test the API functions before actually implementing them:

Go to API console »

While we suggest to use the Console for testing, you can also access API directly from command line using curl command:

curl -d '{"method":"getCustomer","params":{"customerToken":"eDpPP30t8LhJdW9mAKxennC6inFZScmfQqICbxNFrhJkSlsj"},"id":1,"json-rpc":"2.0"}'


Errors codes available through Cleeng API:

Code Description
1 Customer token cannot be empty
Customer token is invalid
3 Publisher token cannot be empty
Publisher token is invalid
4 Offer offerId does not exist.
5 Enterprise account is required to call this API.
10 User customerEmail does not exist.
Customer customerEmail is not associated with your account or doesn't exist.
customerEmail is not valid e-mail address.
11 E-mail address is required
Invalid customerData
Password is missing
12 Customer account is inactive
13 Customer already exists
14 Ip address limit exceeded
15 Invalid customer credentials
16 resetPasswordToken is not valid or has expired
resetUrl is not valid URL.

Back to Reference

We use cookies to ensure that we provide you the best service and website experience. Read our Cookie policy for more details.