check method returns the allowed field in real-time to check if a customer should have access to a feature. You can use this to block access and prompt an upsell.
The allowed field
The allowed field will return true for a given feature if:
- The customer has an active plan with this feature
- The customer has an active plan with a
credit_systemthat grants this feature - The plan feature is included or prepaid, and the current balance is greater than the
required_balanceparameter - The plan feature is usage-based, and the user has not exceeded their max spend limit
- The plan feature is unlimited or a boolean feature
allowed field as necessary.
The customer must already exist before calling
check. If the customer_id doesn’t match an existing customer, the API returns a customer_not_found error. Create customers using customers.getOrCreate during signup or login.Checking metered features
Before your customer uses a feature, you can check if the customer is allowed to use it and their current usage.ExampleLet’s imagine you have a free plan for a chatbot that allows 5 messages per month. Before your customer sends an AI message, you can check if they have any left.If they still have messages remaining, they’ll be allowed to send an AI message.
Checking for a required balance
If you know the balance a user will consume in advance, you can specify it with therequiredBalance parameter. This means you can prevent a user from starting a process that would consume more than their current balance.
By default, requiredBalance is 1, so not passing this parameter will return allowed: true as long as the customer has a feature balance of 1 or more.
Checking and tracking atomically
You can check access and record usage in a single, atomic API call using thesendEvent field. The usage value deducted from the balance will be the requiredBalance parameter. This is useful for concurrent events.
value in the track endpoint.
Checking boolean features
For simple on/off features, use the check method to determine if a customer has access:React
Feature flags in customer responses
Boolean features are also returned as aflags object on customer and entity API responses. This lets you check on/off feature access directly from the customer object without calling the check endpoint separately.
- Flags are separate from balances — boolean features appear under
flags, while metered and credit system features remain underbalances - Each flag shows which
planIdit originates from and when it expires - Use
expand: ["flags.feature"]to include the full feature object on each flag

