API Calls

Making calls to the Clerk.io API from your application.

You can use Clerk.js to make calls to the Clerk.io API without dealing with the low-level details.

Clerk.js uses the following format: Clerk('call', api, args, callback) where each argument is described below.

Argument

Type

api

The API endpoint.

args

An object with keys as argument names dictionary. Check individual endpoint for required arguments.

callback

Javascript function handling the response. The response should take a single argument that's the response object from the API.

error

Javascript function handling any error. The response should take a single argument that's the response object from the API.

Clerk("call", 
  "recommendations/popular",
  {
    key: "INSERT_KEY",
    limit: 10,
    labels:["Home Page / Bestsellers"]
  },
  function(response){ 
    console.log(response); 
  },
  function(response){ 
    console.error(response); 
  }
);