Objects

Objects represent the resources that you can access. They contain fields. Each field has its own type, which could be Scalars, Enums, or other objects. Fields may have arguments. Fields with arguments work exactly like top-level Queries.

Feature

A feature of your product which you could consider to be billable. Features can be added to packages.

Fields

NameTypeDescription

id

The id of the feature which is provided by you.

name

The name of the feature.

type

The type of the feature. Either BINARY or CONSUMABLE.

unitLabel

The name of the consumable unit (eg. Message, API Call, etc). Only present if type is CONSUMABLE.

unitLabelPlural

The pluralised name of the consumable unit (eg. Messages, API Calls, etc). Only present if type is CONSUMABLE.

metadata

A set of key-value data which was attached by yourself to this object (ie. often additional data deemed useful to store).

packages

A list of the packages which are associated with the feature.

Fields with arguments

NameArgumentArgument TypeReturn TypeDescription

entitlement

userId

A user's entitlement to the feature.

What if a user is subscribed to multiple packages with the same feature?

If the user is subscribed to multiple packages which contain the same feature, then we will look for the associated Package with the highest limit and will only return the Entitlement for that package/feature combination.

Package

A collection of features. A user can subscribe to packages in order to gain access to the features within. This can be a base package, or an add-on (ie. those at an additional cost on top of the base).

Fields

NameTypeDescription

id

The id of the package which is provided by you.

name

The name of the package.

isAddon

Represents whether the package is an add-on (true) or a base package (false).

status

Represents whether the package is a DRAFT, ARCHIVED or PUBLISHED.

updatedAt

When the package was last updated.

features

A list of the features within the package.

prices

A list of prices which relate to this package.

PackageFeature

The feature as it sits within the package.

Fields

NameTypeDescription

id

The id of the Feature.

name

The name of the feature within the package. This can be different than the feature it relates to.

type

The type of the feature. Either BINARY or CONSUMABLE.

limit

Indicates the amount of the feature given in the package (ie. “500”). Only present if type is CONSUMABLE.

unitLabel

The name of the consumable unit for the feature (eg. Message, API Call, etc). Only present if type is CONSUMABLE.

unitLabelPlural

The pluralised name of the consumable unit for the feature (eg. Messages, API Calls, etc). Only present if type is CONSUMABLE.

metadata

A set of key-value data which was attached by yourself to the respective feature object (ie. often additional data deemed useful to store).

PackagePrice

An available price for the package which links to your billing provider (ie. Stripe).

Fields

NameTypeString

id

The id of the price as given by your billing provider (ie. price_1L7NHvIiEnRX8aivoxbSWREF).

provider

The billing provider to which this price belongs.

amount

The amount which users will be charged.

displayAmount

A read-friendly version of the amount.

currency

The currency of the amount which will be charged.

interval

The frequency at which someone will be charged this price.

Entitlement

A user’s entitlement to a particular feature.

Fields

NameTypeDescription

access

Specifies whether the user has access (true) or not (false) to the feature.

reason

The reason why the user either has access to the feature or not.

consumption

The amount of the feature which the user has used, their overall allowance (budget), and if they can go over that allowance.

Consumption

A user's consumption of a particular feature. Details the amount they have used, the amount they were granted, and if they can run over the given amount of the feature.

Fields

NameTypeDescription

used

The amount of the feature which has been used by the user.

budget

The amount of the feature which has been granted to the user. Will return null if unlimited.

overageEnabled

Flags whether a user can run over the amount of the feature (true) or if there is a hard limit that should prevent usage (false).

ConsumptionInPeriod

Shows the consumption of a feature within a given time period.

Fields

NameTypeDescription

periodStart

The start of the usage period in ISO 8601 timestamp format.

periodEnd

The end of the usage period in ISO 8601 timestamp format.

consumption

The consumption of the feature within the given time period.

PackageSubscription

The subscription of a user to a particular package.

Fields

NameTypeDescription

id

A Kana-generated identifier for the subscription.

userId

The id of the user.

status

The status of the subscription of the user to the package. Either ACTIVE or CANCELLED.

package

The package which is associated to the subscription.

CanUseFeatureData

A user’s entitlement to a particular feature.

Fields

NameTypeDescription

access

Specifies whether the user has access (true) or not (false) to the feature.

reason

The amount of the feature which the user has used, their overall allowance (budget), and if they can go over that allowance.

consumption

The amount of the feature which the user has used, their overall allowance (budget), and if they can go over that allowance.

ShowUsageData

Provides the current and past consumption of a feature within the given time period(s).

Fields

NameTypeDescription

current

The consumption a the feature in the current period of usage.

past

A list detailing the previous consumption of a feature within the given periods of usage.

Provides a link which a user should navigate to in order to pay and subscribe to a package.

Currently only works if Stripe is linked as a billing provider for the package.

Fields

NameTypeDescription

url

The generated URL for a user to navigate to and pay to subscribe to a package.

User

A user of your product who can subscribe to packages and access and use the features within.

Fields

NameTypeDescription

id

The id of the user which is provided by you.

billingId

The id of the user as given by your billing provider (ie. cus_Lp1bSKob4laHDD).

name

The name of the user.

email

The email of the user.

metadata

A set of key-value data which was attached by yourself to this object (ie. often additional data deemed useful to store).

RecordedUsage

Fields

NameTypeDescription

recorded

Specifies whether the usage of the feature was recorded (true) or not (false).

reason

The reason why the usage of the feature was either recorded or not.

GeneratedUserToken

The client-side token needed for Secure Mode authentication of the Client SDK (Frontend).

Fields

NameTypeDescription

token

The generated token which is scoped to the user.

Last updated