1. Reference
  2. Client SDK (Frontend) Reference


You’ll need to fetch a userToken and provide this when initializing the Kana JS Client instance in order for calls to be successfully made. We have a handy guide which goes into further detail on how to obtain and provide this.

Authorization (Frontend)


We return errors within the error field of a request. You can use the following to assign the relevant fields to a data or error variable and check against them to understand if problems occurred or if data was returned:

You can then decide to handle these however you feel is necessary.


You can provide the onError argument with an async function when initializing the client in order to globally take actions when errors occur. The following example logs all errors upon one occurring:

If using Typescript, errors will be typed and you can check against this type. The following error types are possible:

  • EmptyArgumentError

  • FeatureNotFoundError

  • AuthenticationError

  • NetworkError

  • Error


By default, we will retry sending all calls up to 2 times when a NetworkError occurs with no backoff or delay. You can override this behaviour with the retry argument:


canUseFeature(featureId, delta?)

Understand if a User is able to use a particular Feature.

The returned access boolean is true when the user has access (for Binary features), has enough of a feature remaining to be used (for Consumable features), or has overage enabled (for Consumable features).


featureIdString!The id of the feature. This maps to the id field as set on the Feature object.
deltaIntThe amount of the consumable feature which the user will be using and you want to check access against. Defaults to 1.


A Promise that resolves to a CanUseFeatureData object.




Lists the Features which a User has access to.


A Promise that resolves to an array of Feature objects with only the following fields present:

  • id

  • name

  • type

  • unitLabel

  • unitLabelPlural

  • metadata



Lists the plans which a user is subscribed to.


A Promise that resolves to an array of Package objects with only the following fields present:

  • id

  • name

  • isAddon

  • metadata



Resets a user’s data which has been stored in the cache.

By default, the SDK uses the cache to store a user’s subscribed packages and features upon initially calling any method. This cached data will then be returned when calling any method subsequently. You will need to call resetCache() in order to refresh this data.


A Promise that resolves to an empty object if the cache has been successfully reset.