Documentation

Documentation to build on the Passmarked platform

Balance

The balance endpoints allow the pulling of available credits in the system that can be used to run reports through the API. Users are able to purchase once-off credits if the bundle from their plan runs out.

Install the JAVASCRIPT WEB API

To enable the Passmarked client side API in your project, add the following script:

<script src="//jsapi.passmarked.com/v1.js"></script>

For more details, see github.com/passmarked/js on the project itself.

After adding the script, the passmarked object will become available for use

Creating a token

When generating tokens, options are given to decide the scope of the token. There are 2 scopes that can be selected, depending on which token will have specific permissions:

fullRepresenting the full user, these tokens can see the user's profile, balance and run reports using the credits of the owning user
limitThe token can only create report runs using the credits of the owning user, and not view any other details

To access the user's balance (as detailed here), the token must be full, which will allow access.

Request

To request the user profile, the .getBalance() function is provided. The function is called as follows:

passmarked.getBalance({
  token: '(token-here)'
}, function(err, results) {
  if(err) {
    console.error(err);
  } else {
    for(var i = 0; i < results.length; i++) {
      console.log(results[i].getDomain() + ' - (' + results[i].getBalance() + '/' + results[i].getCount() + ')';
    }
  }
});

The function supports and expects a few parameters as follows:

NameTypeDescription
tokenstringThe token that will be used to authenticate with the API

Response

The function will return a array of Website objects that has the following functions that are usefull for checking page check balances:

NameTypeDescription
.getBalance()stringReturns the number of available credits that the token can access from the profile of the user
.getUsed()stringReturns the number of credits already used as part of the active credit bundles
.getCount()stringReturns the total number of credits that was available during the active time period.
Signup icon
Ready to see how well your site scores?

Passmarked works best when you have an account. It allows you to keep a dashboard with saved data of the sites you have run through the system, we’ll alert you about important updates and you get access to the Passmarked Slack forum.

Sign up to get started